Compare commits

...

2 Commits

Author SHA1 Message Date
lihao 7925d9bfc2 Merge remote-tracking branch 'origin/main' 2025-08-26 09:25:04 +08:00
lihao 32f91e6592 bom更新孙表替换项 2025-08-26 09:24:51 +08:00
1 changed files with 61 additions and 1 deletions

View File

@ -6,6 +6,8 @@
package nccloud.openapi.mmbd.bom;
import com.alibaba.fastjson.JSONObject;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.ws.rs.Consumes;
@ -13,12 +15,22 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import nc.bs.framework.common.NCLocator;
import nc.itf.bd.bom.bom0202.IBomBillMaintainService;
import nc.itf.bd.bom.bom0202.IBomBillQueryService;
import nc.mmbd.utils.factoryparam.MMBDFactoryParameter;
import nc.util.mmf.framework.base.MMValueCheck;
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.ml.NCLangRes4VoTransl;
import nc.vo.pub.BusinessException;
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;
@Path("mmbd/bom")
public class BomResource extends AbstractNCCRestResource {
public BomResource() {
@ -96,6 +108,54 @@ public class BomResource extends AbstractNCCRestResource {
}
}
@POST
@Path("bomRepl/update")
@Consumes({"application/json"})
@Produces({"application/json"})
public JSONString bomReplupdate(List<Map<String, Object>> paramMap) throws BusinessException {
if (MMValueCheck.isEmpty(paramMap)) {
return ResultMessageUtil.exceptionToJSON("传入数据异常,未传入更新数据", "1");
} else {
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);
List<AggBomVO> bomReplVOS=new ArrayList<>();
for (Map<String, Object> param : paramMap) {
BomReplVO bomReplVO=new BomReplVO();
String cbomid = (String) param.get("cbomid");
AggBomVO[] aggbomvos = qry.queryAggBomByBomID(new String[]{cbomid});
if (MMValueCheck.isEmpty(aggbomvos)) {
ExceptionUtils.wrapBusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("bdpub", "0bdpub0057"));
}
for (AggBomVO aggBomVO : aggbomvos) {
BomItemVO[] bomItemVOS =aggBomVO.getChildrenVO();
for (BomItemVO bomItemVO : bomItemVOS) {
if(bomItemVO.getCbom_bid().equals((String) param.get("cbombid"))){
BomReplVO[] replVOS=bomItemVO.getRepl();
for (BomReplVO replVO : replVOS) {
if (replVO.getCbom_replaceid().equals((String) param.get("cbom_replaceid"))){
replVO.setIreplorder(new UFDouble((Double) param.get("ireplorder")).intValue());
replVO.setVnote("测试123");
}
}
bomItemVO.setRepl(replVOS);
}
}
aggBomVO.setChildrenVO(bomItemVOS);
AggBomVO[] result = bomBillMaintainService.updateBomWithParam(new AggBomVO[]{aggBomVO}, false, false, MMBDFactoryParameter.getMMECN001Value(aggBomVO.getParentVO().getAttributeValue("pk_org").toString()).booleanValue(), true);
bomReplVOS.addAll(List.of(result));
// String jsonString=result.toString();
}
}
return ResultMessageUtil.toJSON(bomReplVOS, "BOM更新成功");
}
}
public String getModule() {
return "mmbd";
}