内配订单推PLM调整
This commit is contained in:
parent
ce4ce8d55b
commit
2f935db45f
|
@ -1,10 +1,8 @@
|
|||
package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.gson.Gson;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.logging.Log;
|
||||
|
@ -12,8 +10,6 @@ import nc.bs.trade.business.HYPubBO;
|
|||
import nc.bs.trade.business.HYSuperDMO;
|
||||
import nc.bs.uapbd.util.MyHelper;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.jdbc.framework.processor.MapProcessor;
|
||||
import nc.uif.pub.exception.UifException;
|
||||
import nc.vo.bd.defdoc.DefdocVO;
|
||||
import nc.vo.cmp.util.StringUtils;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
|
@ -42,6 +38,8 @@ import java.util.Map;
|
|||
|
||||
/**
|
||||
* BIP 系统将生产订单类型为“内配订单 ”的生产订单按照物料编码+项目号向PLM 传递设计任务, PLM 方接收后根据项目号,与成套产品设计任务挂载到相同位置。
|
||||
*
|
||||
* @author lihao
|
||||
*/
|
||||
public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
||||
|
||||
|
@ -58,13 +56,14 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
|
||||
|
||||
private Map<String, String> configParams;
|
||||
|
||||
@Override
|
||||
public void process(PMOAggVO[] pmoAggVOS) {
|
||||
if (ArrayUtil.isEmpty(pmoAggVOS)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
configParams= getConfigParams("Dldz-config");
|
||||
configParams = getConfigParams("Dldz-config");
|
||||
PMOAggVO[] cloneOrderVOS = (PMOAggVO[]) CloneUtil.deepClone(pmoAggVOS);
|
||||
// 检查并筛选生产订单
|
||||
List<PMOAggVO> filteredOrders = checkAndFilterBillSrcOrg(cloneOrderVOS);
|
||||
|
@ -72,10 +71,10 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
return;
|
||||
}
|
||||
|
||||
// 推送到锐制系统
|
||||
// 推送到思普PLM系统
|
||||
pushToRZMOM(filteredOrders);
|
||||
} catch (Exception e) {
|
||||
logDl.error("同步生产订单到RZ系统失败: " + e.getMessage());
|
||||
logDl.error("同步生产订单到SPPLM系统失败: " + e.getMessage());
|
||||
ExceptionUtils.wrappException(e);
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +82,7 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
private void pushToRZMOM(List<PMOAggVO> array) throws BusinessException, IOException {
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
if (array == null || array.size() == 0) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
for (PMOAggVO vo : array) {
|
||||
|
@ -93,13 +92,13 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
// 获取父 VO(假设大部分字段在 ParentVO 中)
|
||||
PMOHeadVO parentVO = vo.getParentVO();
|
||||
// 获取子 VO(假设部分自定义字段在 ChildVO 或表体 VO 中)
|
||||
PMOItemVO[] childVO = vo.getChildrenVO(); // 或其他子 VO 如 getBodyVO()
|
||||
for (PMOItemVO itemVO : childVO) {
|
||||
// 1. 产品品号 (cmaterialvid -> 物料编码)
|
||||
if (itemVO != null) {
|
||||
PMOItemVO[] childVO = vo.getChildrenVO(); // 或其他子 VO 如 getBodyVO()
|
||||
for (PMOItemVO itemVO : childVO) {
|
||||
// 1. 产品品号 (cmaterialvid -> 物料编码)
|
||||
if (itemVO != null) {
|
||||
// NO 产品品号 cmaterialvid 物料编码
|
||||
// NAME 产品名称 name 物料名称
|
||||
// ASUSER34 项目名称 project_name 项目名称
|
||||
// ASUSER34 项目名称 projectName 项目名称
|
||||
// ASUSER28 生产计划号 vsrccode 来源单据号 销售订单号
|
||||
// AB012 数量 nastnum 数量
|
||||
// GSDM 公司代码
|
||||
|
@ -107,34 +106,33 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
// MAINASSISTMATERIALSDATE 主辅材下发时间 vdef19 主辅材下发时间
|
||||
// ASSISTMATERIALSDATE 辅材下发时间 vdef18 辅材下发时间
|
||||
// DRAWINGPICKINGDATE 图纸下发时间 表体自定义项 图纸下发时间
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
Object no = hybo.findColValue("bd_material", "code", "pk_material = '"+itemVO.getCmaterialvid()+"' ");
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
Object no = hybo.findColValue("bd_material", "code", "pk_material = '" + itemVO.getCmaterialvid() + "' ");
|
||||
|
||||
Object name = hybo.findColValue("bd_material", "name", "pk_material = '"+itemVO.getCmaterialvid()+"' ");
|
||||
Object pk_project = hybo.findColValue("bd_project", "project_name", " pk_project = '" + itemVO.getCprojectid() + "' ");
|
||||
Object name = hybo.findColValue("bd_material", "name", "pk_material = '" + itemVO.getCmaterialvid() + "' ");
|
||||
Object projectName = hybo.findColValue("bd_project", "projectName", " pk_project = '" + itemVO.getCprojectid() + "' ");
|
||||
Object GSDM = hybo.findColValue("org_factory", "code", " pk_factory = '" + parentVO.getPk_org() + "' ");
|
||||
|
||||
Object GSDM = hybo.findColValue("org_factory", "code", " pk_factory = '" + parentVO.getPk_org() + "' ");
|
||||
request.put("no", no);
|
||||
|
||||
request.put("no",no);
|
||||
request.put("name", name);
|
||||
|
||||
request.put("name",name);
|
||||
request.put("ASUSER34", projectName);
|
||||
|
||||
request.put("ASUSER34", pk_project);
|
||||
request.put("ASUSER28", itemVO.getVfirstcode());
|
||||
request.put("AB012", itemVO.getNastnum());
|
||||
|
||||
request.put("ASUSER28", itemVO.getVsrccode());
|
||||
request.put("AB012", itemVO.getNastnum());
|
||||
|
||||
request.put("GSDM", GSDM);
|
||||
request.put("MATERIALSISSUEDATE", itemVO.getVdef17());
|
||||
request.put("MAINASSISTMATERIALSDATE", itemVO.getVdef18());
|
||||
request.put("ASSISTMATERIALSDATE", itemVO.getVdef19());
|
||||
request.put("DRAWINGPICKINGDATE", itemVO.getVdef20()); // 替换为实际字段名,如 getVdef20()
|
||||
// 将组装好的 Map 添加到结果列表
|
||||
resultList.add(request);
|
||||
}
|
||||
request.put("GSDM", GSDM);
|
||||
request.put("MATERIALSISSUEDATE", itemVO.getVdef17());
|
||||
request.put("MAINASSISTMATERIALSDATE", itemVO.getVdef18());
|
||||
request.put("ASSISTMATERIALSDATE", itemVO.getVdef19());
|
||||
request.put("DRAWINGPICKINGDATE", itemVO.getVdef20()); // 替换为实际字段名,如 getVdef20()
|
||||
// 将组装好的 Map 添加到结果列表
|
||||
resultList.add(request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// 创建 Jackson 核心对象
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
|
@ -148,12 +146,12 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
plmBaseUrl = configParams.get("plmBaseUrl");
|
||||
plmUser = configParams.get("plmUser");
|
||||
token = getToken();
|
||||
logDl.info("请求参数 :"+jsonArrayStr);
|
||||
String responseString= this.doPost(plmBaseUrl+pmourl,jsonArrayStr);
|
||||
logDl.info("返回结果 :"+responseString);
|
||||
logDl.error("AfterApproveSyncPLMRule-param = " + jsonArrayStr);
|
||||
String responseString = this.doPost(plmBaseUrl + pmourl, jsonArrayStr);
|
||||
logDl.error("AfterApproveSyncPLMRule-res = " + responseString);
|
||||
Gson gson = new Gson();
|
||||
Map result = gson.fromJson(responseString, Map.class);
|
||||
if (!result.get("success").toString().equals("true")) {
|
||||
if (!"true".equals(result.get("success").toString())) {
|
||||
throw new BusinessException(result.get("msg").toString());
|
||||
}
|
||||
|
||||
|
@ -173,9 +171,9 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
if (MyHelper.checkIfDldzOrg(orgCode, configParams)) {
|
||||
continue;
|
||||
}
|
||||
Object pk_billtypecode=hybo.findColValue("bd_billtype","pk_billtypecode"," istransaction = 'Y' and nvl ( islock, 'N' ) = 'N' and parentbilltype = '55A2' and pk_group = '"
|
||||
Object pk_billtypecode = hybo.findColValue("bd_billtype", "pk_billtypecode", " istransaction = 'Y' and nvl ( islock, 'N' ) = 'N' and parentbilltype = '55A2' and pk_group = '"
|
||||
+ InvocationInfoProxy.getInstance().getGroupId() + "' and pk_billtypeid = '" + pmoAggVO.getParentVO().getCtrantypeid() + "' ");
|
||||
if(pk_billtypecode.equals("55A2-Cxx-08")){
|
||||
if (pk_billtypecode.equals("55A2-Cxx-08")) {
|
||||
filteredOrders.add(pmoAggVO);
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +181,7 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
|
||||
return filteredOrders;
|
||||
}
|
||||
|
||||
public Map<String, String> getConfigParams(String code) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String strWhere = " pk_defdoclist in (select pk_defdoclist from bd_defdoclist where code='[code]' and dr=0 ) and dr=0";
|
||||
|
@ -200,6 +199,7 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
private String doPost(String requestUrl, String param) throws IOException {
|
||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||
cm.setMaxTotal(500);
|
||||
|
@ -221,8 +221,6 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取token
|
||||
*/
|
||||
|
@ -239,6 +237,7 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
private String doGet(String requestUrl, Map<String, String> paramMap) throws IOException {
|
||||
PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
|
||||
cm.setMaxTotal(5000);
|
||||
|
@ -267,4 +266,5 @@ public class AfterApproveSyncPLMRule implements IRule<PMOAggVO> {
|
|||
get.releaseConnection();
|
||||
return responseString;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue