Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
af5068dad9
|
@ -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;
|
||||||
|
@ -110,22 +113,23 @@ 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);
|
||||||
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())) {
|
||||||
addAggvoList.add(agg);
|
addAggvoList.add(agg);
|
||||||
}else if("1".equals(fBillStatusFlag.toString())){
|
} else if ("1".equals(fBillStatusFlag.toString())) {
|
||||||
commitAggvoList.add(agg);
|
commitAggvoList.add(agg);
|
||||||
}
|
}
|
||||||
// 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("有其它默认版本,请检查!!!");
|
||||||
}
|
}
|
||||||
|
@ -135,15 +139,15 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
|
|
||||||
mapClear();
|
mapClear();
|
||||||
//请求参数状态为审批通过时,自动提交--不设审批流 start
|
//请求参数状态为审批通过时,自动提交--不设审批流 start
|
||||||
AggBomVO[] result=null;
|
AggBomVO[] result = null;
|
||||||
if(commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){
|
if (commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
||||||
return ResultMessageUtil.exceptionToJSON("BOM保存失败,不存在单据状态不为【空/自由/审批通过】的数据","999");
|
return ResultMessageUtil.exceptionToJSON("BOM保存失败,不存在单据状态不为【空/自由/审批通过】的数据", "999");
|
||||||
}else if(commitAggvoList.isEmpty()&&!addAggvoList.isEmpty()){
|
} else if (commitAggvoList.isEmpty() && !addAggvoList.isEmpty()) {
|
||||||
result= service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0]));
|
result = service.insertBom((AggBomVO[]) list.toArray(new AggBomVO[0]));
|
||||||
}else if(!commitAggvoList.isEmpty()&&addAggvoList.isEmpty()){
|
} else if (!commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
||||||
result = service.insertCommitBomWithParam((AggBomVO[]) list.toArray(new AggBomVO[0]),true,true);
|
result = service.insertCommitBomWithParam((AggBomVO[]) list.toArray(new AggBomVO[0]), true, true);
|
||||||
}else{
|
} else {
|
||||||
return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在","999");
|
return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在", "999");
|
||||||
}
|
}
|
||||||
//请求参数状态为审批通过时,自动提交--不设审批流 end
|
//请求参数状态为审批通过时,自动提交--不设审批流 end
|
||||||
return ResultMessageUtil.toJSON(result, "BOM保存成功");
|
return ResultMessageUtil.toJSON(result, "BOM保存成功");
|
||||||
|
@ -155,7 +159,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
private void dealWithMaterial(AggBomVO agg) {
|
private void dealWithMaterial(AggBomVO agg) {
|
||||||
String hcmaterialvid = (String) agg.getParentVO().getAttributeValue("hcmaterialvid");
|
String hcmaterialvid = (String) agg.getParentVO().getAttributeValue("hcmaterialvid");
|
||||||
//物料没启用版本,直接赋值
|
//物料没启用版本,直接赋值
|
||||||
if(hcmaterialvid.length()==20) {
|
if (hcmaterialvid.length() == 20) {
|
||||||
agg.getParentVO().setAttributeValue("hcmaterialid", hcmaterialvid);
|
agg.getParentVO().setAttributeValue("hcmaterialid", hcmaterialvid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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)) {
|
||||||
if(fbillstatus!=null&&"1".equals(fbillstatus.toString())){
|
//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("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);
|
||||||
|
@ -883,11 +901,11 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
|
|
||||||
hcmaterialvid = ((MaterialVersionVO) ((IMaterialPubService_C) NCLocator.getInstance()
|
hcmaterialvid = ((MaterialVersionVO) ((IMaterialPubService_C) NCLocator.getInstance()
|
||||||
.lookup(IMaterialPubService_C.class))
|
.lookup(IMaterialPubService_C.class))
|
||||||
.queryMaterialBaseInfoByOidPks(new String[] { hcmaterialoid }, new String[] { "pk_material" })
|
.queryMaterialBaseInfoByOidPks(new String[]{hcmaterialoid}, new String[]{"pk_material"})
|
||||||
.get(hcmaterialoid)).toString();
|
.get(hcmaterialoid)).toString();
|
||||||
}
|
}
|
||||||
Map<String, MaterialPlanVO> map = queryMaterialPlanInfoByPks(new String[] { hcmaterialvid }, pkorg,
|
Map<String, MaterialPlanVO> map = queryMaterialPlanInfoByPks(new String[]{hcmaterialvid}, pkorg,
|
||||||
new String[] { "fixedahead" });
|
new String[]{"fixedahead"});
|
||||||
|
|
||||||
UFDouble fixedahead = UFDouble.ZERO_DBL;
|
UFDouble fixedahead = UFDouble.ZERO_DBL;
|
||||||
if (MMValueCheck.isNotEmpty(map) && MMValueCheck.isNotEmpty((SuperVO) map.get(hcmaterialvid))
|
if (MMValueCheck.isNotEmpty(map) && MMValueCheck.isNotEmpty((SuperVO) map.get(hcmaterialvid))
|
||||||
|
@ -1286,11 +1304,11 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
for (BomOutputsVO item : items) {
|
for (BomOutputsVO item : items) {
|
||||||
try {
|
try {
|
||||||
materialMap = ((IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class))
|
materialMap = ((IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class))
|
||||||
.queryMaterialInfo(item.getPk_org(), new String[] { item.getCmaterialvid() });
|
.queryMaterialInfo(item.getPk_org(), new String[]{item.getCmaterialvid()});
|
||||||
|
|
||||||
Map<String, MeasureVO> measurevoMap = new HashMap<String, MeasureVO>();
|
Map<String, MeasureVO> measurevoMap = new HashMap<String, MeasureVO>();
|
||||||
IMeasesureService service = (IMeasesureService) NCLocator.getInstance().lookup(IMeasesureService.class);
|
IMeasesureService service = (IMeasesureService) NCLocator.getInstance().lookup(IMeasesureService.class);
|
||||||
measurevoMap.putAll(service.getMeasureInfoMap(new String[] { item.getCmaterialvid() }));
|
measurevoMap.putAll(service.getMeasureInfoMap(new String[]{item.getCmaterialvid()}));
|
||||||
if (measurevoMap.containsKey(item.getCmaterialvid())) {
|
if (measurevoMap.containsKey(item.getCmaterialvid())) {
|
||||||
item.setVchangerate(((MeasureVO) measurevoMap.get(item.getCmaterialvid())).getVchangeRate());
|
item.setVchangerate(((MeasureVO) measurevoMap.get(item.getCmaterialvid())).getVchangeRate());
|
||||||
item.setCastunitid(((MeasureVO) measurevoMap.get(item.getCmaterialvid())).getCassMeasures());
|
item.setCastunitid(((MeasureVO) measurevoMap.get(item.getCmaterialvid())).getCassMeasures());
|
||||||
|
@ -1388,8 +1406,8 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
||||||
Map<String, MaterialVO> materialSourceMap = new HashMap<String, MaterialVO>();
|
Map<String, MaterialVO> materialSourceMap = new HashMap<String, MaterialVO>();
|
||||||
try {
|
try {
|
||||||
materialSourceMap = ((IMaterialPubService_C) NCLocator.getInstance().lookup(IMaterialPubService_C.class))
|
materialSourceMap = ((IMaterialPubService_C) NCLocator.getInstance().lookup(IMaterialPubService_C.class))
|
||||||
.queryMaterialBaseInfoByPks(new String[] { materialVid },
|
.queryMaterialBaseInfoByPks(new String[]{materialVid},
|
||||||
new String[] { "pk_source", "graphid", "materialspec", "materialtype" });
|
new String[]{"pk_source", "graphid", "materialspec", "materialtype"});
|
||||||
|
|
||||||
} catch (BusinessException e1) {
|
} catch (BusinessException e1) {
|
||||||
ResultMessageUtil.exceptionToJSON(e1);
|
ResultMessageUtil.exceptionToJSON(e1);
|
||||||
|
|
Loading…
Reference in New Issue