diff --git a/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoToQmsAction.java b/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoToQmsAction.java index 171e1ffd..068e149a 100644 --- a/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoToQmsAction.java +++ b/mmpac/src/client/nccloud/web/mmpac/pmo/action/PmoToQmsAction.java @@ -41,7 +41,7 @@ public class PmoToQmsAction implements ICommonAction { private static final String LOG_INFO_NAME = "qyMesLog"; private static final Log logger = Log.getInstance(LOG_INFO_NAME); - private static final String reqUrl = "/IF_QyErpApi.ashx?action=addsjd"; + private static final String reqUrl = "/IF_QyErpApi.ashx?action=addscjh"; private Map configParams; public BaseDAO dao; @@ -87,9 +87,10 @@ public class PmoToQmsAction implements ICommonAction { if (checkIfOrg(orgCode, configParams)) { continue; } + // 期初生产订单、半成品生产订单不推QMS,其余生产订单类型推QMS String billType = vo.getParentVO().getVtrantypecode(); if (checkBillType(billType, configParams)) { - continue; + throw new BusinessException("订单类型不符合条件"); } if (vo.getChildrenVO().length >= 0) { if (null != vo.getChildrenVO()[0].getAttributeValue("vdef32") && vo.getChildrenVO()[0].getAttributeValue("vdef32").equals("Y")) { @@ -216,16 +217,16 @@ public class PmoToQmsAction implements ICommonAction { return true; } private boolean checkBillType(String code, Map configParams) throws BusinessException { - String targetCode = configParams.get("xbBillType"); + String targetCode = configParams.get("pmoBillType"); if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) { throw new BusinessException("未配置单据类型参数"); } String[] types = targetCode.split(","); for (String type : types) { if (!type.isEmpty() && type.equals(code)) { - return false; + return true; } } - return true; + return false; } } diff --git a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncQMSRule.java b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncQMSRule.java index 8335e0f6..264908cc 100644 --- a/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncQMSRule.java +++ b/mmpac/src/private/nc/bs/mmpac/pmo/pac0002/bp/rule/AfterApproveSyncQMSRule.java @@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import nc.bs.dao.BaseDAO; +import nc.bs.dao.DAOException; import nc.bs.logging.Log; import nc.bs.uapbd.util.MyHelper; import nc.bs.uapbd.util.ThirdPartyPostRequestUtil; @@ -62,6 +63,11 @@ public class AfterApproveSyncQMSRule implements IRule { if (checkIfOrg(orgCode, configParams)) { continue; } + // 期初生产订单、半成品生产订单不推QMS,其余生产订单类型推QMS + String billType = vo.getParentVO().getVtrantypecode(); + if (checkBillType(billType, configParams)) { + continue; + } // 组装数据 JSONObject singleObj = new JSONObject(); PMOHeadVO pmoHeadVO = vo.getParentVO(); @@ -109,8 +115,15 @@ public class AfterApproveSyncQMSRule implements IRule { } singleObj.put("Content", contentArray); pushData(singleObj); + updatePmo(vo.getParentVO().getCpmohid()); } } + private void updatePmo(String cpmohid) throws DAOException { + BaseDAO dao = new BaseDAO(); + String sql = "update mm_mo set vdef32='Y' where cpmohid='" + + cpmohid + "'"; + dao.executeUpdate(sql); + } /** * 推送同步数据 @@ -151,5 +164,17 @@ public class AfterApproveSyncQMSRule implements IRule { return true; } - + private boolean checkBillType(String code, Map configParams) throws BusinessException { + String targetCode = configParams.get("pmoBillType"); + if (targetCode == null || nc.vo.am.common.util.StringUtils.isEmpty(targetCode)) { + throw new BusinessException("未配置单据类型参数"); + } + String[] types = targetCode.split(","); + for (String type : types) { + if (!type.isEmpty() && type.equals(code)) { + return true; + } + } + return false; + } }