bom接口解决物料翻译错误问题-张鑫0505

This commit is contained in:
zhangxinah@yonyou.com 2025-05-06 08:57:52 +08:00
parent c58d29bee8
commit 2b73616ff0
1 changed files with 1402 additions and 1374 deletions

View File

@ -15,6 +15,7 @@ import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
import nc.itf.bd.bom.bom0202.IBomBillQueryService;
import nc.itf.bd.bom.bom0202.IBomBusinessService;
import nc.itf.mmf.busi.measure.IMeasesureService;
import nc.itf.uif.pub.IUifService;
import nc.mmbd.utils.factoryparam.MMBDFactoryParameter;
import nc.pubitf.uapbd.IMaterialPubService;
import nc.pubitf.uapbd.IMaterialPubService_C;
@ -113,6 +114,15 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
for (AggBomVO aggtwo : aggVOs) {
BomItemVO[] items = aggtwo.getChildrenVO();
for (int i = 0; i < items.length; i++) {
MaterialVO bankAccSub = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
items[i].getAttributeValue("cmaterialid").toString());
items[i].setAttributeValue("cmaterialvid", bankAccSub.getAttributeValue("pk_source"));
}
}
List<AggBomVO> commitAggvoList = new ArrayList<>();
List<AggBomVO> addAggvoList = new ArrayList<>();
String userCode = InvocationInfoProxy.getInstance().getUserCode();
@ -162,7 +172,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
if (e.getMessage().length() > 100) {
aggvo.getParent().setAttributeValue("hvdef2", e.getMessage().substring(0, 100));
} else {
aggvo.getParent().setAttributeValue("hvdef2",e.getMessage().substring(0,e.getMessage().length()-1));
aggvo.getParent().setAttributeValue("hvdef2",
e.getMessage().substring(0, e.getMessage().length() - 1));
}
} else {
Throwable unmarsh = ExceptionUtils.unmarsh(e);
@ -172,7 +183,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
newAggVOList.add(aggvo);
}
}
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999","BOM保存提交成功部分成功部分失败",true);
return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999",
"BOM保存提交成功部分成功部分失败", true);
}
} else {
return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在", "999");
@ -186,10 +198,15 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
private void dealWithMaterial(AggBomVO agg) {
String hcmaterialvid = (String) agg.getParentVO().getAttributeValue("hcmaterialvid");
String hcmaterialid = (String) agg.getParentVO().getAttributeValue("hcmaterialid");
// 物料没启用版本直接赋值
if (hcmaterialvid.length() == 20) {
agg.getParentVO().setAttributeValue("hcmaterialid", hcmaterialvid);
}
// 物料没启用版本直接赋值
if (hcmaterialid.length() == 20) {
agg.getParentVO().setAttributeValue("hcmaterialvid", hcmaterialid);
}
}
public JSONString update(List<Map<String, Object>> paramList) {
@ -227,7 +244,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
agg.getParentVO().setAttributeValue("billmaker", original.getParent().getAttributeValue("billmaker"));
agg.getParentVO().setAttributeValue("creator", original.getParent().getAttributeValue("creator"));
if (bom.get("hbdefault") == null) {
agg.getParentVO().setAttributeValue("hbdefault", original.getParent().getAttributeValue("hbdefault"));
agg.getParentVO().setAttributeValue("hbdefault",
original.getParent().getAttributeValue("hbdefault"));
}
// 2025年4月11日14点35分 --重新赋值上制单人创建人+默认 --end
JSONString checkInfo = requiredCheck(agg);
@ -240,9 +258,19 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
for (AggBomVO aggtwo : aggVOs) {
BomItemVO[] items = aggtwo.getChildrenVO();
for (int i = 0; i < items.length; i++) {
MaterialVO bankAccSub = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
items[i].getAttributeValue("cmaterialid").toString());
items[i].setAttributeValue("cmaterialvid", bankAccSub.getAttributeValue("pk_source"));
}
}
String userCode = InvocationInfoProxy.getInstance().getUserCode();
for (AggBomVO agg : aggVOs) {
// zhangxinah 对物料主键进行翻译
dealWithMaterial(agg);
dataSupplement(agg, userCode);
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
@ -731,7 +759,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1));
agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1));
if ("gaoning".equals(userCode) || "dlkght".equals(userCode)) {
//sdlizheng 1对于之前不存在的BOM新增时如果是传自由态不默认且无效走标准逻辑如果传的是审批态默认且有效2025年4月11日16点28分 start
// sdlizheng
// 1对于之前不存在的BOM新增时如果是传自由态不默认且无效走标准逻辑如果传的是审批态默认且有效2025年4月11日16点28分 start
if (fbillstatus != null && "1".equals(fbillstatus.toString())) {
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
agg.getParent().setAttributeValue("hbdefault", UFBoolean.TRUE);
@ -740,7 +769,6 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
}
}
}
private void materialidSupplement(AggBomVO agg) {