bom替代料接口调整
This commit is contained in:
parent
5d68e40f57
commit
84ad04810b
|
@ -1,5 +1,7 @@
|
|||
package nccloud.api.impl.mmbd.bom;
|
||||
|
||||
import nc.bs.bd.bom.bom0202.bp.BomPubBP;
|
||||
import nc.bs.bd.bom.bom0202.bp.BomUpdateBP;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.framework.common.InvocationInfoProxy;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
|
@ -24,9 +26,12 @@ import nc.util.mmf.busi.measure.MeasureParam;
|
|||
import nc.util.mmf.busi.measure.MeasureVO;
|
||||
import nc.util.mmf.busi.measure.NumScaleUtil;
|
||||
import nc.util.mmf.busi.service.OrgUnitPubService;
|
||||
import nc.util.mmf.framework.base.MMArrayUtil;
|
||||
import nc.util.mmf.framework.base.MMValueCheck;
|
||||
import nc.util.mmf.framework.gc.GCBillTransferTool;
|
||||
import nc.vo.bd.bom.bom0202.entity.*;
|
||||
import nc.vo.bd.bom.bom0202.enumeration.*;
|
||||
import nc.vo.bd.bom.bom0202.message.MMBDLangConstBom0202;
|
||||
import nc.vo.bd.bom.bom0202.paramvo.BomHeadMtrlParam;
|
||||
import nc.vo.bd.bom.bom0202.paramvo.BomHeadMtrlResult;
|
||||
import nc.vo.bd.bom.bom0202.paramvo.BomMaterialParam;
|
||||
|
@ -127,7 +132,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
|
||||
for (AggBomVO aggtwo : aggVOs) {
|
||||
BomItemVO[] items = aggtwo.getChildrenVO();
|
||||
//2025年5月9日08点56分--添加表头物料翻译校验 start
|
||||
// 2025年5月9日08点56分--添加表头物料翻译校验 start
|
||||
if (aggtwo.getParent().getAttributeValue("hcmaterialid") != null) {
|
||||
MaterialVO headMaterialVO = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
|
||||
aggtwo.getParent().getAttributeValue("hcmaterialid").toString());
|
||||
|
@ -135,15 +140,15 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
ExceptionUtils.wrappBusinessException("根据物料【" + aggtwo.getParent().getAttributeValue("hcmaterialid").toString() + "】查询物料失败,请在BIP里确认是否物料已存在!!!");
|
||||
}
|
||||
}
|
||||
//2025年5月9日08点56分--添加表头物料翻译校验 end
|
||||
// 2025年5月9日08点56分--添加表头物料翻译校验 end
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
MaterialVO bankAccSub = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
|
||||
items[i].getAttributeValue("cmaterialid").toString());
|
||||
//2025年5月7日08点41分 添加为空校验 sdlizheng --start
|
||||
// 2025年5月7日08点41分 添加为空校验 sdlizheng --start
|
||||
if (bankAccSub == null) {
|
||||
ExceptionUtils.wrappBusinessException("根据物料【" + items[i].getAttributeValue("cmaterialid").toString() + "】查询物料失败,请在BIP里确认是否物料已存在!!!");
|
||||
}
|
||||
//2025年5月7日08点41分 添加为空校验 sdlizheng --end
|
||||
// 2025年5月7日08点41分 添加为空校验 sdlizheng --end
|
||||
items[i].setAttributeValue("cmaterialvid", bankAccSub.getAttributeValue("pk_source"));
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +189,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
result = service.insertBom((AggBomVO[]) addAggvoList.toArray(new AggBomVO[0]));
|
||||
} else if (!commitAggvoList.isEmpty() && addAggvoList.isEmpty()) {
|
||||
List<AggBomVO> newAggVOList = new ArrayList<>();
|
||||
if ("gaoning".equals(userCode) || "C029".equals(orgCodeFlag)) {
|
||||
if ("gaoning".equals(userCode) || "C029".equals(orgCodeFlag) || "dldzspplm".equals(userCode)) {
|
||||
for (AggBomVO aggvo : commitAggvoList) {
|
||||
result = service.insertCommitBomWithParam(new AggBomVO[]{aggvo}, true, true);
|
||||
insertBomMatchRt(result);
|
||||
|
@ -284,7 +289,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
AggBomVO aggBomVO = result[0];
|
||||
BomVO bomVO = (BomVO) aggBomVO.getParentVO();
|
||||
BomItemVO[] bomItemVOs = aggBomVO.getChildrenVO();
|
||||
SuperVOUtil.sortByAttributeName(bomItemVOs,"cbeginperiod",false);
|
||||
SuperVOUtil.sortByAttributeName(bomItemVOs, "cbeginperiod", false);
|
||||
|
||||
BomMatchRtVO bomMatchRtVO = new BomMatchRtVO();
|
||||
bomMatchRtVO.setStatus(VOStatus.NEW);
|
||||
|
@ -380,7 +385,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
BillFieldsCodeToPkUtil.doTranslateVOFields(aggVOs);
|
||||
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
|
||||
for (AggBomVO aggtwo : aggVOs) {
|
||||
//2025年5月9日08点56分--添加表头物料翻译校验 start
|
||||
// 2025年5月9日08点56分--添加表头物料翻译校验 start
|
||||
if (aggtwo.getParent().getAttributeValue("hcmaterialid") != null) {
|
||||
MaterialVO headMaterialVO = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
|
||||
aggtwo.getParent().getAttributeValue("hcmaterialid").toString());
|
||||
|
@ -388,16 +393,16 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
ExceptionUtils.wrappBusinessException("根据物料【" + aggtwo.getParent().getAttributeValue("hcmaterialid").toString() + "】查询物料失败,请在BIP里确认是否物料已存在!!!");
|
||||
}
|
||||
}
|
||||
//2025年5月9日08点56分--添加表头物料翻译校验 end
|
||||
// 2025年5月9日08点56分--添加表头物料翻译校验 end
|
||||
BomItemVO[] items = aggtwo.getChildrenVO();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
MaterialVO bankAccSub = (MaterialVO) iUifService.queryByPrimaryKey(MaterialVO.class,
|
||||
items[i].getAttributeValue("cmaterialid").toString());
|
||||
//2025年5月7日08点41分 添加为空校验 sdlizheng --start
|
||||
// 2025年5月7日08点41分 添加为空校验 sdlizheng --start
|
||||
if (bankAccSub == null) {
|
||||
ExceptionUtils.wrappBusinessException("根据物料【" + items[i].getAttributeValue("cmaterialid").toString() + "】查询物料失败,请在BIP里确认是否物料已存在!!!");
|
||||
}
|
||||
//2025年5月7日08点41分 添加为空校验 sdlizheng --end
|
||||
// 2025年5月7日08点41分 添加为空校验 sdlizheng --end
|
||||
items[i].setAttributeValue("cmaterialvid", bankAccSub.getAttributeValue("pk_source"));
|
||||
}
|
||||
}
|
||||
|
@ -458,6 +463,35 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
}
|
||||
}
|
||||
|
||||
public AggBomVO[] updateBomWithParam(AggBomVO[] aggvos, boolean isFromBom, boolean isecn, boolean isCheckEcn,
|
||||
boolean isOnApprove) throws BusinessException {
|
||||
if (MMArrayUtil.isEmpty(aggvos)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// 检查该BOM是否被删除,因为如果BOM树状维护将BOM删除了,不允许修改该条记录
|
||||
Set<String> bomids = new HashSet<String>();
|
||||
for (AggBomVO vo : aggvos) {
|
||||
bomids.add(vo.getPrimaryKey());
|
||||
}
|
||||
Set<String> checkResult = BomPubBP.getBomID(bomids.toArray(new String[]{}));
|
||||
if (checkResult != null && checkResult.size() < bomids.size()) {
|
||||
nc.vo.pubapp.pattern.exception.ExceptionUtils.wrappBusinessException(MMBDLangConstBom0202.getBOM_DELETED());
|
||||
}
|
||||
// 加锁 + 检查ts
|
||||
GCBillTransferTool<AggBomVO> transTool = new GCBillTransferTool<AggBomVO>(aggvos);
|
||||
// 补全前台VO
|
||||
AggBomVO[] fullBills = transTool.getClientFullInfoBill();
|
||||
// 获得修改前vo
|
||||
AggBomVO[] originBills = transTool.getOriginBills();
|
||||
BomUpdateBP bp = new BomUpdateBP();
|
||||
return bp.update(fullBills, originBills, isCheckEcn, isOnApprove, isFromBom, isecn);
|
||||
} catch (Exception e) {
|
||||
nc.vo.pubapp.pattern.exception.ExceptionUtils.marsh(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void mapInit(AggBomVO aggs) {
|
||||
tsMap.put(aggs.getParent().getPrimaryKey(), aggs.getParent().getAttributeValue("ts"));
|
||||
|
||||
|
@ -841,7 +875,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
if ("gaoning".equals(userCode) || "dlkgsrm".equals(userCode) || "C029".equals(this.orgCodeFlag) || "hgqwms".equals(userCode)) {
|
||||
// AggBomVO afterVO = service.canceldefault(aggBomVO);
|
||||
} else if (MESUSERCODE.equals(userCode)) {
|
||||
//2025-6-20 添加MES用户判断
|
||||
// 2025-6-20 添加MES用户判断
|
||||
} else {
|
||||
return UFBoolean.TRUE;
|
||||
}
|
||||
|
@ -1442,26 +1476,26 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
return items;
|
||||
}
|
||||
|
||||
public BomItemVO[] handleEventTwo( AggBomVO agg) throws MetaDataException {
|
||||
public BomItemVO[] handleEventTwo(AggBomVO agg) throws MetaDataException {
|
||||
IUifService iUifService = NCLocator.getInstance().lookup(IUifService.class);
|
||||
BomItemVO[] items = agg.getChildrenVO();
|
||||
for(BomItemVO item : items) {
|
||||
for (BomItemVO item : items) {
|
||||
StringBuffer whereSqlitem = new StringBuffer();
|
||||
whereSqlitem.append(" hcmaterialid = '"+item.getCmaterialid()+"'").append(" and dr ='0'");
|
||||
whereSqlitem.append(" hcmaterialid = '" + item.getCmaterialid() + "'").append(" and dr ='0'");
|
||||
Collection<AggBomVO> aggBomVOitem;
|
||||
try {
|
||||
aggBomVOitem = MDPersistenceService.lookupPersistenceQueryService().queryBillOfVOByCond(AggBomVO.class, whereSqlitem.toString(), false);
|
||||
if(Objects.nonNull(aggBomVOitem)&&!aggBomVOitem.isEmpty() ) {
|
||||
if (Objects.nonNull(aggBomVOitem) && !aggBomVOitem.isEmpty()) {
|
||||
StringBuffer whereSql = new StringBuffer();
|
||||
whereSql.append(" hcmaterialid = '"+item.getCmaterialid()+"'").append(" and hvdef3 ='"+agg.getParent().getAttributeValue("hvdef3")+"'").append(" and hvdef2 ='"+agg.getParent().getAttributeValue("hvdef2")+"'").append(" and dr ='0'");
|
||||
whereSql.append(" hcmaterialid = '" + item.getCmaterialid() + "'").append(" and hvdef3 ='" + agg.getParent().getAttributeValue("hvdef3") + "'").append(" and hvdef2 ='" + agg.getParent().getAttributeValue("hvdef2") + "'").append(" and dr ='0'");
|
||||
Collection<AggBomVO> aggBomVO;
|
||||
aggBomVO = MDPersistenceService.lookupPersistenceQueryService().queryBillOfVOByCond(AggBomVO.class, whereSql.toString(), false);
|
||||
if(Objects.nonNull(aggBomVO) && aggBomVO.size()==1) {
|
||||
if (Objects.nonNull(aggBomVO) && aggBomVO.size() == 1) {
|
||||
for (AggBomVO aggBom : aggBomVO) {
|
||||
item.setVitemversion(aggBom.getPrimaryKey());
|
||||
}
|
||||
}else {
|
||||
nccloud.base.exception.ExceptionUtils.wrapBusinessException("根据条件未查出bom或者查出多条bom不唯一"+whereSql);
|
||||
} else {
|
||||
nccloud.base.exception.ExceptionUtils.wrapBusinessException("根据条件未查出bom或者查出多条bom不唯一" + whereSql);
|
||||
}
|
||||
}
|
||||
} catch (MetaDataException e1) {
|
||||
|
@ -1472,6 +1506,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
|
||||
return items;
|
||||
}
|
||||
|
||||
void setMaterialInfo(Map<String, BomMaterialParam> materialMap, BomItemVO item) {
|
||||
String materialvid = item.getCmaterialvid();
|
||||
if (!materialMap.containsKey(materialvid)) {
|
||||
|
@ -1620,7 +1655,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
|| MMValueCheck.isEmpty(fsupplymode) || MMValueCheck.isEmpty(fcontrol)
|
||||
|| MMValueCheck.isEmpty(cbeginperiod) || MMValueCheck.isEmpty(cendperiod)
|
||||
|| MMValueCheck.isEmpty(fbackflushtype)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,子表材料第" + i + 1 + "行"+ cmaterialvid +"存在未填的必输项", "1");
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,子表材料第" + i + 1 + "行" + cmaterialvid + "存在未填的必输项", "1");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1634,7 +1669,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
String cmaterialvid = outputsVO.getCmaterialvid();
|
||||
|
||||
if (MMValueCheck.isEmpty(foutputtype) || MMValueCheck.isEmpty(cmaterialvid)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,联副产品第" + j + 1 + "行"+cmaterialvid+"存在未填的必输项", "1");
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,联副产品第" + j + 1 + "行" + cmaterialvid + "存在未填的必输项", "1");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1766,9 +1801,10 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
* 2025年7月10日修改 - 改为根据自定义项hvdef4判断是否为定制BOM
|
||||
* 同步MES时:只有标准版本的bom "默认"(hbdefault) 生效(hfversiontype的等于1)
|
||||
* 定制bom(hvdef4值为Y)取消 "默认"(hbdefault,值为N) 但生效(hfversiontype的等于1)
|
||||
* @auther 毛磊
|
||||
*
|
||||
* @param agg AggBomVO对象
|
||||
* @param userCode 用户代码
|
||||
* @auther 毛磊
|
||||
*/
|
||||
private void handleMesUserDefaultSetting(AggBomVO agg, String userCode) {
|
||||
obmlog.debug("handleMesUserDefaultSetting - 开始处理MES用户的默认设置逻辑,用户代码:" + userCode);
|
||||
|
@ -1793,7 +1829,7 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService {
|
|||
|
||||
if (isCustomBom) {
|
||||
// 定制BOM:取消默认但仍然生效
|
||||
agg.getParent().setAttributeValue("hbdefault","N");
|
||||
agg.getParent().setAttributeValue("hbdefault", "N");
|
||||
obmlog.debug("handleMesUserDefaultSetting - 定制BOM,取消默认(hbdefault=false)");
|
||||
} else {
|
||||
// 标准版本:设置为默认且生效
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Source code recreated from a .class file by IntelliJ IDEA
|
||||
// (powered by FernFlower decompiler)
|
||||
//
|
||||
|
||||
package nccloud.api.mmbd.bom;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import nc.vo.bd.bom.bom0202.entity.AggBomVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import org.json.JSONString;
|
||||
|
||||
public interface IAPIBomBusinessService {
|
||||
JSONString insert(List<Map<String, Object>> var1);
|
||||
|
||||
JSONString update(List<Map<String, Object>> var1);
|
||||
|
||||
JSONString query(Map<String, Object> var1);
|
||||
|
||||
AggBomVO[] updateBomWithParam(AggBomVO[] aggvos, boolean isFromBom, boolean isecn, boolean isCheckEcn,
|
||||
boolean isOnApprove) throws BusinessException;
|
||||
}
|
|
@ -6,15 +6,6 @@
|
|||
package nccloud.openapi.mmbd.bom;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.*;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import nc.bs.bd.bom.bom0202.bp.BomPubBP;
|
||||
import nc.bs.bd.bom.bom0202.bp.BomUpdateBP;
|
||||
import nc.bs.framework.common.NCLocator;
|
||||
import nc.bs.trade.business.HYPubBO;
|
||||
import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
|
||||
|
@ -22,13 +13,10 @@ 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.MMValueCheck;
|
||||
import nc.util.mmf.framework.gc.GCBillTransferTool;
|
||||
import nc.vo.bd.bom.bom0202.entity.AggBomVO;
|
||||
import nc.vo.bd.bom.bom0202.entity.BomItemVO;
|
||||
import nc.vo.bd.bom.bom0202.entity.BomReplVO;
|
||||
import nc.vo.bd.bom.bom0202.message.MMBDLangConstBom0202;
|
||||
import nc.vo.ml.NCLangRes4VoTransl;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.VOStatus;
|
||||
|
@ -37,9 +25,18 @@ import nc.vo.pub.lang.UFDouble;
|
|||
import nccloud.api.mmbd.bom.IAPIBomBusinessService;
|
||||
import nccloud.api.rest.utils.ResultMessageUtil;
|
||||
import nccloud.framework.core.exception.ExceptionUtils;
|
||||
//import nccloud.framework.service.ServiceLocator;
|
||||
import nccloud.ws.rest.resource.AbstractNCCRestResource;
|
||||
import org.json.JSONString;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Path("mmbd/bom")
|
||||
public class BomResource extends AbstractNCCRestResource {
|
||||
public BomResource() {
|
||||
|
@ -50,11 +47,11 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString insert(JSONObject para) {
|
||||
List<Map<String, Object>> paramList = (List)para.get("data");
|
||||
List<Map<String, Object>> paramList = (List) para.get("data");
|
||||
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.insert(paramList);
|
||||
return result;
|
||||
}
|
||||
|
@ -68,7 +65,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.insert(paramList);
|
||||
return result;
|
||||
}
|
||||
|
@ -79,11 +76,11 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
@Consumes({"application/json"})
|
||||
@Produces({"application/json"})
|
||||
public JSONString update(JSONObject para) {
|
||||
List<Map<String, Object>> paramList = (List)para.get("data");
|
||||
List<Map<String, Object>> paramList = (List) para.get("data");
|
||||
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;
|
||||
}
|
||||
|
@ -97,7 +94,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;
|
||||
}
|
||||
|
@ -111,7 +108,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;
|
||||
}
|
||||
|
@ -125,13 +122,12 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
if (MMValueCheck.isEmpty(paramMap)) {
|
||||
return ResultMessageUtil.exceptionToJSON("传入数据异常,未传入更新数据", "1");
|
||||
} else {
|
||||
try{
|
||||
try {
|
||||
|
||||
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService)NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
// List<>
|
||||
IBomBillQueryService qry = (IBomBillQueryService)NCLocator.getInstance().lookup(IBomBillQueryService.class);
|
||||
IBomBillMaintainService bomBillMaintainService = (IBomBillMaintainService)NCLocator.getInstance().lookup(IBomBillMaintainService.class);
|
||||
IAPIBomBusinessService service = (IAPIBomBusinessService) NCLocator.getInstance().lookup(IAPIBomBusinessService.class);
|
||||
IBomBillQueryService qry = (IBomBillQueryService) NCLocator.getInstance().lookup(IBomBillQueryService.class);
|
||||
IBomBillMaintainService bomBillMaintainService = (IBomBillMaintainService) NCLocator.getInstance().lookup(IBomBillMaintainService.class);
|
||||
|
||||
List<AggBomVO> bomReplVOS = new ArrayList<>();
|
||||
for (Map<String, Object> param : paramMap) {
|
||||
|
@ -206,7 +202,7 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
|
||||
// 更新BOM
|
||||
aggBomVO.setChildrenVO(bomItemVOS);
|
||||
AggBomVO[] result = this.updateBomWithParam(
|
||||
AggBomVO[] result = service.updateBomWithParam(
|
||||
new AggBomVO[]{aggBomVO},
|
||||
false,
|
||||
false,
|
||||
|
@ -221,12 +217,13 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
|
||||
|
||||
return ResultMessageUtil.toJSON(bomReplVOS, "BOM更新成功");
|
||||
}catch (BusinessException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (BusinessException e) {
|
||||
return ResultMessageUtil.exceptionToJSON(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 提取属性设置为工具方法,减少冗余
|
||||
private void setReplVOProperties(BomReplVO replVO, Map<String, Object> param) throws UifException {
|
||||
HYPubBO hybo = new HYPubBO();
|
||||
|
@ -238,8 +235,8 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
// }
|
||||
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 + "' ");
|
||||
|
||||
replVO.setCreplmaterialvid(mrlid);
|
||||
}
|
||||
|
@ -273,34 +270,6 @@ public class BomResource extends AbstractNCCRestResource {
|
|||
}
|
||||
}
|
||||
}
|
||||
public AggBomVO[] updateBomWithParam(AggBomVO[] aggvos, boolean isFromBom, boolean isecn, boolean isCheckEcn,
|
||||
boolean isOnApprove) throws BusinessException {
|
||||
if (MMArrayUtil.isEmpty(aggvos)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// 检查该BOM是否被删除,因为如果BOM树状维护将BOM删除了,不允许修改该条记录
|
||||
Set<String> bomids = new HashSet<String>();
|
||||
for (AggBomVO vo : aggvos) {
|
||||
bomids.add(vo.getPrimaryKey());
|
||||
}
|
||||
Set<String> checkResult = BomPubBP.getBomID(bomids.toArray(new String[] {}));
|
||||
if (checkResult != null && checkResult.size() < bomids.size()) {
|
||||
nc.vo.pubapp.pattern.exception.ExceptionUtils.wrappBusinessException(MMBDLangConstBom0202.getBOM_DELETED());
|
||||
}
|
||||
// 加锁 + 检查ts
|
||||
GCBillTransferTool<AggBomVO> transTool = new GCBillTransferTool<AggBomVO>(aggvos);
|
||||
// 补全前台VO
|
||||
AggBomVO[] fullBills = transTool.getClientFullInfoBill();
|
||||
// 获得修改前vo
|
||||
AggBomVO[] originBills = transTool.getOriginBills();
|
||||
BomUpdateBP bp = new BomUpdateBP();
|
||||
return bp.update(fullBills, originBills, isCheckEcn, isOnApprove, isFromBom, isecn);
|
||||
} catch (Exception e) {
|
||||
nc.vo.pubapp.pattern.exception.ExceptionUtils.marsh(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return "mmbd";
|
||||
|
|
Loading…
Reference in New Issue