refactor(uapbd): 精密-启源物料的启源物料编码赋值调整
- 新增方法 queryMaterialPlanInfoByPks 查询物料计划信息 - 在同步物料信息时,添加启源物料编码字段
This commit is contained in:
parent
2ddbae4c16
commit
6d66c26bc6
|
@ -10,19 +10,23 @@ import nc.bs.businessevent.IBusinessEvent;
|
||||||
import nc.bs.businessevent.IBusinessListener;
|
import nc.bs.businessevent.IBusinessListener;
|
||||||
import nc.bs.businessevent.bd.BDCommonEvent;
|
import nc.bs.businessevent.bd.BDCommonEvent;
|
||||||
import nc.bs.dao.BaseDAO;
|
import nc.bs.dao.BaseDAO;
|
||||||
|
import nc.bs.framework.common.NCLocator;
|
||||||
import nc.bs.logging.Log;
|
import nc.bs.logging.Log;
|
||||||
import nc.bs.trade.business.HYPubBO;
|
import nc.bs.trade.business.HYPubBO;
|
||||||
import nc.bs.uapbd.util.MyHelper;
|
import nc.bs.uapbd.util.MyHelper;
|
||||||
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
import nc.bs.uapbd.util.ThirdPartyPostRequestUtil;
|
||||||
import nc.jdbc.framework.processor.MapProcessor;
|
import nc.jdbc.framework.processor.MapProcessor;
|
||||||
|
import nc.pubitf.uapbd.IMaterialPubService;
|
||||||
|
import nc.util.mmf.framework.base.MMValueCheck;
|
||||||
import nc.vo.bd.material.MaterialVO;
|
import nc.vo.bd.material.MaterialVO;
|
||||||
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
import nc.vo.bd.material.marbasclass.MarBasClassVO;
|
||||||
|
import nc.vo.bd.material.plan.MaterialPlanVO;
|
||||||
import nc.vo.org.OrgVO;
|
import nc.vo.org.OrgVO;
|
||||||
import nc.vo.pub.BusinessException;
|
import nc.vo.pub.BusinessException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Map;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 精密-物料新增修改后同步启源的物料
|
* 精密-物料新增修改后同步启源的物料
|
||||||
|
@ -103,7 +107,13 @@ public class MaterialToJmQmsListener implements IBusinessListener {
|
||||||
// 计量单位
|
// 计量单位
|
||||||
String pkMaterial = vo.getPk_material();
|
String pkMaterial = vo.getPk_material();
|
||||||
Map unitMap = getGoodsInfo(pkMaterial);
|
Map unitMap = getGoodsInfo(pkMaterial);
|
||||||
|
Map<String, MaterialPlanVO> planMap = queryMaterialPlanInfoByPks(new String[]{pkMaterial}, pkOrg,
|
||||||
|
new String[]{MaterialPlanVO.DEF2});
|
||||||
|
String qyCode = "";
|
||||||
|
if (MMValueCheck.isNotEmpty(planMap) &&
|
||||||
|
MMValueCheck.isNotEmpty(planMap.get(pkMaterial))) {
|
||||||
|
qyCode = planMap.get(pkMaterial).getDef2();
|
||||||
|
}
|
||||||
// 1=未启用;2=已启用;3=已停用;
|
// 1=未启用;2=已启用;3=已停用;
|
||||||
Integer enablestate = vo.getEnablestate();
|
Integer enablestate = vo.getEnablestate();
|
||||||
String statusCode = (3 == enablestate) ? "1" : "0";
|
String statusCode = (3 == enablestate) ? "1" : "0";
|
||||||
|
@ -113,7 +123,8 @@ public class MaterialToJmQmsListener implements IBusinessListener {
|
||||||
long cts = System.currentTimeMillis();
|
long cts = System.currentTimeMillis();
|
||||||
singleObj.put("batchid", cts);
|
singleObj.put("batchid", cts);
|
||||||
JSONObject contentObj = new JSONObject();
|
JSONObject contentObj = new JSONObject();
|
||||||
contentObj.put("meswlbh", vo.getCode()); // ÆôÔ´ÎïÁϱàÂë
|
// 计划信息自定义项2(原系统编码)BIP传启源物料档案的物料编码,BIP中物料编码传启源自定义字段“BIP物料编码”
|
||||||
|
contentObj.put("meswlbh", qyCode); // 启源物料编码
|
||||||
contentObj.put("bipwlbh", vo.getCode()); // BIP物料编码
|
contentObj.put("bipwlbh", vo.getCode()); // BIP物料编码
|
||||||
contentObj.put("wlmc", vo.getName()); // 物料名称
|
contentObj.put("wlmc", vo.getName()); // 物料名称
|
||||||
contentObj.put("wlxhgg", vo.getMaterialtype() + vo.getMaterialspec()); // 物料型号规格
|
contentObj.put("wlxhgg", vo.getMaterialtype() + vo.getMaterialspec()); // 物料型号规格
|
||||||
|
@ -200,4 +211,18 @@ public class MaterialToJmQmsListener implements IBusinessListener {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, MaterialPlanVO> queryMaterialPlanInfoByPks(String[] pks, String pk_stockorg,
|
||||||
|
String[] fields) throws BusinessException {
|
||||||
|
Map<String, MaterialPlanVO> map = null;
|
||||||
|
List<String> vids = Stream.of(pks).filter(Objects::nonNull).distinct().toList();
|
||||||
|
if (vids.isEmpty()) {
|
||||||
|
map = new HashMap<>();
|
||||||
|
} else {
|
||||||
|
map = NCLocator.getInstance().lookup(IMaterialPubService.class)
|
||||||
|
.queryMaterialPlanInfoByPks(vids.toArray(new String[0]), pk_stockorg, fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue