ic_其它出入库&调拨出入库字段调整

- 新增 AfterSignRuleSyncInToMesProcess 类用于处理入库单同步
- 新增 AfterSignRuleSyncOutToMesProcess 类用于处理出库单同步
- 删除旧的 AfterSignRuleSyncMesProcess 类
- 更新 SignBP 类中的规则引用
This commit is contained in:
maolei 2025-05-21 16:28:06 +08:00
parent 2fbed1fda4
commit 4d3a5daba2
5 changed files with 268 additions and 231 deletions

View File

@ -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<GeneralInVO>, ISignRuleProvider<GeneralIn
public void addAfterRule(GeneralInVO[] vos, AroundProcesser<GeneralInVO> 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<GeneralInVO> processor) {

View File

@ -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<GeneralInVO> {
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() + " 同步成功");
}
}

View File

@ -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<GeneralInVO> {
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() + " 同步成功");
}
}
}

View File

@ -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<GeneralOutVO>, ISignRuleProvider<GeneralO
processor.addAfterRule(new AfterSignRuleForFinanceProcess());
processor.addAfterRule(new AfterSignRuleForLiabilityProcess());
processor.addAfterRule(new AfterSignRuleForMatterApp());
processor.addBeforeRule(new AfterSignRuleSyncMesProcess());
processor.addBeforeRule(new AfterSignRuleSyncOutToMesProcess());
}
public void addBeforeRule(GeneralOutVO[] vos, AroundProcesser<GeneralOutVO> processor) {

View File

@ -18,14 +18,16 @@ import nccloud.pubift.commen.itf.utils.IHttpPostOtherSys;
import java.util.Objects;
public class AfterSignRuleSyncMesProcess implements IRule<GeneralOutVO> {
public class AfterSignRuleSyncOutToMesProcess implements IRule<GeneralOutVO> {
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<GeneralOutVO> {
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<GeneralOutVO> {
// 填充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<GeneralOutVO> {
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<GeneralOutVO> {
// 填充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<GeneralOutVO> {
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<GeneralOutVO> {
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);
}
}