uapbd_bom新增修改接口优化

This commit is contained in:
李正@用友 2025-04-14 17:41:03 +08:00
parent 235c4b1aa4
commit 75b99f5a1f
1 changed files with 1360 additions and 1342 deletions

View File

@ -8,9 +8,12 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator; import nc.bs.framework.common.NCLocator;
import nc.itf.bd.bom.bom0202.IBomBillMaintainService; import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
import nc.itf.bd.bom.bom0202.IBomBillQueryService; import nc.itf.bd.bom.bom0202.IBomBillQueryService;
import nc.itf.bd.bom.bom0202.IBomBusinessService;
import nc.itf.mmf.busi.measure.IMeasesureService; import nc.itf.mmf.busi.measure.IMeasesureService;
import nc.mmbd.utils.factoryparam.MMBDFactoryParameter; import nc.mmbd.utils.factoryparam.MMBDFactoryParameter;
import nc.pubitf.uapbd.IMaterialPubService; import nc.pubitf.uapbd.IMaterialPubService;
@ -112,6 +115,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs); BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
List<AggBomVO> commitAggvoList = new ArrayList<>(); List<AggBomVO> commitAggvoList = new ArrayList<>();
List<AggBomVO> addAggvoList = new ArrayList<>(); List<AggBomVO> addAggvoList = new ArrayList<>();
String userCode = InvocationInfoProxy.getInstance().getUserCode();
for (AggBomVO agg : aggVOs) { for (AggBomVO agg : aggVOs) {
Object fBillStatusFlag = agg.getParent().getAttributeValue("fbillstatus"); Object fBillStatusFlag = agg.getParent().getAttributeValue("fbillstatus");
if (fBillStatusFlag == null || "-1".equals(fBillStatusFlag.toString())) { if (fBillStatusFlag == null || "-1".equals(fBillStatusFlag.toString())) {
@ -121,11 +125,11 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
} }
// zhangxinah 对物料主键进行翻译 // zhangxinah 对物料主键进行翻译
dealWithMaterial(agg); dealWithMaterial(agg);
dataSupplement(agg); dataSupplement(agg, userCode);
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault"); UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
if (UFBoolean.TRUE.equals(flag)) { if (UFBoolean.TRUE.equals(flag)) {
UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg); UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg, userCode);
if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) { if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) {
ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!"); ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!");
} }
@ -205,14 +209,14 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]); AggBomVO[] aggVOs = (AggBomVO[]) list.toArray(new AggBomVO[list.size()]);
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs); BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
String userCode = InvocationInfoProxy.getInstance().getUserCode();
for (AggBomVO agg : aggVOs) { for (AggBomVO agg : aggVOs) {
dataSupplement(agg); dataSupplement(agg, userCode);
UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault"); UFBoolean flag = (UFBoolean) agg.getParent().getAttributeValue("hbdefault");
if (UFBoolean.TRUE.equals(flag)) { if (UFBoolean.TRUE.equals(flag)) {
UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg); UFBoolean bHasOtherDefaultVersion = getIsExistDefaultVersion(agg, userCode);
if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) { if (bHasOtherDefaultVersion.equals(UFBoolean.TRUE)) {
ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!"); ExceptionUtils.wrappBusinessException("有其它默认版本,请检查!!!");
} }
@ -608,11 +612,12 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
agg.setChildren(BomOutputsVO.class, (ISuperVO[]) list.toArray(new BomOutputsVO[0])); agg.setChildren(BomOutputsVO.class, (ISuperVO[]) list.toArray(new BomOutputsVO[0]));
} }
private UFBoolean getIsExistDefaultVersion(AggBomVO aggvo) { private UFBoolean getIsExistDefaultVersion(AggBomVO aggvo, String userCode) {
if (aggvo != null) { if (aggvo != null) {
BomVO headvo = (BomVO) aggvo.getParentVO(); BomVO headvo = (BomVO) aggvo.getParentVO();
String pk_org = headvo.getPk_org().toString(); String pk_org = headvo.getPk_org().toString();
String materialOid = headvo.getHcmaterialid().toString(); String materialOid = headvo.getHcmaterialid().toString();
String hversion = headvo.getHversion();
String materialVid = null; String materialVid = null;
if (MMValueCheck.isNotEmpty(headvo.getHcmaterialvid())) { if (MMValueCheck.isNotEmpty(headvo.getHcmaterialvid())) {
materialVid = headvo.getHcmaterialvid().toString(); materialVid = headvo.getHcmaterialvid().toString();
@ -633,13 +638,20 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
defaultBOM = getBomBillQueryService().queryOrderBomByMaterialCond(pk_org, vsobillcode, vsobillno, defaultBOM = getBomBillQueryService().queryOrderBomByMaterialCond(pk_org, vsobillcode, vsobillno,
bomtype.intValue()); bomtype.intValue());
} }
// IBomBusinessService service = (IBomBusinessService)NCLocator.getInstance().lookup(IBomBusinessService.class);
if (MMValueCheck.isNotEmpty(defaultBOM)) { if (MMValueCheck.isNotEmpty(defaultBOM)) {
for (AggBomVO aggBomVO : defaultBOM) { for (AggBomVO aggBomVO : defaultBOM) {
BomVO head = (BomVO) aggBomVO.getParent(); BomVO head = (BomVO) aggBomVO.getParent();
if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype()) if (VersionTypeEnum.AVAILABLE.equalsValue(head.getHfversiontype())
&& !head.getCbomid().equals(headvo.getCbomid())) { && !head.getCbomid().equals(headvo.getCbomid())) {
//sdlizheng --添加独立判断--plm三方越过此校验
if ("plm".equals(userCode)) {
// AggBomVO afterVO = service.canceldefault(aggBomVO);
} else {
return UFBoolean.TRUE; return UFBoolean.TRUE;
} }
//sdlizheng --添加独立判断--plm三方越过此校验
}
} }
} }
@ -655,8 +667,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
return (IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class); return (IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class);
} }
private void dataSupplement(AggBomVO agg) { private void dataSupplement(AggBomVO agg, String userCode) {
orgSupplement(agg); orgSupplement(agg, userCode);
versionTypeSupplement(agg); versionTypeSupplement(agg);
@ -674,13 +686,12 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
handleEvent(outputVOs); handleEvent(outputVOs);
} }
private void orgSupplement(AggBomVO agg) { private void orgSupplement(AggBomVO agg, String userCode) {
if (MMValueCheck.isEmpty(agg.getParent().getAttributeValue("pk_org_v"))) { if (MMValueCheck.isEmpty(agg.getParent().getAttributeValue("pk_org_v"))) {
String pk_org_v = OrgUnitPubService String pk_org_v = OrgUnitPubService
.getNewVIDByOrgID(agg.getParent().getAttributeValue("pk_org").toString()); .getNewVIDByOrgID(agg.getParent().getAttributeValue("pk_org").toString());
agg.getParent().setAttributeValue("pk_org_v", pk_org_v); agg.getParent().setAttributeValue("pk_org_v", pk_org_v);
} }
//1对于之前不存在的BOM新增时如果是传自由态不默认且无效如果传的是审批态默认且有效2025年4月11日16点28分 start
Object fbillstatus = agg.getParent().getAttributeValue("fbillstatus"); Object fbillstatus = agg.getParent().getAttributeValue("fbillstatus");
if (MMValueCheck.isEmpty(agg.getParent().getAttributeValue("cbomid"))) { if (MMValueCheck.isEmpty(agg.getParent().getAttributeValue("cbomid"))) {
agg.getParent().setAttributeValue("fbomtype", Integer.valueOf(1)); agg.getParent().setAttributeValue("fbomtype", Integer.valueOf(1));
@ -688,12 +699,17 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1)); agg.getParent().setAttributeValue("fbillstatus", Integer.valueOf(-1));
agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1)); agg.getParent().setAttributeValue("hfbomsource", Integer.valueOf(1));
agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1)); agg.getParent().setAttributeValue("hfbomcategory", Integer.valueOf(1));
} if ("plm".equals(userCode)) {
//sdlizheng 1对于之前不存在的BOM新增时如果是传自由态不默认且无效走标准逻辑如果传的是审批态默认且有效2025年4月11日16点28分 start
if (fbillstatus != null && "1".equals(fbillstatus.toString())) { if (fbillstatus != null && "1".equals(fbillstatus.toString())) {
agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1)); agg.getParent().setAttributeValue("hfversiontype", Integer.valueOf(1));
agg.getParent().setAttributeValue("hbdefault", UFBoolean.TRUE); agg.getParent().setAttributeValue("hbdefault", UFBoolean.TRUE);
} }
//1对于之前不存在的BOM新增时如果是传自由态不默认且无效如果传的是审批态默认且有效2025年4月11日16点28分 end //sdlizheng 1对于之前不存在的BOM新增时如果是传自由态不默认且无效如果传的是审批态默认且有效2025年4月11日16点28分 end
}
}
} }
private void materialidSupplement(AggBomVO agg) { private void materialidSupplement(AggBomVO agg) {
@ -770,6 +786,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
private BomHeadMtrlParam getQueryParam(AggBomVO agg) { private BomHeadMtrlParam getQueryParam(AggBomVO agg) {
String pk_org = agg.getParentVO().getAttributeValue("pk_org").toString(); String pk_org = agg.getParentVO().getAttributeValue("pk_org").toString();
String hcmaterialid = agg.getParentVO().getAttributeValue("hcmaterialid").toString(); String hcmaterialid = agg.getParentVO().getAttributeValue("hcmaterialid").toString();
String hcmateriavid = agg.getParentVO().getAttributeValue("hcmaterialvid").toString();
String pwdkey = null; String pwdkey = null;
boolean iscust = false; boolean iscust = false;
@ -781,6 +798,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
BomHeadMtrlParam param = new BomHeadMtrlParam(); BomHeadMtrlParam param = new BomHeadMtrlParam();
param.setPk_org(pk_org); param.setPk_org(pk_org);
param.setMaterialid(hcmaterialid); param.setMaterialid(hcmaterialid);
param.setMateriavid(hcmateriavid);
param.setPwdkey(pwdkey); param.setPwdkey(pwdkey);
param.setBomtype(bomtype); param.setBomtype(bomtype);
param.setIscust(iscust); param.setIscust(iscust);