PMO-艾普mes1
This commit is contained in:
parent
733c6de713
commit
27368587f3
|
|
@ -3,12 +3,12 @@ package nc.bs.mmpac.pickm.bp.rule;
|
|||
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.rule.util.SyncEpicMesUtil;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.itf.mmpac.pmo.pac0002.IPMOQueryService;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.mmpac.pickm.entity.AggPickmVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.util.HttpPmoEpicMesUtil;
|
||||
import nc.vo.pub.BusinessException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -52,7 +52,7 @@ public class AfterupdateSyncEpicMesRule implements IRule<AggPickmVO> {
|
|||
}
|
||||
}
|
||||
if (list.size() > 0) {
|
||||
SyncEpicMesUtil mesUtil = new SyncEpicMesUtil();
|
||||
HttpPmoEpicMesUtil mesUtil = new HttpPmoEpicMesUtil();
|
||||
// ±¸ÁÏÖØËãºó´¥·¢ÉóºË
|
||||
String n = "Y";
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
|||
|
||||
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.rule.util.SyncEpicMesUtil;
|
||||
import nc.impl.pubapp.pattern.rule.IRule;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.util.HttpPmoEpicMesUtil;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
import nc.vo.scmpub.util.ArrayUtil;
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ public class AfterApproveSyncEpicMesRule implements IRule<PMOAggVO> {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
SyncEpicMesUtil mesUtil = new SyncEpicMesUtil();
|
||||
HttpPmoEpicMesUtil mesUtil = new HttpPmoEpicMesUtil();
|
||||
mesUtil.processData(pmoAggVOS, "Y");
|
||||
} catch (Exception e) {
|
||||
logDl.error("同步生产订单到艾普MES系统失败: " + e.getMessage(), e);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package nc.bs.mmpac.pmo.pac0002.bp.rule;
|
|||
|
||||
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.mmpac.pmo.pac0002.bp.rule.util.SyncEpicMesUtil;
|
||||
import nc.impl.pubapp.pattern.rule.ICompareRule;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO;
|
||||
import nc.vo.mmpac.pmo.pac0002.util.HttpPmoEpicMesUtil;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -26,7 +26,7 @@ public class AfterUnApproveSyncEpicMesRule implements ICompareRule<PMOAggVO> {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
SyncEpicMesUtil mesUtil = new SyncEpicMesUtil();
|
||||
HttpPmoEpicMesUtil mesUtil = new HttpPmoEpicMesUtil();
|
||||
mesUtil.processData(pmoAggVOS, "N");
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -46,13 +46,73 @@ public class HttpPmoEpicMesUtil {
|
|||
|
||||
private static final BaseDAO dao = new BaseDAO();
|
||||
|
||||
public void processData(PMOAggVO[] pmoAggVOS, String flag) throws BusinessException {
|
||||
auditCode = flag;
|
||||
configParams = MyHelper.getConfigParams("Dldz-config", null);
|
||||
if (configParams.isEmpty()) {
|
||||
// throw new BusinessException("????????????MES??????????");
|
||||
logDl.error("????????????MES??????????");
|
||||
return;
|
||||
}
|
||||
deptParams = MyHelper.getConfigParams("Dldz-dept", null);
|
||||
if (deptParams.isEmpty()) {
|
||||
// throw new BusinessException("????????????MES???????????????????");
|
||||
logDl.error("????????????MES???????????????????");
|
||||
return;
|
||||
}
|
||||
String deptRange = String.join(",", deptParams.keySet());
|
||||
configParams.put("deptRange", deptRange);
|
||||
List<PMOAggVO> filteredOrders = checkAndFilterBillSrcOrg(pmoAggVOS);
|
||||
if (filteredOrders.isEmpty()) {
|
||||
logDl.error("??§Ù?????????????????????????????MES????");
|
||||
return;
|
||||
}
|
||||
logDl.info("????????????????????MES?????????????????????: " + filteredOrders.size());
|
||||
Set<String> billTypeCodes = Set.of(
|
||||
"55A2-Cxx-01", "55A2-Cxx-18"
|
||||
);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
// ?????????MES??
|
||||
for (PMOAggVO aggVO : filteredOrders) {
|
||||
PMOHeadVO head = aggVO.getParentVO();
|
||||
// ?§Ø????????,?????????????
|
||||
String vtrantypecode = head.getVtrantypecode();
|
||||
if (billTypeCodes.contains(vtrantypecode)) {
|
||||
continue;
|
||||
}
|
||||
PMOItemVO[] bodys = aggVO.getChildrenVO();
|
||||
if (bodys == null || bodys.length == 0) {
|
||||
logDl.error("???????? " + head.getVbillcode() + " ???????????????????");
|
||||
continue;
|
||||
}
|
||||
if ("N".equals(auditCode)) {
|
||||
JSONObject data = buildSyncData(aggVO);
|
||||
pushData(pmoUrl, data);
|
||||
} else {
|
||||
JSONObject data = buildSyncData(aggVO);
|
||||
pushData(pmoUrl, data);
|
||||
|
||||
JSONObject buildSyncData = buildSyncCodeData(aggVO);
|
||||
if (buildSyncData != null && !buildSyncData.isEmpty()) {
|
||||
jsonArray.add(buildSyncData);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!jsonArray.isEmpty()) {
|
||||
pushData(codeUrl, jsonArray);
|
||||
}
|
||||
|
||||
logDl.info("?????????????????MES????????¨À?");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用MES的生产工单接口推送ERP的流程生产订单和备料计划或推送出厂编号
|
||||
*
|
||||
* @param param 请求体
|
||||
* @throws BusinessException 如果发生非特定可忽略的错误
|
||||
*/
|
||||
public void pushData(String reqUrl, Object param) throws BusinessException {
|
||||
private void pushData(String reqUrl, Object param) throws BusinessException {
|
||||
String responseString = null;
|
||||
try {
|
||||
// 转json字符串的时候保留null值
|
||||
|
|
@ -105,7 +165,7 @@ public class HttpPmoEpicMesUtil {
|
|||
/**
|
||||
* 组装数据-流程生产订单+备料计划
|
||||
*/
|
||||
public JSONObject buildSyncData(PMOAggVO aggVO) throws BusinessException {
|
||||
private JSONObject buildSyncData(PMOAggVO aggVO) throws BusinessException {
|
||||
PMOHeadVO headVo = aggVO.getParentVO();
|
||||
// 目前电力电子只做一个表体的订单,故只处理的流程生产订单第一个子表行
|
||||
PMOItemVO pmoItem = aggVO.getChildrenVO()[0];
|
||||
|
|
@ -209,7 +269,7 @@ public class HttpPmoEpicMesUtil {
|
|||
* @return
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public JSONArray getPickmInfo(String sourceId) throws BusinessException {
|
||||
private JSONArray getPickmInfo(String sourceId) throws BusinessException {
|
||||
// vsourcemorowid 来源生产订单明细id
|
||||
JSONArray pickmArr = new JSONArray();
|
||||
if (StringUtils.isEmpty(sourceId) || "~".equals(sourceId)) {
|
||||
|
|
@ -242,7 +302,7 @@ public class HttpPmoEpicMesUtil {
|
|||
|
||||
}
|
||||
|
||||
public JSONObject buildSyncCodeData(PMOAggVO vo) throws BusinessException {
|
||||
private JSONObject buildSyncCodeData(PMOAggVO vo) throws BusinessException {
|
||||
// [
|
||||
// {
|
||||
// "siteCode": "", // 工厂编码
|
||||
|
|
|
|||
Loading…
Reference in New Issue