diff --git a/mmpac/src/client/nccloud/web/mmpac/pickm/query/PickmByIdsQueryAction.java b/mmpac/src/client/nccloud/web/mmpac/pickm/query/PickmByIdsQueryAction.java index bd2ae97..76d5032 100644 --- a/mmpac/src/client/nccloud/web/mmpac/pickm/query/PickmByIdsQueryAction.java +++ b/mmpac/src/client/nccloud/web/mmpac/pickm/query/PickmByIdsQueryAction.java @@ -1,8 +1,11 @@ package nccloud.web.mmpac.pickm.query; +import nc.bs.trade.business.HYPubBO; import nc.itf.mmpac.pickm.IPickmQueryService; import nc.vo.ml.NCLangRes4VoTransl; import nc.vo.mmpac.pickm.entity.AggPickmVO; +import nc.vo.pub.lang.UFBoolean; +import nc.vo.pub.lang.UFDouble; import nccloud.dto.mmpac.pickm.pub.entity.PickmQueryInfoDTO; import nccloud.framework.core.exception.ExceptionUtils; import nccloud.framework.core.json.IJson; @@ -10,6 +13,8 @@ import nccloud.framework.service.ServiceLocator; import nccloud.framework.web.action.itf.ICommonAction; import nccloud.framework.web.container.IRequest; import nccloud.framework.web.json.JsonFactory; +import nccloud.framework.web.ui.model.GridModel; +import nccloud.framework.web.ui.model.row.Cell; import nccloud.framework.web.ui.model.row.Row; import nccloud.framework.web.ui.pattern.billcard.BillCard; import nccloud.framework.web.ui.pattern.billcard.BillCardOperator; @@ -45,12 +50,52 @@ public class PickmByIdsQueryAction implements ICommonAction { if(vo.getParentVO().getFbillstatus()!=-1){ BillCardOperator operator = new BillCardOperator(pageid); BillCard billCard = operator.toCard(vo); + if(billCard.getBody()==null){ + continue; + } + List rows = List.of(billCard.getBody().getModel().getRows()); + for (Row row:rows){ + UFDouble nplanoutastnum = (UFDouble) row.getValues().get("nplanoutastnum").getValue(); + UFDouble naccoutastnum = (UFDouble) row.getValues().get("naccoutastnum").getValue()!=null? (UFDouble)row.getValues().get("naccoutastnum").getValue():UFDouble.ZERO_DBL; + UFDouble nshouldastnum = (UFDouble) row.getValues().get("nshouldastnum").getValue()!=null? (UFDouble)row.getValues().get("nshouldastnum").getValue():UFDouble.ZERO_DBL; + UFDouble npscastnum = (UFDouble) row.getValues().get("npscastnum").getValue()!=null? (UFDouble)row.getValues().get("npscastnum").getValue():UFDouble.ZERO_DBL; + UFDouble borrowedQty =nplanoutastnum.sub(naccoutastnum).sub(nshouldastnum).sub(npscastnum); + // 新增备料数量字段,取值为:计划出库数量-累计出库数量-累计发货数量-累计委外数量 + if (borrowedQty.doubleValue() <= 0) { + continue; + } + Cell borrowedQtyCell = new Cell(); + borrowedQtyCell.setValue(borrowedQty); + row.getValues().put("borrowedQty", borrowedQtyCell); + // 产品编码 取备料计划表头产品编码 + Cell cmaterialvid = new Cell(); + cmaterialvid.setValue(vo.getParentVO().getCmaterialvid()); + row.getValues().put("cmaterialvid", borrowedQtyCell); + // 产品名称 取备料计划表头产品名称 + Cell cmaterialvidName = new Cell(); + HYPubBO hybo = new HYPubBO(); + Object cmaterialvidName1 = hybo.findColValue("bd_material", "name", "pk_material = '"+vo.getParentVO().getCmaterialvid()+"' "); + cmaterialvidName.setValue(cmaterialvidName1); + row.getValues().put("cmaterialvidName", cmaterialvidName); + // 生产序号 取备料计划表头物料档案对应表头自定义项26 + Cell cmaterialvidDef26 = new Cell(); + Object cmaterialvidDef261 = hybo.findColValue("bd_material", "def26", "pk_material = '"+vo.getParentVO().getCmaterialvid()+"' "); + cmaterialvidDef26.setValue(cmaterialvidDef261); + row.getValues().put("cmaterialvidDef26", cmaterialvidDef26); + list.add(row); + } + // bodyList.add(billCard.getBody()); - list.addAll(List.of(billCard.getBody().getModel().getRows())); } } + Grid grid = new Grid(); + GridModel model = new GridModel(); + model.add(list); + grid.setModel(model); Map returnMap = new HashMap<>(); - returnMap.put("data", list); + Map list1 = new HashMap<>(); + list1.put("rows",list); + returnMap.put("data", list1); returnMap.put("success", true); return returnMap; } catch (Exception ex) {