From 736664a4bb1c1621178ba1235d23cce05ac8736b Mon Sep 17 00:00:00 2001 From: BKGY_MYT <1536233200@qq.com> Date: Wed, 15 Jan 2025 08:48:16 +0800 Subject: [PATCH] =?UTF-8?q?PmPdSlab=20=20=E6=9B=B4=E6=96=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shopmanager/controller/SubController.java | 203 ++++++++++++++++++ .../shopmanager/model/GGrpCalRslt.java | 2 +- .../net/xdclass/shopmanager/tool/Tool.java | 22 ++ 3 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/tool/Tool.java diff --git a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/controller/SubController.java b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/controller/SubController.java index 6b5747b..5327142 100644 --- a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/controller/SubController.java +++ b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/controller/SubController.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collector; import java.util.stream.Collectors; +import static net.xdclass.shopmanager.tool.Tool.nvl; import static net.xdclass.shopmanager.util.Knapsack.solve; @RestController @@ -47,6 +48,26 @@ public class SubController { //计算结果数据 private static List gltGGrpCalRslt = new CopyOnWriteArrayList<>(); + //组板板坯表 + private static List pmPdSlabDOList = new ArrayList<>(); + //大板粗切位置表 + private static List pmPdPlateCutDOList = new ArrayList<>(); + //组合子板位置表 + private static List pmPdBlockPosDOList = new ArrayList<>(); + //组板合同总量表 + private static List pmPdContSumDOList = new ArrayList<>(); + //组板小板位置表 + private static List pmSmallPltPosDOList = new ArrayList<>(); + //命令板坯表 + private static List pmCmdSlabDOList = new ArrayList<>(); + //命令大板表 + private static List pmCmdLargePltDOList = new ArrayList<>(); + //命令参数表 + private static List pmCmdContDOList = new ArrayList<>(); + //命令小板表 + private static List pmCmdSmallPltDOList = new ArrayList<>(); + + private static int intOrdNum = 0; @@ -100,6 +121,8 @@ public class SubController { private static List plistQeTqPonoWaitTestDO; //坯料低倍委托实绩表 private static List plistQeTqSlabMacroResultDO; + //板坯信息表 + private static List plistPmPdSlabInfoDO; //TODO 需要添加此表信息的查询 //endregion @@ -150,6 +173,9 @@ public class SubController { SetGroupCalRslt(p); } + if(gltGGrpCalRslt.size()>0){ + SetSaveDate(p); + } } @@ -1252,4 +1278,181 @@ public class SubController { } + //设置保存数据 + public void SetSaveDate(SlabInfoDO SInfo){ + SetPmPdSlab(SInfo); + } + + public void SetPmPdSlab(SlabInfoDO SInfo){ + for(int i = 0; i < gltGGrpCalRslt.size(); i++){ + GGrpCalRslt GGCR=gltGGrpCalRslt.get(i); + PmPdSlabDO pmPdSlabDO = new PmPdSlabDO(); + pmPdSlabDO.setPono(SInfo.getPono()); + pmPdSlabDO.setSlabDivNo(BigDecimal.ZERO); //TODO 板坯分割号 未赋值 查询板坯号等于slab_no的组板板坯表的记录数+1 + pmPdSlabDO.setVirtualSlabNo(GGCR.getVirtualSlabNo()); + pmPdSlabDO.setSlabNo(GGCR.getSlabNo()); + pmPdSlabDO.setMatDesignKind("S"); + pmPdSlabDO.setPdStatusHp("12"); + pmPdSlabDO.setPdResp("12"); // TODO 组板责任者 未赋值 操作人id + pmPdSlabDO.setFormPlateMode("FormPlateMode"); //TODO 组板方式 未赋值 + pmPdSlabDO.setPickModeLenDir(BigDecimal.ZERO); //TODO 取板方式_长度方向 未赋值 + pmPdSlabDO.setPickModeWidDir(BigDecimal.ZERO); //TODO 取板方式_宽度方向 未赋值 + pmPdSlabDO.setFurType("FurType"); //TODO 加热炉类型 未赋值 + pmPdSlabDO.setAutoManualFlag("M"); + pmPdSlabDO.setOrderRemainDiv("1"); + pmPdSlabDO.setCanDelFlag("1"); + List orderNoList = GGCR.getLtActInfoGPreOrder().stream().map(GPreOrder::getOrderNo).distinct().collect(Collectors.toList());//根据实际合同信息 的合同号去重 取出板内合同个数 + pmPdSlabDO.setOrderNumInPlate(BigDecimal.valueOf(orderNoList.size())); + pmPdSlabDO.setTotSmallPlateNum(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().size())); + + Optional resultPmContMscTechDO = plistPmContMscTechDO.stream() + .filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo())) //TODO 根据轴合同号查询合同工艺表 暂时取第一条合同 + .findFirst(); + pmPdSlabDO.setAdTypeCode(resultPmContMscTechDO.get().getAdTypeCode()); + pmPdSlabDO.setAdModeCode(resultPmContMscTechDO.get().getAdModeCode()); + pmPdSlabDO.setCtrlRollCode(resultPmContMscTechDO.get().getCtrlRollCode()); + pmPdSlabDO.setCutModeCode(resultPmContMscTechDO.get().getCutModeCode()); + + //TODO 缺少质量模块MES合同主档QD_TO_PO_ORDER + pmPdSlabDO.setUltCode(resultPmContMscTechDO.get().getUltCode());//TODO 遍历组板合同,根据合同号从质量模块MES合同主档QD_TO_PO_ORDER读取ERP_UT_SPEC1探伤标准1、ERP_UT_SPEC2超声探伤标2、ERP_UT_SPEC3超声探伤标3,去重后所有数据拼接成一条记录 + + String ultDetectMethodCode = ""; + String coolCode = ""; + // 遍历 组板合同列表 + for (GPreOrder gPreOrder : GGCR.getLtActInfoGPreOrder()) { + String orderNo = gPreOrder.getOrderNo(); + String mscLineNo = gPreOrder.getInfoPmContMscTechDO().getMscLineNo(); + + // 根据 orderNo 和 mscLineNo 在 plistPmContMscTechDO 中查找匹配项 + Optional matchingItem = plistPmContMscTechDO.stream() + .filter(item -> orderNo.equals(item.getOrderNo()) && mscLineNo.equals(item.getMscLineNo())) + .findFirst(); + if (!ultDetectMethodCode.isEmpty()) { + if(!coolCode.isEmpty()){ + break; + }else{ + coolCode = nvl(matchingItem.get().getCoolCode(),""); + } + }else{ + ultDetectMethodCode = nvl(matchingItem.get().getUltDetectMethodCode(),""); + if (coolCode.isEmpty()){ + coolCode = nvl(matchingItem.get().getCoolCode(),""); + } + } + } + pmPdSlabDO.setUltDetectMethodCode(ultDetectMethodCode); + pmPdSlabDO.setCoolCode(coolCode); + + Optional resultPmProContProdAttrDO = plistPmProContProdAttrDO.stream() + .filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo())) //TODO 根据轴合同号查询生产合同产品属性表 暂时取第一条合同 + .findFirst(); + pmPdSlabDO.setWithSideFlag(resultPmProContProdAttrDO.get().getProdSideMark()); + + pmPdSlabDO.setHeadCut(BigDecimal.valueOf(GGCR.getHead_Len())); + pmPdSlabDO.setTailCut(BigDecimal.valueOf(GGCR.getTail_Len())); + + String urgOrderFlag = ""; + for (GPreOrder gPreOrder : GGCR.getLtActInfoGPreOrder()) { + String orderNo = gPreOrder.getOrderNo(); + + // 根据 orderNo 和 mscLineNo 在 plistPmContMscTechDO 中查找匹配项 + Optional pmProContProdAttrDOItem = plistPmProContProdAttrDO.stream() + .filter(item -> orderNo.equals(item.getOrderNo())) + .findFirst(); + urgOrderFlag = String.valueOf(nvl(pmProContProdAttrDOItem.get().getUrgOrderFlag(),"")); + if(!urgOrderFlag.isEmpty()){ + break; + } + } + pmPdSlabDO.setUrgOrderFlag(urgOrderFlag); + + pmPdSlabDO.setSgSign(SInfo.getSgSign()); + pmPdSlabDO.setStNo(SInfo.getStNo()); + pmPdSlabDO.setOutSgNo(SInfo.getStNo()); + + pmPdSlabDO.setPreCleanSlabThick(SInfo.getSlabActThk()); + pmPdSlabDO.setPreCleanSlabWidth(SInfo.getSlabActWid()); + pmPdSlabDO.setPreCleanSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + pmPdSlabDO.setPreCleanSlabMaxLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + pmPdSlabDO.setPreCleanSlabMinLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + BigDecimal weight = SInfo.getSlabActThk().multiply(SInfo.getSlabActWid()).multiply(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())).multiply(BigDecimal.valueOf(7.85)); + pmPdSlabDO.setPreCleanSlabWt(weight); + pmPdSlabDO.setPreCleanSlabMaxWt(weight); + pmPdSlabDO.setPreCleanSlabMinWt(weight); + + pmPdSlabDO.setInfurSlabThick(SInfo.getSlabActThk()); + pmPdSlabDO.setInfurSlabWid(SInfo.getSlabActWid()); + pmPdSlabDO.setInfurSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + pmPdSlabDO.setInfurSlabMaxLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + pmPdSlabDO.setInfurSlabMinLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + pmPdSlabDO.setInfurSlabWt(weight); + pmPdSlabDO.setInfurSlabMaxWt(weight); + pmPdSlabDO.setInfurSlabMinWt(weight); + + pmPdSlabDO.setFixSlabLenFlag(0); + pmPdSlabDO.setFixSlabLen(BigDecimal.valueOf(GGCR.getVirtualSlab_Len())); + + Optional resultPmContMscTechDO1 = plistPmContMscTechDO.stream() + .filter(item -> GGCR.getLtActInfoGPreOrder().get(0).getOrderNo().equals(item.getOrderNo()) && GGCR.getLtActInfoGPreOrder().get(0).getInfoPmContMscTechDO().getMscLineNo().equals(item.getMscLineNo())) //TODO 根据轴合同号和产线号查询合同工艺表 暂时取第一条合同 + .findFirst(); + + pmPdSlabDO.setHpFlameCleanDiv(resultPmContMscTechDO1.get().getFlameCleanDiv()); + pmPdSlabDO.setSlabFinishCode(resultPmContMscTechDO1.get().getSlabFinishCode()); + + Optional resultPmPdSlabInfoDO = plistPmPdSlabInfoDO.stream() + .filter(item -> GGCR.getSlabNo().equals(item.getSlabNo())) + .findFirst(); + pmPdSlabDO.setSlabPlaceCode(resultPmPdSlabInfoDO.get().getSlabPlaceCode()); + + pmPdSlabDO.setRollAimThick(GGCR.getCal_Thk()); + pmPdSlabDO.setRollAimWidth(BigDecimal.valueOf(GGCR.getCal_Wid())); + pmPdSlabDO.setRollAimLen(BigDecimal.valueOf(GGCR.getCal_Len())); + pmPdSlabDO.setOrderThickAxis(GGCR.getLtActInfoGPreOrder().get(0).getThk()); + pmPdSlabDO.setCombinePlateWidth(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().get(0).getWid())); + pmPdSlabDO.setCombinePlateLen(BigDecimal.valueOf(GGCR.getLtActInfoGPreOrder().get(0).getLen())); + pmPdSlabDO.setRollWtHp(weight); + + BigDecimal minThickTolMax = GGCR.getLtActInfoGPreOrder().stream() + .map(GPreOrder::getThickTolMax) + .min(BigDecimal::compareTo) + .orElse(BigDecimal.ZERO); + pmPdSlabDO.setRollThickTolMax(minThickTolMax); + BigDecimal maxThickTolMin = GGCR.getLtActInfoGPreOrder().stream() + .map(GPreOrder::getThickTolMin) + .max(BigDecimal::compareTo) + .orElse(BigDecimal.ZERO); + pmPdSlabDO.setRollThickTolMin(maxThickTolMin); + + BigDecimal yield = (GGCR.getLtActInfoGPreOrder().stream() + .map(gPreOrder -> BigDecimal.valueOf(gPreOrder.getWid()).multiply(gPreOrder.getThk()).multiply(BigDecimal.valueOf(gPreOrder.getLen()))) + .reduce(BigDecimal.ZERO, BigDecimal::add)) + .multiply(BigDecimal.valueOf(7.85)) + .divide(weight, 2, RoundingMode.HALF_UP); + pmPdSlabDO.setCommandYield(yield); + pmPdSlabDO.setNormYield(yield); + pmPdSlabDO.setRollYield(yield); + + pmPdSlabDO.setEdgerUseFlag("Y"); + pmPdSlabDO.setBroadMasUseFlag("N"); + pmPdSlabDO.setFormMasUseFlag("N"); + pmPdSlabDO.setRollDirectCode("L"); //TODO 轧制方向代码 横轧C纵轧L 暂时默认L + pmPdSlabDO.setSampleLenHead(GGCR.getSmp_Len());//TODO 头尾中 试样长度 暂时默认试样长度 + pmPdSlabDO.setSampleLenTail(GGCR.getSmp_Len()); + pmPdSlabDO.setSampleLenMid(GGCR.getSmp_Len()); + pmPdSlabDO.setRsCode("0"); + if(BigDecimal.valueOf(GGCR.getCal_Wid()).compareTo(SInfo.getSlabActWid()) > 0){ + pmPdSlabDO.setBroadFlag("1"); //需要展宽 + }else{ + pmPdSlabDO.setBroadFlag("0"); + } + + pmPdSlabDO.setOrderNoAxis(GGCR.getLtActInfoGPreOrder().get(0).getOrderNo());//TODO 轴合同号 暂时取第一个订单号 + pmPdSlabDO.setMscLineNo("1030"); //TODO 产线号,暂时默认1030 + + pmPdSlabDO.setTransFlag(BigDecimal.valueOf(0)); + pmPdSlabDOList.add(pmPdSlabDO); + } + + } + } diff --git a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GGrpCalRslt.java b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GGrpCalRslt.java index 3f69520..d83b53e 100644 --- a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GGrpCalRslt.java +++ b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GGrpCalRslt.java @@ -25,7 +25,7 @@ public class GGrpCalRslt { //虚拟板坯厚度 private BigDecimal VirtualSlab_Thk; - //宽度 + //轧制宽度 private int Cal_Wid; //厚度 private BigDecimal Cal_Thk; diff --git a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/tool/Tool.java b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/tool/Tool.java new file mode 100644 index 0000000..e60e877 --- /dev/null +++ b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/tool/Tool.java @@ -0,0 +1,22 @@ +package net.xdclass.shopmanager.tool; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +public class Tool { + public static T nvl(T value, T defaultValue){ + return value != null ? value : defaultValue; + } + + + public static void main(String[] args) throws Exception { + String str = null; + String ddd = "123"; + String XX = nvl(null, ddd); + + System.out.println("创建的新流程id:" + XX); + + System.out.println("asdfghjkl--" ); + } +}