ERP优化,物料TP默认ERP,合同查询直接查ERP
This commit is contained in:
@@ -55,4 +55,7 @@ public class ErpMaterialPageReqVO extends PageParam {
|
|||||||
@Schema(description = "物料长描述")
|
@Schema(description = "物料长描述")
|
||||||
private String materialLengthDescription;
|
private String materialLengthDescription;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -68,4 +68,8 @@ public class ErpMaterialRespVO {
|
|||||||
@ExcelProperty("物料长描述")
|
@ExcelProperty("物料长描述")
|
||||||
private String materialLengthDescription;
|
private String materialLengthDescription;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
@ExcelProperty("类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
@@ -65,4 +66,7 @@ public class ErpMaterialSaveReqVO {
|
|||||||
@NotEmpty(message = "物料长描述不能为空")
|
@NotEmpty(message = "物料长描述不能为空")
|
||||||
private String materialLengthDescription;
|
private String materialLengthDescription;
|
||||||
|
|
||||||
|
@Schema(description = "类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.zt.plat.module.erp.dal.dataobject.erp;
|
package com.zt.plat.module.erp.dal.dataobject.erp;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.zt.plat.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -21,10 +22,8 @@ import java.time.LocalDateTime;
|
|||||||
/**
|
/**
|
||||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||||
*/
|
*/
|
||||||
//public class ErpMaterialDO extends BaseDO {
|
public class ErpMaterialDO extends BusinessBaseDO {
|
||||||
public class ErpMaterialDO {
|
//public class ErpMaterialDO {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
||||||
@@ -97,7 +96,7 @@ public class ErpMaterialDO {
|
|||||||
@TableField("MTRL_LEN_DSP")
|
@TableField("MTRL_LEN_DSP")
|
||||||
private String materialLengthDescription;
|
private String materialLengthDescription;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField("TP")
|
||||||
private Integer TENANT_ID;
|
private String type;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
import com.zt.plat.framework.common.pojo.PageResult;
|
import com.zt.plat.framework.common.pojo.PageResult;
|
||||||
import com.zt.plat.framework.common.util.object.BeanUtils;
|
import com.zt.plat.framework.common.util.object.BeanUtils;
|
||||||
|
import com.zt.plat.module.erp.dal.dataobject.erp.ErpProductiveOrderDO;
|
||||||
import com.zt.plat.module.erp.utils.ErpConfig;
|
import com.zt.plat.module.erp.utils.ErpConfig;
|
||||||
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
import com.zt.plat.module.erp.utils.MyRedisConfig;
|
||||||
import com.zt.plat.module.erp.enums.OftenEnum;
|
import com.zt.plat.module.erp.enums.OftenEnum;
|
||||||
@@ -19,6 +20,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -100,7 +104,72 @@ public class ErpContractServiceImpl implements ErpContractService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ErpContractDO> getErpContractPage(ErpContractPageReqVO pageReqVO) {
|
public PageResult<ErpContractDO> getErpContractPage(ErpContractPageReqVO pageReqVO) {
|
||||||
return erpContractMapper.selectPage(pageReqVO);
|
OftenEnum.FuncnrEnum funcnrEnum = OftenEnum.FuncnrEnum.合同信息;
|
||||||
|
String funcnr = funcnrEnum.getFuncnr();
|
||||||
|
Map<String, Object> req = new HashMap<>();
|
||||||
|
|
||||||
|
// 构建查询参数
|
||||||
|
req.put("BUKRS", pageReqVO.getContractSignNumber());
|
||||||
|
req.put("PARTNER", pageReqVO.getSupplierNumber());
|
||||||
|
req.put("INEDR", pageReqVO.getContractCategory());
|
||||||
|
req.put("ZHTBH", pageReqVO.getContractTypeNumber());
|
||||||
|
req.put("ZHTMC", pageReqVO.getContractName());
|
||||||
|
|
||||||
|
// 调用ERP接口获取数据
|
||||||
|
HashMap<String, Object> dataFromERP = erpConfig.fetchDataFromERP(funcnr, req);
|
||||||
|
JSONArray dataArray = (JSONArray) dataFromERP.get("E_RESP");
|
||||||
|
if (dataArray == null || dataArray.isEmpty()) {
|
||||||
|
// 返回空结果而不是抛出异常
|
||||||
|
return new PageResult<>(new ArrayList<>(), 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ErpContractDO> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < dataArray.size(); i++) {
|
||||||
|
JSONObject dataJson = dataArray.getJSONObject(i);
|
||||||
|
if (dataJson != null) {
|
||||||
|
ErpContractDO contractDO = new ErpContractDO();
|
||||||
|
|
||||||
|
// 基本信息
|
||||||
|
contractDO.setContractPaperNumber(dataJson.getString("ZHTBH").trim());
|
||||||
|
contractDO.setContractName(dataJson.getString("ZHTMC"));
|
||||||
|
contractDO.setContractTypeName(dataJson.getString("TYPENM"));
|
||||||
|
contractDO.setSupplierName(dataJson.getString("ZBPNM"));
|
||||||
|
|
||||||
|
// 日期处理
|
||||||
|
String signDate = dataJson.getString("ZQDATE");
|
||||||
|
String startDate = dataJson.getString("ZSDATE");
|
||||||
|
String stopDate = dataJson.getString("ZEDATE");
|
||||||
|
|
||||||
|
if (signDate != null && !signDate.equals("0000-00-00")) {
|
||||||
|
try {
|
||||||
|
contractDO.setSignDate(LocalDate.parse(signDate));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略日期解析错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startDate != null && !startDate.equals("0000-00-00")) {
|
||||||
|
try {
|
||||||
|
contractDO.setStartDate(LocalDate.parse(startDate));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略日期解析错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stopDate != null && !stopDate.equals("0000-00-00")) {
|
||||||
|
try {
|
||||||
|
contractDO.setStopDate(LocalDate.parse(stopDate));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 忽略日期解析错误
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contractDO.setBasicAmount(dataJson.getBigDecimal("ZDMBTR"));
|
||||||
|
contractDO.setRemark(dataJson.getString("ZREMARK"));
|
||||||
|
list.add(contractDO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 返回分页结果
|
||||||
|
return new PageResult<>(list, (long) list.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
Map<String, String> datumEntry = new HashMap<>();
|
Map<String, String> datumEntry = new HashMap<>();
|
||||||
datumEntry.put("sign", "I");
|
datumEntry.put("sign", "I");
|
||||||
datumEntry.put("option", "EQ");
|
datumEntry.put("option", "EQ");
|
||||||
// datumEntry.put("low", "2021-05-16");
|
// datumEntry.put("low", "2021-05-20");
|
||||||
datumEntry.put("low", LocalDate.now().toString());
|
datumEntry.put("low", LocalDate.now().toString());
|
||||||
datumList.add(datumEntry);
|
datumList.add(datumEntry);
|
||||||
req.put(funcnrEnum.getDatekey(), datumList);
|
req.put(funcnrEnum.getDatekey(), datumList);
|
||||||
@@ -180,6 +180,7 @@ public class ErpMaterialServiceImpl implements ErpMaterialService {
|
|||||||
DO.setExternalMaterialGroupDescription(dataJson.getString("EWBEZ"));
|
DO.setExternalMaterialGroupDescription(dataJson.getString("EWBEZ"));
|
||||||
DO.setMaterialName(dataJson.getString("MAKTX"));
|
DO.setMaterialName(dataJson.getString("MAKTX"));
|
||||||
DO.setMaterialLengthDescription(dataJson.getString("LDESC"));
|
DO.setMaterialLengthDescription(dataJson.getString("LDESC"));
|
||||||
|
DO.setType("ERP");
|
||||||
|
|
||||||
if (comnumbers.contains(number)) {
|
if (comnumbers.contains(number)) {
|
||||||
// 更新
|
// 更新
|
||||||
|
|||||||
@@ -11,26 +11,27 @@
|
|||||||
|
|
||||||
|
|
||||||
<update id="updateBatchByNumber">
|
<update id="updateBatchByNumber">
|
||||||
<foreach collection="toUpdate" item="item" separator=";" open="BEGIN" close=";END;">
|
<foreach collection="toUpdate" item="item" separator=";" open="BEGIN" close=";END;">
|
||||||
UPDATE SPLY_ERP_MTRL
|
UPDATE SPLY_ERP_MTRL
|
||||||
<set>
|
<set>
|
||||||
<if test="item.downCtrNum != null">DOWN_CTR_NUM = #{item.downCtrNum},</if>
|
<if test="item.downCenterNumber != null">DOWN_CTR_NUM = #{item.downCenterNumber},</if>
|
||||||
<if test="item.ctrNum != null">CTR_NUM = #{item.ctrNum},</if>
|
<if test="item.centerNumber != null">CTR_NUM = #{item.centerNumber},</if>
|
||||||
<if test="item.crtDt != null">CRT_DT = #{item.crtDt},</if>
|
<if test="item.createDate != null">CRT_DT = #{item.createDate},</if>
|
||||||
<if test="item.mtrlTp != null">MTRL_TP = #{item.mtrlTp},</if>
|
<if test="item.materialType != null">MTRL_TP = #{item.materialType},</if>
|
||||||
<if test="item.mtrlGrpDt != null">MTRL_GRP_DT = #{item.mtrlGrpDt},</if>
|
<if test="item.materialGroupDate != null">MTRL_GRP_DT = #{item.materialGroupDate},</if>
|
||||||
<if test="item.extMtrlGrpDt != null">EXT_MTRL_GRP_DT = #{item.extMtrlGrpDt},</if>
|
<if test="item.externalMaterialGroupDate != null">EXT_MTRL_GRP_DT = #{item.externalMaterialGroupDate},</if>
|
||||||
<if test="item.unt != null">UNT = #{item.unt},</if>
|
<if test="item.unit != null">UNT = #{item.unit},</if>
|
||||||
<if test="item.untDsp != null">UNT_DSP = #{item.untDsp},</if>
|
<if test="item.unitDescription != null">UNT_DSP = #{item.unitDescription},</if>
|
||||||
<if test="item.mtrlTpDsp != null">MTRL_TP_DSP = #{item.mtrlTpDsp},</if>
|
<if test="item.materialTypeDescription != null">MTRL_TP_DSP = #{item.materialTypeDescription},</if>
|
||||||
<if test="item.mtrlGrpDsp != null">MTRL_GRP_DSP = #{item.mtrlGrpDsp},</if>
|
<if test="item.materialGroupDescription != null">MTRL_GRP_DSP = #{item.materialGroupDescription},</if>
|
||||||
<if test="item.extMtrlGrpDsp != null">EXT_MTRL_GRP_DSP = #{item.extMtrlGrpDsp},</if>
|
<if test="item.externalMaterialGroupDescription != null">EXT_MTRL_GRP_DSP =#{item.externalMaterialGroupDescription},</if>
|
||||||
<if test="item.mtrlName != null">MTRL_NAME = #{item.mtrlName},</if>
|
<if test="item.materialName != null">MTRL_NAME = #{item.materialName},</if>
|
||||||
<if test="item.mtrlLenDsp != null">MTRL_LEN_DSP = #{item.mtrlLenDsp},</if>
|
<if test="item.materialLengthDescription != null">MTRL_LEN_DSP = #{item.materialLengthDescription},</if>
|
||||||
<if test="item.tenantId != null">TENANT_ID = #{item.tenantId},</if>
|
<if test="item.type != null">TP = #{item.type},</if>
|
||||||
</set>
|
<if test="item.tenantId != null">TENANT_ID = #{item.tenantId},</if>
|
||||||
WHERE DOWN_CTR_NUM = #{item.number}
|
</set>
|
||||||
</foreach>
|
WHERE DOWN_CTR_NUM = #{item.downCenterNumber}
|
||||||
</update>
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user