diff --git a/ic/src/private/nc/bs/ic/m4a/sign/SignBP.java b/ic/src/private/nc/bs/ic/m4a/sign/SignBP.java index 78b9bf8..0a6d304 100644 --- a/ic/src/private/nc/bs/ic/m4a/sign/SignBP.java +++ b/ic/src/private/nc/bs/ic/m4a/sign/SignBP.java @@ -1,4 +1,3 @@ - package nc.bs.ic.m4a.sign; @@ -8,8 +7,9 @@ import nc.bs.ic.general.sign.ISignBP; import nc.bs.ic.general.sign.ISignRuleProvider; import nc.bs.ic.general.sign.SignBPTemplate; import nc.bs.ic.m4a.base.BPPlugInPoint; +import nc.bs.ic.m4a.sign.rule.AfterSignRuleForFinanceProcess; import nc.bs.ic.m4a.sign.rule.AfterSignRuleForLiabilityProcess; -import nc.bs.ic.m4a.sign.rule.AfterSignRuleSyncMesProcess; +import nc.bs.ic.m4a.sign.rule.AfterSignRuleSyncInToMesProcess; import nc.bs.scmpub.rule.VOSagaFrozenValidateRule; import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; import nc.vo.ic.m4a.entity.GeneralInVO; @@ -18,9 +18,9 @@ public class SignBP implements ISignBP, ISignRuleProvider processor) { processor.addAfterRule(new UpdateSCOnhandRule(false, true)); - processor.addAfterRule(new AfterSignRuleSyncMesProcess()); + processor.addAfterRule(new AfterSignRuleForFinanceProcess()); processor.addAfterRule(new AfterSignRuleForLiabilityProcess()); - processor.addBeforeRule(new AfterSignRuleSyncMesProcess()); + processor.addBeforeRule(new AfterSignRuleSyncInToMesProcess()); } public void addBeforeRule(GeneralInVO[] vos, AroundProcesser processor) { diff --git a/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncInToMesProcess.java b/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncInToMesProcess.java new file mode 100644 index 0000000..1ab715f --- /dev/null +++ b/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncInToMesProcess.java @@ -0,0 +1,208 @@ +package nc.bs.ic.m4a.sign.rule; + + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import nc.bs.framework.common.NCLocator; +import nc.bs.logging.Log; +import nc.impl.pubapp.pattern.rule.IRule; +import nc.itf.uif.pub.IUifService; +import nc.vo.bd.material.MaterialVersionVO; +import nc.vo.bd.stordoc.StordocVO; +import nc.vo.ic.m4a.entity.GeneralInBodyVO; +import nc.vo.ic.m4a.entity.GeneralInHeadVO; +import nc.vo.ic.m4a.entity.GeneralInVO; +import nc.vo.pub.BusinessException; +import nc.vo.pubapp.pattern.exception.ExceptionUtils; +import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; + +import java.util.Objects; + +public class AfterSignRuleSyncInToMesProcess implements IRule { + + public static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); + + private static final String LOG_INFO_NAME = "OALOG"; + + private static final Log obmlog = Log.getInstance(LOG_INFO_NAME); + + private static final IUifService IUIFSERVICE = NCLocator.getInstance().lookup(IUifService.class); + + + public void process(GeneralInVO[] vos) { + if (vos != null && vos.length != 0) { + try { + for (GeneralInVO vo : vos) { + syncOtherSystem(vo); + } + } catch (BusinessException ex) { + ExceptionUtils.wrappException(ex); + } + } + } + + private void syncOtherIn(GeneralInVO generalInVO) throws BusinessException { + GeneralInHeadVO head = generalInVO.getHead(); + obmlog.debug("开始处理其它入库单(4A-01): " + head.getVbillcode()); + // 表体body信息拼接 + JSONArray details = new JSONArray(); + // 填充details + for (GeneralInBodyVO body : generalInVO.getBodys()) { + JSONObject temp = new JSONObject(); + temp.put("orderNo", head.getVbillcode()); // 通知单ID + temp.put("sequenceNum", body.getCrowno()); // 通知单序号 + temp.put("type", "QTRK"); // 事务类型 + + MaterialVersionVO materialVersionVO = (MaterialVersionVO) IUIFSERVICE.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialvid()); + if (Objects.isNull(materialVersionVO)) { + throw new BusinessException("物料信息不存在, 主键:" + body.getCmaterialvid()); + } + temp.put("materialId", materialVersionVO.getCode()); // 物料ID + temp.put("recQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); // 应收数量 + temp.put("actQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); // 实收数量 + temp.put("assistActQry", body.getNassistnum() != null ? body.getNassistnum().doubleValue() : 0); // 辅助实收数量 + temp.put("productNum", null); // 产品编号 + temp.put("storageId", body.getClocationid()); // 库位 + temp.put("batchNum", body.getVbatchcode()); // 物料批号 + temp.put("customId", null); // 客户ID + temp.put("supplierId", null); // 供应商ID + temp.put("manufactureDate", null); // 生产日期 + temp.put("color", null); // 颜色 + temp.put("packLen", null); // 包装长度 + temp.put("packSize", null); // 包装尺寸 + temp.put("remark", body.getVnotebody()); // 备注 (行) + details.add(temp); + } + + JSONObject info = new JSONObject(); + info.put("details", details); // 明细 + // 从head中取数 + info.put("orderNo", head.getVbillcode()); // 通知单ID + info.put("type", "QTRK"); // 事务类型 + info.put("actureDate", head.getDmakedate() != null ? head.getDmakedate().toString() : null); // 实际日期 + + info.put("department", null); // 部门 + info.put("customId", null); // 客户 + info.put("supplierId", null); // 供应商 + + + StordocVO warehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCwarehouseid()); + if (Objects.isNull(warehouse)) { + throw new BusinessException("仓库信息不存在, 主键:" + head.getCwarehouseid()); + } + if (warehouse.getCode() != null && warehouse.getCode().length() > 4) { + throw new BusinessException("MES系统仓库编码[" + warehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("storeId", warehouse.getCode()); // 仓库ID + + info.put("workerNo", null); // 工人编号 + info.put("worker", null); // 工人 + info.put("storeKeeper", head.getCwhsmanagerid()); // 库管员 + info.put("returned", "N"); // 是否退库 + info.put("mark", "N"); // 生成标志 + info.put("remark", head.getVnote()); // 备注 (头) + + // 拼接数据,先创建一个jsonObject + JSONObject requestData = new JSONObject(); + requestData.put("operation_type", "I"); // 操作 + requestData.put("info", info); + obmlog.debug("其它入库(4A-01) requestData:" + requestData.toJSONString()); + + HTTP_POST_OTHER_SYS.sendToExternalSystem("/GTHINKING/AjaxService/N_KCSJJS/101527002.ashx/gt_rec_api_qtrkdj", requestData); + obmlog.debug("其它入库单(4A-01) " + head.getVbillcode() + " 同步成功"); + } + + private void syncOtherSystem(GeneralInVO generalInVO) throws BusinessException { + GeneralInHeadVO head = generalInVO.getHead(); + obmlog.debug("触发同步其它入库单(M4A), 单据号:" + head.getVbillcode() + ", 出库类型编码:" + head.getVtrantypecode() + "开始拼接数据"); + +// if (!generalOutVO.getHead().getPk_org().equals("0001A110000000000677")) { +// obmlog.debug("仅同步山东泰开电缆有限公司,当前组织:" + generalOutVO.getHead().getPk_org()); +// return; // 仅操作山东泰开电缆有限公司 +// } + + // 调拨入库 + if ("4A-02".equals(head.getVtrantypecode())) { + syncTransferIn(generalInVO); + } + // 其它入库 + else if ("4A-01".equals(head.getVtrantypecode())) { + syncOtherIn(generalInVO); + } + } + + private void syncTransferIn(GeneralInVO generalInVO) throws BusinessException { + GeneralInHeadVO head = generalInVO.getHead(); + // 表体body信息拼接 + JSONArray details = new JSONArray(); + // 填充details + for (GeneralInBodyVO body : generalInVO.getBodys()) { + JSONObject temp = new JSONObject(); + temp.put("orderNo", head.getVbillcode()); // 通知单ID + temp.put("sequenceNum", body.getCrowno()); // 通知单序号 + temp.put("type", "DBRK"); // 事务类型 + MaterialVersionVO materialVersionVO = (MaterialVersionVO) IUIFSERVICE.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialvid()); + if (Objects.isNull(materialVersionVO)) { + throw new BusinessException("物料信息不存在, 主键:" + body.getCmaterialvid()); + } + temp.put("materialId", materialVersionVO.getCode()); // 物料ID + temp.put("outQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); // 应发数量 + temp.put("actInQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); // 实收数量 + temp.put("assistActInQry", body.getNassistnum() != null ? body.getNassistnum().doubleValue() : 0); // 辅助实收数量 + temp.put("productNum", null); // 产品编号 + temp.put("inStorageId", body.getClocationid()); // 库位 + temp.put("inBatchNum", body.getVbatchcode()); // 物料批号 + temp.put("customId", null); // 客户ID + temp.put("supplierId", null); // 供应商ID + temp.put("manufactureDate", null); // 生产日期 + temp.put("color", null); // 颜色 + temp.put("packLen", null); // 包装长度 + temp.put("packSize", null); // 包装尺寸 + temp.put("remark", body.getVnotebody()); // 备注 (行) + details.add(temp); + } + + JSONObject info = new JSONObject(); + info.put("details", details); // 明细 + // 从head中取数 + info.put("orderNo", head.getVbillcode()); // 通知单ID + info.put("type", "DBRK"); // 事务类型 + info.put("outDate", head.getDbilldate() != null ? head.getDbilldate().toString() : null); // 出库日期 + + StordocVO outWarehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCwarehouseid()); + if (Objects.isNull(outWarehouse)) { + throw new BusinessException("拨出仓库信息不存在, 主键:" + head.getCwarehouseid()); + } + if (outWarehouse.getCode() != null && outWarehouse.getCode().length() > 4) { + throw new BusinessException("MES系统拨出仓库编码[" + outWarehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("outStoreId", outWarehouse.getCode()); // 仓库ID + + StordocVO inWarehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCotherwhid()); + if (Objects.isNull(inWarehouse)) { + throw new BusinessException("拨入仓库信息不存在, 主键:" + head.getCotherwhid()); + } + if (inWarehouse.getCode() != null && inWarehouse.getCode().length() > 4) { + throw new BusinessException("MES系统拨入仓库编码[" + inWarehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("inStoreId", inWarehouse.getCode()); // 仓库ID + + info.put("workerNo", null); + info.put("worker", null); + info.put("storeKeeper", head.getCwhsmanagerid()); + info.put("returned", "N"); // 是否退库 + info.put("mark", "N"); // 生成标志 + info.put("remark", head.getVnote()); // 备注 (头) + + + // 拼接数据,先创建一个jsonObject + JSONObject requestData = new JSONObject(); + requestData.put("operation_type", "I"); // 操作 + requestData.put("info", info); + obmlog.debug("调拨入库requestData:" + requestData.toJSONString()); + + HTTP_POST_OTHER_SYS.sendToExternalSystem("/GTHINKING/AjaxService/N_KCSJJS/101527013.ashx/gt_rec_api_dbrkdj", requestData); + obmlog.debug("调拨入库单 " + head.getVbillcode() + " 同步成功"); + } + +} diff --git a/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncMesProcess.java b/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncMesProcess.java deleted file mode 100644 index 90417a7..0000000 --- a/ic/src/private/nc/bs/ic/m4a/sign/rule/AfterSignRuleSyncMesProcess.java +++ /dev/null @@ -1,182 +0,0 @@ -package nc.bs.ic.m4a.sign.rule; - - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import nc.bs.framework.common.NCLocator; -import nc.bs.logging.Log; -import nc.impl.pubapp.pattern.rule.IRule; -import nc.itf.uif.pub.IUifService; -import nc.vo.bd.material.MaterialVersionVO; -import nc.vo.bd.stordoc.StordocVO; -import nc.vo.ic.m4a.entity.GeneralInBodyVO; -import nc.vo.ic.m4a.entity.GeneralInHeadVO; -import nc.vo.ic.m4a.entity.GeneralInVO; -import nc.vo.pub.BusinessException; -import nc.vo.pubapp.pattern.exception.ExceptionUtils; -import nccloud.pubift.commen.impl.utils.HttpPostOtherSysImpl; -import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; - -import java.util.Objects; - -public class AfterSignRuleSyncMesProcess implements IRule { - - public static final IHttpPostOtherSys LOOKUP = new HttpPostOtherSysImpl(); - - private static final String LOG_INFO_NAME = "OALOG"; - - private static final Log obmlog = Log.getInstance(LOG_INFO_NAME); - - private static final IUifService IUIFSERVICE = NCLocator.getInstance().lookup(IUifService.class); - - public void process(GeneralInVO[] vos) { - if (vos != null && vos.length != 0) { - try { - for (GeneralInVO vo : vos) { - syncOtherSystem(vo); - } - } catch (BusinessException ex) { - ExceptionUtils.wrappException(ex); - } - } - } - - private void syncOtherSystem(GeneralInVO generalInVO) throws BusinessException { - GeneralInHeadVO head = generalInVO.getHead(); - obmlog.debug("触发同步其它入库单(M4A), 单据号:" + head.getVbillcode() + ", 出库类型编码:" + head.getVtrantypecode() + "开始拼接数据"); - - // 调拨入库 - if ("4A-02".equals(head.getVtrantypecode())) { - // 表体body信息拼接 - JSONArray details = new JSONArray(); - // 填充details - for (GeneralInBodyVO body : generalInVO.getBodys()) { - JSONObject temp = new JSONObject(); - temp.put("orderNo", head.getVbillcode()); - temp.put("sequenceNum", body.getCrowno()); - temp.put("type", "DBCK"); - MaterialVersionVO materialVersionVO = (MaterialVersionVO) IUIFSERVICE.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialvid()); - if (Objects.isNull(materialVersionVO)) { - throw new BusinessException("物料信息不存在, 主键:" + body.getCmaterialvid()); - } - temp.put("materialId", materialVersionVO.getCode()); - temp.put("outQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); - temp.put("actOutQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); - temp.put("assistActOutQry", ""); // Per example for similar field - temp.put("productNum", null); - temp.put("outStorageId", body.getClocationid()); // 拨入库位 (destination location) - temp.put("outBatchNum", body.getVbatchcode()); // 批号 (received batch) - temp.put("customId", null); - temp.put("supplierId", null); - temp.put("manufactureDate", null); - temp.put("color", null); - temp.put("packLen", null); - temp.put("packSize", null); - temp.put("remark", body.getVnotebody()); - details.add(temp); - } - - JSONObject info = new JSONObject(); - info.put("details", details); - // 从head中取数 - info.put("orderNo", head.getVbillcode()); - info.put("type", "DBCK"); - info.put("genType", null); - info.put("outDate", head.getDbilldate() != null ? head.getDbilldate().toString() : null); - - StordocVO outWarehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCwarehouseid()); - if (Objects.isNull(outWarehouse)) { - throw new BusinessException("拨出仓库信息不存在, 主键:" + head.getCwarehouseid()); - } - info.put("outStoreId", outWarehouse.getCode()); - - StordocVO inWarehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCotherwhid()); - if (Objects.isNull(inWarehouse)) { - throw new BusinessException("拨入仓库信息不存在, 主键:" + head.getCotherwhid()); - } - info.put("inStoreId", inWarehouse.getCode()); - - info.put("workerNo", null); - info.put("worker", null); - info.put("storeKeeper", head.getCwhsmanagerid()); - info.put("returned", "N"); - info.put("mark", "N"); - info.put("remark", head.getVnote()); - info.put("oldOrderNo", null); - - // 拼接数据,先创建一个jsonObject - JSONObject requestData = new JSONObject(); - requestData.put("operation_type", "I"); // 固定给I 操作 - requestData.put("info", info); - obmlog.debug("调拨入库requestData:" + requestData.toJSONString()); - - IHttpPostOtherSys httpService = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); - httpService.sendToExternalSystem("test", requestData); - obmlog.debug("调拨入库单 " + head.getVbillcode() + " 同步成功"); - } - // 其它入库 - else if ("4A-01".equals(head.getVtrantypecode())) { - obmlog.debug("开始处理其它入库单(4A-01): " + head.getVbillcode()); - // 表体body信息拼接 - JSONArray details = new JSONArray(); - // 填充details - for (GeneralInBodyVO body : generalInVO.getBodys()) { - JSONObject temp = new JSONObject(); - temp.put("orderNo", head.getVbillcode()); - temp.put("sequenceNum", body.getCrowno()); - temp.put("type", "QTRK"); - - MaterialVersionVO materialVersionVO = (MaterialVersionVO) IUIFSERVICE.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialvid()); - if (Objects.isNull(materialVersionVO)) { - throw new BusinessException("物料信息不存在, 主键:" + body.getCmaterialvid()); - } - temp.put("materialId", materialVersionVO.getCode()); - temp.put("recQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); - temp.put("actQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); - temp.put("assistActQry", ""); - temp.put("productNum", null); - temp.put("storageId", body.getClocationid()); - temp.put("batchNum", body.getVbatchcode()); - temp.put("customId", null); - temp.put("supplierId", null); - temp.put("manufactureDate", null); - temp.put("color", null); - temp.put("packLen", null); - temp.put("packSize", null); - temp.put("remark", body.getVnotebody()); - details.add(temp); - } - - JSONObject info = new JSONObject(); - info.put("details", details); - // 从head中取数 - info.put("orderNo", head.getVbillcode()); - info.put("type", "QTRK"); - info.put("actureDate", head.getDmakedate() != null ? head.getDmakedate().toString() : null); - - StordocVO warehouse = (StordocVO) IUIFSERVICE.queryByPrimaryKey(StordocVO.class, head.getCwarehouseid()); - if (Objects.isNull(warehouse)) { - throw new BusinessException("仓库信息不存在, 主键:" + head.getCwarehouseid()); - } - info.put("storeId", warehouse.getCode()); - - info.put("workerNo", null); - info.put("worker", null); - info.put("storeKeeper", head.getCwhsmanagerid()); - info.put("returned", "N"); - info.put("mark", "N"); - info.put("remark", head.getVnote()); - - // 拼接数据,先创建一个jsonObject - JSONObject requestData = new JSONObject(); - requestData.put("operation_type", "I"); // 固定给I 操作 - requestData.put("info", info); - obmlog.debug("其它入库(4A-01) requestData:" + requestData.toJSONString()); - - IHttpPostOtherSys httpService = LOOKUP; - httpService.sendToExternalSystem("test", requestData); - obmlog.debug("其它入库单(4A-01) " + head.getVbillcode() + " 同步成功"); - } - } - -} diff --git a/ic/src/private/nc/bs/ic/m4i/sign/SignBP.java b/ic/src/private/nc/bs/ic/m4i/sign/SignBP.java index 1c9ef8a..030c09f 100644 --- a/ic/src/private/nc/bs/ic/m4i/sign/SignBP.java +++ b/ic/src/private/nc/bs/ic/m4i/sign/SignBP.java @@ -1,3 +1,4 @@ + package nc.bs.ic.m4i.sign; @@ -10,7 +11,7 @@ import nc.bs.ic.m4i.base.BPPlugInPoint; import nc.bs.ic.m4i.sign.rule.AfterSignRuleForFinanceProcess; import nc.bs.ic.m4i.sign.rule.AfterSignRuleForLiabilityProcess; import nc.bs.ic.m4i.sign.rule.AfterSignRuleForMatterApp; -import nc.bs.ic.m4i.sign.rule.AfterSignRuleSyncMesProcess; +import nc.bs.ic.m4i.sign.rule.AfterSignRuleSyncOutToMesProcess; import nc.bs.scmpub.rule.VOSagaFrozenValidateRule; import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; import nc.vo.ic.m4i.entity.GeneralOutVO; @@ -22,7 +23,7 @@ public class SignBP implements ISignBP, ISignRuleProvider processor) { diff --git a/ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncMesProcess.java b/ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncOutToMesProcess.java similarity index 61% rename from ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncMesProcess.java rename to ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncOutToMesProcess.java index a21bda9..b50be1d 100644 --- a/ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncMesProcess.java +++ b/ic/src/private/nc/bs/ic/m4i/sign/rule/AfterSignRuleSyncOutToMesProcess.java @@ -18,14 +18,16 @@ import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys; import java.util.Objects; -public class AfterSignRuleSyncMesProcess implements IRule { +public class AfterSignRuleSyncOutToMesProcess implements IRule { - private static String logginfo = "OALOG"; + public static final IHttpPostOtherSys HTTP_POST_OTHER_SYS = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); - private static Log obmlog = Log.getInstance(logginfo); + private static final String logginfo = "OALOG"; - private IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class); + private static final Log obmlog = Log.getInstance(logginfo); + + private final IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class); public void process(GeneralOutVO[] vos) { if (vos != null && vos.length != 0) { @@ -44,10 +46,10 @@ public class AfterSignRuleSyncMesProcess implements IRule { private void syncOtherSystem(GeneralOutVO generalOutVO) throws BusinessException { obmlog.debug("触发同步其它出库单,出库类型编码:" + generalOutVO.getHead().getVtrantypecode() + "开始拼接数据"); - if (!generalOutVO.getHead().getPk_org().equals("0001A110000000000677")) { - obmlog.debug("仅同步山东泰开电缆有限公司,当前组织:" + generalOutVO.getHead().getPk_org()); - return; // 仅操作山东泰开电缆有限公司 - } +// if (!generalOutVO.getHead().getPk_org().equals("0001A110000000000677")) { +// obmlog.debug("仅同步山东泰开电缆有限公司,当前组织:" + generalOutVO.getHead().getPk_org()); +// return; // 仅操作山东泰开电缆有限公司 +// } // 其它出库 if (generalOutVO.getHead().getVtrantypecode().equals("4I-01")) { @@ -57,20 +59,20 @@ public class AfterSignRuleSyncMesProcess implements IRule { // 填充details for (GeneralOutBodyVO body : generalOutVO.getBodys()) {// body中取数 JSONObject temp = new JSONObject(); - temp.put("orderNo", head.getVbillcode()); - temp.put("sequenceNum", body.getCrowno()); - temp.put("type", "QTCK"); + temp.put("orderNo", head.getVbillcode()); // 通知单ID + temp.put("sequenceNum", body.getCrowno()); // 通知单序号 + temp.put("type", "QTCK"); // 事务类型 MaterialVersionVO materialVersionVO = (MaterialVersionVO) iUifService.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialoid()); if (Objects.isNull(materialVersionVO)) { throw new BusinessException("搜索物料信息不存在"); } - temp.put("materialId", materialVersionVO.getCode()); - temp.put("issuedQty", body.getNshouldnum().doubleValue()); - temp.put("actQty", body.getNnum().doubleValue()); - temp.put("assistActQry", ""); + temp.put("materialId", materialVersionVO.getCode()); // 物料ID + temp.put("issuedQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); // 应发数量 + temp.put("actQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); // 实发数量 + temp.put("assistActQry", body.getNassistnum() != null ? body.getNassistnum().doubleValue() : ""); // 辅助实发数量 temp.put("productNum", null); - temp.put("storageId", body.getClocationid()); - temp.put("batchNum", body.getVbatchcode()); + temp.put("storageId", body.getClocationid()); // 库位 + temp.put("batchNum", body.getVbatchcode()); // 物料批号 temp.put("customId", null); temp.put("supplierId", null); temp.put("manufactureDate", null); @@ -80,24 +82,27 @@ public class AfterSignRuleSyncMesProcess implements IRule { JSONObject info = new JSONObject(); info.put("details", details); // 从head中取数 - info.put("orderNo", head.getVbillcode()); - info.put("type", "QTCK"); - info.put("actureDate", head.getDmakedate().toString()); + info.put("orderNo", head.getVbillcode()); // 通知单ID + info.put("type", "QTCK"); // 事务类型 + info.put("actureDate", head.getDmakedate().toString()); // 实际日期 StordocVO warehouse = (StordocVO) iUifService.queryByPrimaryKey(StordocVO.class, head.getCwarehouseid()); if (Objects.isNull(warehouse)) { throw new BusinessException("仓库信息不存在,主键:" + head.getCwarehouseid()); } - info.put("storeId", warehouse.getCode()); + if (warehouse.getCode() != null && warehouse.getCode().length() > 4) { + throw new BusinessException("MES系统仓库编码[" + warehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("storeId", warehouse.getCode()); // 仓库ID info.put("workerNo", null); info.put("worker", null); info.put("storeKeeper", head.getCwhsmanagerid()); - info.put("returned", "N"); - info.put("mark", "N"); + info.put("returned", "N"); // 是否退库 + info.put("mark", "N"); // 生成标志 info.put("remark", head.getVnote()); // 拼接数据,先创建一个jsonObject JSONObject requestData = new JSONObject(); - requestData.put("operation_type", "I");// 固定给I 操作 + requestData.put("operation_type", "I");// 操作 requestData.put("info", info); obmlog.debug("其它出库requestData:" + requestData.toJSONString()); IHttpPostOtherSys httpService = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); @@ -111,22 +116,22 @@ public class AfterSignRuleSyncMesProcess implements IRule { // 填充details for (GeneralOutBodyVO body : generalOutVO.getBodys()) {// body中取数 JSONObject temp = new JSONObject(); - temp.put("orderNo", head.getVbillcode()); - temp.put("sequenceNum", body.getCrowno()); - temp.put("type", "DBCK"); + temp.put("orderNo", head.getVbillcode()); // 通知单ID + temp.put("sequenceNum", body.getCrowno()); // 通知单序号 + temp.put("type", "DBCK"); // 事务类型 temp.put("genType", null); MaterialVersionVO materialVersionVO = (MaterialVersionVO) iUifService.queryByPrimaryKey(MaterialVersionVO.class, body.getCmaterialoid()); if (Objects.isNull(materialVersionVO)) { throw new BusinessException("搜索物料信息不存在"); } - temp.put("materialId", materialVersionVO.getCode()); - temp.put("issuedQty", body.getNshouldnum().doubleValue()); - temp.put("actQty", body.getNnum().doubleValue()); - temp.put("outQty", body.getNnum().doubleValue()); - temp.put("assistActQry", ""); + temp.put("materialId", materialVersionVO.getCode()); // 物料ID + temp.put("issuedQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); // 应发数量 + temp.put("actOutQty", body.getNshouldnum() != null ? body.getNshouldnum().doubleValue() : null); // 实发数量 + temp.put("outQty", body.getNnum() != null ? body.getNnum().doubleValue() : null); + temp.put("assistActOutQry", body.getNassistnum() != null ? body.getNassistnum().doubleValue() : 0); // 辅助实发数量 temp.put("productNum", null); - temp.put("outStorageId", body.getClocationid()); - temp.put("outBatchNum", body.getVbatchcode()); + temp.put("outStorageId", body.getClocationid()); // 库位 + temp.put("outBatchNum", body.getVbatchcode()); // 物料批号 temp.put("customId", null); temp.put("supplierId", null); temp.put("manufactureDate", null); @@ -139,8 +144,8 @@ public class AfterSignRuleSyncMesProcess implements IRule { JSONObject info = new JSONObject(); info.put("details", details); // 从head中取数 - info.put("orderNo", head.getVbillcode()); - info.put("type", "DBCK"); + info.put("orderNo", head.getVbillcode()); // 通知单ID + info.put("type", "DBCK"); // 事务类型 info.put("genType", null); info.put("outDate", head.getDbilldate().toString()); @@ -148,28 +153,33 @@ public class AfterSignRuleSyncMesProcess implements IRule { if (Objects.isNull(outWarehouse)) { throw new BusinessException("出库仓库信息不存在,主键:" + head.getCwarehouseid()); } - info.put("outStoreId", outWarehouse.getCode()); + if (outWarehouse.getCode() != null && outWarehouse.getCode().length() > 4) { + throw new BusinessException("MES系统出库仓库编码[" + outWarehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("outStoreId", outWarehouse.getCode()); // 仓库ID StordocVO inWarehouse = (StordocVO) iUifService.queryByPrimaryKey(StordocVO.class, head.getCotherwhid()); if (Objects.isNull(inWarehouse)) { throw new BusinessException("入库仓库信息不存在,主键:" + head.getCotherwhid()); } - info.put("inStoreId", inWarehouse.getCode()); + if (inWarehouse.getCode() != null && inWarehouse.getCode().length() > 4) { + throw new BusinessException("MES系统入库仓库编码[" + inWarehouse.getCode() + "]不能超过4位,请选择合适的仓库!"); + } + info.put("inStoreId", inWarehouse.getCode()); // 仓库ID info.put("workerNo", null); info.put("worker", null); info.put("storeKeeper", head.getCwhsmanagerid()); - info.put("returned", "N"); - info.put("mark", "N"); + info.put("returned", "N"); // 是否退库 + info.put("mark", "N"); // 生成标志 info.put("remark", head.getVnote()); // 拼接数据,先创建一个jsonObject JSONObject requestData = new JSONObject(); - requestData.put("operation_type", "I");// 固定给I 操作 + requestData.put("operation_type", "I");// 操作 requestData.put("info", info); obmlog.debug("其它出库requestData:" + requestData.toJSONString()); - IHttpPostOtherSys httpService = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); - httpService.sendToExternalSystem("/GTHINKING/AjaxService/N_KCSJJS/101527009.ashx/gt_rec_api_dbckdj", requestData); + HTTP_POST_OTHER_SYS.sendToExternalSystem("/GTHINKING/AjaxService/N_KCSJJS/101527009.ashx/gt_rec_api_dbckdj", requestData); } } diff --git a/so/src/private/nc/pubimpl/so/sobalance/arap/listener/GatheringAddAfterListenerAction.java b/so/src/private/nc/pubimpl/so/sobalance/arap/listener/GatheringAddAfterListenerAction.java index 34986bc..d081566 100644 --- a/so/src/private/nc/pubimpl/so/sobalance/arap/listener/GatheringAddAfterListenerAction.java +++ b/so/src/private/nc/pubimpl/so/sobalance/arap/listener/GatheringAddAfterListenerAction.java @@ -128,15 +128,11 @@ public class GatheringAddAfterListenerAction { for(IDataFromF2ForM30 data : datas) { if (!ccustomerid.equals(data.getPayBillOrderCust())) { - if(!data.getFirstBillType().equals("30") ){ - throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0193", (String)null, new String[]{head.getVbillcode()})); - } + throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0193", (String)null, new String[]{head.getVbillcode()})); } if (!cinvoicecustid.equals(data.getPayBillCustomer())) { - if(!data.getFirstBillType().equals("30") ){ throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0194", (String)null, new String[]{head.getVbillcode()})); - } } if (!corigcurrencyid.equals(data.getPayBillCurID())) { @@ -148,9 +144,7 @@ public class GatheringAddAfterListenerAction { } if (MathTool.isDiffSign(ntotalorigmny, data.getPayBillmny())) { - if(!data.getFirstBillType().equals("30") ) {; - throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0412")); - } + throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4006011_0", "04006011-0412")); } } @@ -297,9 +291,9 @@ public class GatheringAddAfterListenerAction { for(Map.Entry> entry : dataMap.entrySet()) { if (csaleorderidSet.contains(entry.getKey())) { - this.updateDataMap.put((String)entry.getKey(), (Collection)entry.getValue()); + this.updateDataMap.put(entry.getKey(), entry.getValue()); } else { - this.insertDataMap.put((String)entry.getKey(), (Collection)entry.getValue()); + this.insertDataMap.put(entry.getKey(), entry.getValue()); } } diff --git a/so/src/public/nccloud/api/so/so/UpCloses/ClosesoUpdateBL.java b/so/src/public/nccloud/api/so/so/UpCloses/ClosesoUpdateBL.java index 28d7c0b..0f24c7c 100644 --- a/so/src/public/nccloud/api/so/so/UpCloses/ClosesoUpdateBL.java +++ b/so/src/public/nccloud/api/so/so/UpCloses/ClosesoUpdateBL.java @@ -121,26 +121,33 @@ public JSONString ClosesoUpdateBL(JSONString json) { // for (Map row : operationresult) { // operationId = (String) row.get("bd.pk_defdoc"); // } - operationId = (String) valList.get("ID"); + operationId = (String) valList.get("id"); + if (operationId == null) { + errojson.put("status", "0"); + errojson.put("message", "操作类型不存在"); + errojson.put("codeList", null); + // 返回表示操作成功的JSON字符串 + return ResultMessageUtil.toJSON(errojson); + } for (int i = 0; i < array.size(); i++) { Map item = (Map) array.get(i); String vctcode = (String) item.getOrDefault("vctcode", ""); -// updateSql = " UPDATE so_saleorder h" + -// " SET h.vdef1 = '" + operationId + "' , h.vdef19 = '"+json.toJSONString() +"' '"+ -// " WHERE EXISTS (" + -// " SELECT 1" + -// " FROM so_saleorder_b b" + -// " left join bd_defdoc hbd on hbd.pk_defdoc=b.vbdef1 "+ -// " WHERE b.csaleorderid = h.csaleorderid" + -// " AND hbd.code = '" + vctcode + "' " + -// " );"; + updateSql = " UPDATE so_saleorder h" + + " SET h.vdef1 = '" + operationId + "' "+ + " WHERE EXISTS (" + + " SELECT 1" + + " FROM so_saleorder_b b" + + " left join bd_defdoc hbd on hbd.pk_defdoc=b.vbdef1 "+ + " WHERE b.csaleorderid = h.csaleorderid" + + " AND hbd.code = '" + vctcode + "' " + + " );"; // updateSql = " UPDATE so_saleorder h" + // " SET h.vdef19 = '" + json.toJSONString() + "' " + // " WHERE h.vdef6 = '" + "ZKWEQ0400425" + "' " + " ;"; - updateSql = " UPDATE so_saleorder h" + - " SET h.vdef1 = '" + operationId + "' , h.vdef19 = '"+json.toJSONString() +"' '"+ - " WHERE h.vdef6 = '" + vctcode + "' " + " ;"; +// updateSql = " UPDATE so_saleorder h" + +// " SET h.vdef1 = '" + operationId + "' , h.vdef19 = '"+json.toJSONString() +"' '"+ +// " WHERE h.vdef6 = '" + result.get(0)[0]+ "' " + " ;"; // 验证operation字段是否存在 if (vctcode == null) { return ResultMessageUtil.exceptionToJSON(new NullPointerException("vctcode:null")); @@ -151,7 +158,7 @@ public JSONString ClosesoUpdateBL(JSONString json) { + "left join org_salesorg o on h.pk_org=o.pk_salesorg " +" left join bd_defdoc hbd on hbd.pk_defdoc=b.vbdef1 "+ - "where h.vdef6='" + vctcode + "' "; + "where hbd.code='" + vctcode + "' "; List result = (List) getQueryService().executeQuery(sql, new ArrayListProcessor()); if (result == null || result.size() == 0) { errojson.put("status", "0"); diff --git a/sscivm/src/client/nccloud/web/sscivm/ivsale/application/util/DataChangeLogic.java b/sscivm/src/client/nccloud/web/sscivm/ivsale/application/util/DataChangeLogic.java index cefc747..2531be0 100644 --- a/sscivm/src/client/nccloud/web/sscivm/ivsale/application/util/DataChangeLogic.java +++ b/sscivm/src/client/nccloud/web/sscivm/ivsale/application/util/DataChangeLogic.java @@ -126,10 +126,10 @@ public class DataChangeLogic { for (int i = 0; i < rows.length; ++i) { String materialPk = (String) rows[i].getCell("pk_materiel").getValue(); // gridPrecisionOperator.addNumPrecision("xmsl", i, (String)materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("caninvoice_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("invoiceing_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("invoiced_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addCurrencyPricePrecision("xmdj", i, orgLocalCurrPK); +// gridPrecisionOperator.addNumPrecision("caninvoice_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addNumPrecision("invoiceing_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addNumPrecision("invoiced_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addCurrencyPricePrecision("xmdj", i, orgLocalCurrPK); } gridPrecisionOperator.processPrecision(); @@ -188,10 +188,10 @@ public class DataChangeLogic { for (int i = 0; i < rows.length; ++i) { String materialPk = (String) rows[i].getCell("pk_materiel").getValue(); // gridPrecisionOperator.addNumPrecision("xmsl", i, (String)materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("caninvoice_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("invoiced_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addNumPrecision("invoiceing_xmsl", i, (String) materialMeasdocMap.get(materialPk)); - gridPrecisionOperator.addCurrencyPricePrecision("xmdj", i, orgLocalCurrPK); +// gridPrecisionOperator.addNumPrecision("caninvoice_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addNumPrecision("invoiced_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addNumPrecision("invoiceing_xmsl", i, (String) materialMeasdocMap.get(materialPk)); +// gridPrecisionOperator.addCurrencyPricePrecision("xmdj", i, orgLocalCurrPK); } gridPrecisionOperator.processPrecision(); diff --git a/sscivm/src/public/nc/bs/sscivm/ivsale/util/InvoiceTransferUtil.java b/sscivm/src/public/nc/bs/sscivm/ivsale/util/InvoiceTransferUtil.java index 7c8c00f..10b0c37 100644 --- a/sscivm/src/public/nc/bs/sscivm/ivsale/util/InvoiceTransferUtil.java +++ b/sscivm/src/public/nc/bs/sscivm/ivsale/util/InvoiceTransferUtil.java @@ -1360,7 +1360,7 @@ public class InvoiceTransferUtil { pinvoice.setZnj(headvo.getZnj() == null ? null : getUFDoubleToBigDecimal(headvo.getZnj()).setScale(2, UFDouble.ROUND_HALF_UP)); pinvoice.setJehj(headvo.getJehj() == null ? null : getUFDoubleToBigDecimal(headvo.getJehj()).setScale(2, UFDouble.ROUND_HALF_UP)); pinvoice.setCjh(headvo.getCjh()); - pinvoice.setKqysssxbgglbm(headvo.getKqysssxbgglbm()); +// pinvoice.setKqysssxbgglbm(headvo.getKqysssxbgglbm()); return pinvoice; } diff --git a/uapbd/src/private/nc/bs/uapbd/task/InvoiceTaskPlugin.java b/uapbd/src/private/nc/bs/uapbd/task/InvoiceTaskPlugin.java index 9f1b06b..ee6729d 100644 --- a/uapbd/src/private/nc/bs/uapbd/task/InvoiceTaskPlugin.java +++ b/uapbd/src/private/nc/bs/uapbd/task/InvoiceTaskPlugin.java @@ -31,7 +31,7 @@ public class InvoiceTaskPlugin implements IBackgroundWorkPlugin{ " left join sscivm_ivapplog on sscivm_ivapplog.fphm = sscivm_invoice.fphm " + " where " + " sscivm_invoice_relation.billtype = '32' " + - " and so_saleinvoice.vdef20 <> 'Y' " + + " and (so_saleinvoice.vdef20 <> 'Y' OR so_saleinvoice.vdef13 IS NULL OR so_saleinvoice.vdef13='~' ) " + " and sscivm_invoice.dr = 0 " + " and sscivm_ivapplog.kpzt = 2 "; // + " so_saleinvoice.vbillcode = 'SI2024070400000738' "; @@ -76,10 +76,10 @@ public class InvoiceTaskPlugin implements IBackgroundWorkPlugin{ // Logger.error("---sirSqlExecute------"+sirSql); //ERP销售发票回传,根据销售发票id,回写发票号和单据编号 // String sSaleSql = "UPDATE so_saleinvoice set vdef20 = 'Y' , vdef13 = '" + fphm + "', vbillcode = '" + fphm +"' where csaleinvoiceid = '" + csaleinvoiceid + "'"; - String sSaleSql = "UPDATE so_saleinvoice set vdef20 = 'Y' , vdef13 = '" + fphm + "' where csaleinvoiceid = '" + csaleinvoiceid + "'"; +// String sSaleSql = "UPDATE so_saleinvoice set vdef20 = 'Y' , vdef13 = '" + fphm + "' where csaleinvoiceid = '" + csaleinvoiceid + "'"; - dao.executeUpdate(sSaleSql); - Logger.error("---sSaleSqlExecute------"+sSaleSql); +// dao.executeUpdate(sSaleSql); +// Logger.error("---sSaleSqlExecute------"+sSaleSql); //根据销售发票id 回写下游应收单表头发票号 String recBillSql = "MERGE INTO ar_recbill a USING (select DISTINCT pk_recbill,top_billid,top_billtype from ar_recitem) b ON ( a.pk_recbill = b.pk_recbill AND b.top_billid = '" + csaleinvoiceid + "' AND b.top_billtype = '32' ) \n" + "WHEN MATCHED THEN\n" +