材料出库-代码同步

This commit is contained in:
mzr 2025-12-09 13:49:54 +08:00
parent bbb77e7695
commit 97f3a96a9e
1 changed files with 16 additions and 11 deletions

View File

@ -24,7 +24,6 @@ import nc.vo.ic.m4d.entity.MaterialOutBodyVO;
import nc.vo.ic.m4d.entity.MaterialOutHeadVO; import nc.vo.ic.m4d.entity.MaterialOutHeadVO;
import nc.vo.ic.m4d.entity.MaterialOutVO; import nc.vo.ic.m4d.entity.MaterialOutVO;
import nc.vo.ic.pub.define.ICPubMetaNameConst; import nc.vo.ic.pub.define.ICPubMetaNameConst;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.mmpac.pickm.entity.AggPickmVO; import nc.vo.mmpac.pickm.entity.AggPickmVO;
import nc.vo.mmpac.pickm.entity.PickmItemVO; import nc.vo.mmpac.pickm.entity.PickmItemVO;
import nc.vo.pub.BusinessException; import nc.vo.pub.BusinessException;
@ -181,7 +180,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
MaterialOutHeadVO newVO = vos[0].getHead(); MaterialOutHeadVO newVO = vos[0].getHead();
String cgeneralhid = newVO.getCgeneralhid(); String cgeneralhid = newVO.getCgeneralhid();
if (StringUtils.isEmpty(cgeneralhid)) { if (StringUtils.isEmpty(cgeneralhid)) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0391")/*@res "修改材料出库单请指定表头主键cgeneralhid值。"*/);
} }
SCMBillQuery<MaterialOutVO> queryTool = SCMBillQuery<MaterialOutVO> queryTool =
new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class); new SCMBillQuery<MaterialOutVO>(MaterialOutVO.class);
@ -194,7 +193,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
}); });
ICLocationUtil.loadLocationVOs(originBills); ICLocationUtil.loadLocationVOs(originBills);
if (ArrayUtils.isEmpty(materialOutVOs)) { if (ArrayUtils.isEmpty(materialOutVOs)) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息请检查数据的表头主键cgeneralhid。"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0360")/*@res "没找到要修改的出库单信息请检查数据的表头主键cgeneralhid。"*/);
} else { } else {
List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D"); List<String> headProFields = CheckProhibitUpdateFields.getHeadProhibitFields("4D");
List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D"); List<String> bodyProFields = CheckProhibitUpdateFields.getBodyProhibitFields("4D");
@ -202,7 +201,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (origVO.getFbillflag() == null || if (origVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) origVO.getFbillflag())) { .compareTo((Integer) origVO.getFbillflag())) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0362")/*@res "不是自由状态,不能修改"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + origVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0362")/*@res "不是自由状态,不能修改"*/);
} }
origVO.setStatus(VOStatus.UPDATED); origVO.setStatus(VOStatus.UPDATED);
for (String attr : newVO.getAttributeNames()) { for (String attr : newVO.getAttributeNames()) {
@ -211,7 +210,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
} }
if (headProFields.contains(attr) if (headProFields.contains(attr)
&& !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))) { && !newVO.getAttributeValue(attr).equals(origVO.getAttributeValue(attr))) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0363")/*@res "表头字段:"*/ + attr + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0363")/*@res "表头字段:"*/ + attr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
} }
origVO.setAttributeValue(attr, newVO.getAttributeValue(attr)); origVO.setAttributeValue(attr, newVO.getAttributeValue(attr));
} }
@ -233,7 +232,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
for (MaterialOutBodyVO newBvo : vos[0].getBodys()) { for (MaterialOutBodyVO newBvo : vos[0].getBodys()) {
MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid()); MaterialOutBodyVO roigBvo = pkbs.get(newBvo.getCgeneralbid());
if (newBvo.getCgeneralbid() == null || roigBvo == null) { if (newBvo.getCgeneralbid() == null || roigBvo == null) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息请检查数据的表体主键cgeneralbid。"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0365")/*@res "没有匹配到原始出库单表体信息请检查数据的表体主键cgeneralbid。"*/);
} }
Set<String> bfields = new HashSet<String>(); Set<String> bfields = new HashSet<String>();
for (String battr : newBvo.getAttributeNames()) { for (String battr : newBvo.getAttributeNames()) {
@ -242,7 +241,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
} }
if (bodyProFields.contains(battr) if (bodyProFields.contains(battr)
&& !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))) { && !newBvo.getAttributeValue(battr).equals(roigBvo.getAttributeValue(battr))) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0366")/*@res "表体字段:"*/ + battr + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0366")/*@res "表体字段:"*/ + battr + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0364")/*@res "不允许修改。"*/);
} }
roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr)); roigBvo.setAttributeValue(battr, newBvo.getAttributeValue(battr));
bfields.add(battr); bfields.add(battr);
@ -279,11 +278,13 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (utils != null && utils.isWMS()) { if (utils != null && utils.isWMS()) {
// 获取originBill里表体的主键和项目字段形成Map,再遍历materialOutVOs去替换明细的项目 // 获取originBill里表体的主键和项目字段形成Map,再遍历materialOutVOs去替换明细的项目
Map<String, String> originProjectMap = new HashMap<>(); Map<String, String> originProjectMap = new HashMap<>();
Map<String, String> originCproductMap = new HashMap<>();
for (MaterialOutVO originBill : originBills) { for (MaterialOutVO originBill : originBills) {
MaterialOutBodyVO[] originBodys = originBill.getBodys(); MaterialOutBodyVO[] originBodys = originBill.getBodys();
if (originBodys != null) { if (originBodys != null) {
for (MaterialOutBodyVO originBody : originBodys) { for (MaterialOutBodyVO originBody : originBodys) {
originProjectMap.put(originBody.getCgeneralbid(), originBody.getCprojectid()); originProjectMap.put(originBody.getCgeneralbid(), originBody.getCprojectid());
originCproductMap.put(originBody.getCgeneralbid(), originBody.getCproductorid());
} }
} }
} }
@ -293,9 +294,13 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (bodyVOs != null) { if (bodyVOs != null) {
for (MaterialOutBodyVO bodyVO : bodyVOs) { for (MaterialOutBodyVO bodyVO : bodyVOs) {
String projectId = originProjectMap.get(bodyVO.getCgeneralbid()); String projectId = originProjectMap.get(bodyVO.getCgeneralbid());
String cproductId = originCproductMap.get(bodyVO.getCgeneralbid());
if (projectId != null) { if (projectId != null) {
bodyVO.setCprojectid(projectId); bodyVO.setCprojectid(projectId);
} }
if (cproductId != null) {
bodyVO.setCproductorid(cproductId);
}
} }
} }
} }
@ -320,7 +325,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0367")/*@res "不是自由状态,不能删除"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0367")/*@res "不是自由状态,不能删除"*/);
} }
} }
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null); return (MaterialOutVO[]) PfServiceScmUtil.processBatch("DELETE", "4D", vos, null, null);
@ -336,11 +341,11 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.FREE.value()) 0 != ((Integer) ICBillFlag.FREE.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0330")/*@res "不是自由状态,不能签字"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0330")/*@res "不是自由状态,不能签字"*/);
} }
if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) { if (aggvo.getChildrenVO() != null && aggvo.getChildrenVO().length > 0) {
if (aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null) { if (aggvo.getChildrenVO()[0].getAttributeValue(ICPubMetaNameConst.NNUM) == null) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0392")/*@res "总数量为空,不能签字"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0392")/*@res "总数量为空,不能签字"*/);
} }
} }
@ -359,7 +364,7 @@ public class APIMaterialOutMaintainImpl implements IAPIMaterialOutMaintain {
if (parentVO.getFbillflag() == null || if (parentVO.getFbillflag() == null ||
0 != ((Integer) ICBillFlag.SIGN.value()) 0 != ((Integer) ICBillFlag.SIGN.value())
.compareTo((Integer) parentVO.getFbillflag())) { .compareTo((Integer) parentVO.getFbillflag())) {
throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0332")/*@res "不是签字状态,不能取消签字"*/); throw new BusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0361")/*@res "当前出库单编号:"*/ + parentVO.getVbillcode() + nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4008027_0", "04008027-0332")/*@res "不是签字状态,不能取消签字"*/);
} }
} }
return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null); return (MaterialOutVO[]) PfServiceScmUtil.processBatch("CANCELSIGN", "4D", vos, null, null);