BOM替代料接口增加修改字段:bcanreplace、freplacetype、bisdisplace
This commit is contained in:
parent
84207f18d9
commit
99213dbf93
|
|
@ -13,7 +13,6 @@ import nc.itf.bd.bom.bom0202.IBomBillQueryService;
|
|||
import nc.jdbc.framework.generator.IdGenerator;
|
||||
import nc.mmbd.utils.factoryparam.MMBDFactoryParameter;
|
||||
import nc.uif.pub.exception.UifException;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.util.mmf.framework.base.MMStringUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.vo.bd.bom.bom0202.entity.AggBomVO;
|
||||
|
|
@ -24,6 +23,7 @@ import nc.vo.pub.BusinessException;
|
|||
import nc.vo.pub.VOStatus;
|
||||
import nc.vo.pub.lang.UFBoolean;
|
||||
import nc.vo.pub.lang.UFDouble;
|
||||
import nc.ws.opm.pub.utils.result.APIErrCodeEnum;
|
||||
import nccloud.api.mmbd.bom.IAPIBomBusinessService;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
|
|
@ -96,7 +96,7 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
if (MMValueCheck.isEmpty(paramList)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,参数要包含表头信息和表体信息", "1");
|
||||
} else {
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService)NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService) NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
JSONString result = service.update(paramList);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
if (MMValueCheck.isEmpty(paramMap)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,未传入查询条件", "1");
|
||||
} else {
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService)NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService) NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
JSONString result = service.query(paramMap);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -124,9 +124,7 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
if (MMValueCheck.isEmpty(paramMap)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,未传入更新数据", "1");
|
||||
} else {
|
||||
try{
|
||||
|
||||
|
||||
try {
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService) NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
IBomBillQueryService qry = (IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class);
|
||||
IBomBillMaintainService bomBillMaintainService = (IBomBillMaintainService) NCLocator.getInstance().lookup(IBomBillMaintainService.class);
|
||||
|
|
@ -136,10 +134,15 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
String cbomid = (String) param.get("cbomid");
|
||||
String targetCbomReplaceId = (String) param.get("cbom_replaceid"); // 目标替代ID
|
||||
String targetCbomBid = (String) param.get("cbombid"); // 目标物料项ID
|
||||
String freplacetype = param.get("freplacetype") + ""; // 替代类型
|
||||
|
||||
// 校验必要参数
|
||||
if (MMValueCheck.isEmpty(cbomid) || MMValueCheck.isEmpty(targetCbomBid)) {
|
||||
ExceptionUtils.wrapBusinessException("cbomidºÍcbombidΪ±Ø´«²ÎÊý");
|
||||
return ResultMessageUtil.exceptionToJSON("cbomid和cbombid为必传参数", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
|
||||
if (MMValueCheck.isEmpty(freplacetype) || !Arrays.asList("1", "2").contains(freplacetype)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入替代类型为空或者值范围错误", APIErrCodeEnum.BUSINESSEXCCODE.getCode());
|
||||
}
|
||||
|
||||
// 查询BOM数据
|
||||
|
|
@ -157,6 +160,11 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
for (BomItemVO bomItemVO : bomItemVOS) {
|
||||
// 匹配目标物料项
|
||||
if (targetCbomBid.equals(bomItemVO.getCbom_bid())) {
|
||||
bomItemVO.setStatus(VOStatus.UPDATED);
|
||||
// bcanreplace 可替代
|
||||
bomItemVO.setBcanreplace(UFBoolean.TRUE);
|
||||
// freplacetype 替代类型 1=全部替代;2=部分替代;
|
||||
bomItemVO.setFreplacetype(Integer.valueOf(freplacetype));
|
||||
BomReplVO[] replVOS = bomItemVO.getRepl();
|
||||
List<BomReplVO> replList = MMValueCheck.isEmpty(replVOS)
|
||||
? new ArrayList<>()
|
||||
|
|
@ -216,27 +224,27 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
bomReplVOS.addAll(Arrays.asList(result));
|
||||
}
|
||||
}
|
||||
List<Map<String,Object>> bomReplVOList = new ArrayList<>();
|
||||
List<Map<String, Object>> bomReplVOList = new ArrayList<>();
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
for (Map<String, Object> param : paramMap) {
|
||||
String cbomid = (String) param.get("cbomid");
|
||||
String targetCbomReplaceId = (String) param.get("cbom_replaceid"); // 目标替代ID
|
||||
String targetCbomBid = (String) param.get("cbombid"); // 目标物料项ID
|
||||
if(!MMStringUtil.isEmpty(targetCbomReplaceId)){
|
||||
if (!MMStringUtil.isEmpty(targetCbomReplaceId)) {
|
||||
bomReplVOList.add(param);
|
||||
continue;
|
||||
}else{
|
||||
} else {
|
||||
if (param.containsKey("creplmaterialvid")) {
|
||||
|
||||
String mrlCode= (String) param.get("creplmaterialvid");
|
||||
String mrlid=(String) hybo.findColValue("bd_material","pk_material"," code = '" + mrlCode + "' ");
|
||||
String mrlCode = (String) param.get("creplmaterialvid");
|
||||
String mrlid = (String) hybo.findColValue("bd_material", "pk_material", " code = '" + mrlCode + "' ");
|
||||
for (AggBomVO aggBomVO : bomReplVOS) {
|
||||
for (BomItemVO bomItemVO : aggBomVO.getChildrenVO()) {
|
||||
|
||||
if (targetCbomBid.equals(bomItemVO.getCbom_bid())) {
|
||||
for (BomReplVO replVO : bomItemVO.getRepl()) {
|
||||
if(replVO.getCreplmaterialvid().equals(mrlid)){
|
||||
param.put("cbom_replaceid",replVO.getCbom_replaceid());
|
||||
if (replVO.getCreplmaterialvid().equals(mrlid)) {
|
||||
param.put("cbom_replaceid", replVO.getCbom_replaceid());
|
||||
bomReplVOList.add(param);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -261,6 +269,8 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
|
||||
// 提取属性设置为工具方法,减少冗余
|
||||
private void setReplVOProperties(BomReplVO replVO, Map<String, Object> param) throws UifException {
|
||||
// bisdisplace 取代
|
||||
replVO.setBisdisplace(UFBoolean.TRUE);
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
// if (param.containsKey("pk_group")) {
|
||||
// replVO.setPk_group((String) param.get("pk_group"));
|
||||
|
|
|
|||
Loading…
Reference in New Issue