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 12d5471..b8dd83c 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 @@ -45,7 +45,7 @@ public class SubController { private static List gltGCalGrp = new CopyOnWriteArrayList<>(); //计算结果数据 - private static List gltGGrpCalRslt = Collections.synchronizedList(new ArrayList<>()); + private static List gltGGrpCalRslt = Collections.synchronizedList(new ArrayList<>()); //组板板坯表 private static List pmPdSlabDOList = new ArrayList<>(); @@ -67,7 +67,6 @@ public class SubController { private static List pmCmdSmallPltDOList = new ArrayList<>(); - private static int intOrdNum = 0; private static int intGrpNum = 0; @@ -162,9 +161,9 @@ public class SubController { //循环板坯 plistSlab.forEach(p -> { - logger.info("*************板坯开始{}************* " , p.getSlabNo()); + logger.info("*************板坯开始{}************* ", p.getSlabNo()); try { - gltGCalGrp=new ArrayList<>(); + gltGCalGrp = new ArrayList<>(); //二次分组 SetGrpDataBySlab(p); @@ -173,7 +172,7 @@ public class SubController { if (gltGCalGrp.size() > 0) { gltGGrpCalRslt = new ArrayList<>(); SetGroupCalRslt(p); - logger.info("结果数据板坯号:{};数量:{}",p.getSlabNo(), gltGGrpCalRslt.size()); + logger.info("结果数据板坯号:{};数量:{}", p.getSlabNo(), gltGGrpCalRslt.size()); } if (gltGGrpCalRslt.size() > 0) { now = new Date(); @@ -182,13 +181,13 @@ public class SubController { } catch (Exception e) { logger.error("An error occurred", e); } - logger.info("*************板坯结束{}************* " , p.getSlabNo()); - logger.info(""); + logger.info("*************板坯结束{}************* ", p.getSlabNo()); + logger.info(""); } ); logger.info("*****处理结束*****"); logger.info(""); - logger.info("-"); + return JsonData.buildSuccess(); } @@ -429,40 +428,6 @@ public class SubController { * */ public void SetGrpDataBySlab(SlabInfoDO SInfo) { -// gltGrpOrderFir.parallelStream().forEach(e -> { -// -// // gltGCalGrp 产生可计算分组 -// -// //压缩比 Compression ratio -// -// //宽展比 Wide ratio -// -// //钢种标准对比 -// -// GCalGrp GCG = new GCalGrp(); -// -// e.getLtInfoGPreOrder().parallelStream().forEach(f -> { -// -// //化学成分 chemical composition -// if (!ChkChemical(SInfo, f)) { -// return; -// } -// //低倍检测 low-power check -// if (!ChkLowPower(SInfo, f)) { -// return; -// } -// -// GCG.setLtInfoGPreOrder(new ArrayList<>()); -// GCG.getLtInfoGPreOrder().add(f);//添加订单信息 -// }); -// -// //存在订单,添加可计算分组 -// if (GCG.getLtInfoGPreOrder().size() > 0) { -// gltGCalGrp.add(GCG); -// } -// -// }); - gltGrpOrderFir.parallelStream().forEach(e -> { // gltGCalGrp 产生可计算分组 @@ -576,16 +541,14 @@ public class SubController { //订单要求化学成分 // logger.info("化学成分订单号:" + GrpOrd.getOrderNo()); List ltLrc = new ArrayList<>(); - int intOrd =plistQdToLineupResultCheDO.stream().filter(p->p.getOrderNo().equals(null)).collect(Collectors.toList()).size(); - int intRX =plistQdToLineupResultCheDO.stream().filter(p->p.getCheType().equals(null)).collect(Collectors.toList()).size(); - if (intOrd>0 || intRX>0) - { - logger.info("*************************化学成分订单号:{}-{}-{}" , GrpOrd.getOrderNo(),intOrd,intRX); + int intOrd = plistQdToLineupResultCheDO.stream().filter(p -> p.getOrderNo().equals(null)).collect(Collectors.toList()).size(); + int intRX = plistQdToLineupResultCheDO.stream().filter(p -> p.getCheType().equals(null)).collect(Collectors.toList()).size(); + if (intOrd > 0 || intRX > 0) { + logger.info("*************************化学成分订单号:{}-{}-{}", GrpOrd.getOrderNo(), intOrd, intRX); + } + if (plistQdToLineupResultCheDO == null) { + logger.info("*************************化学成分订单号:{}-{}-{}", GrpOrd.getOrderNo(), intOrd, intRX); } -if (plistQdToLineupResultCheDO==null) -{ - logger.info("*************************化学成分订单号:{}-{}-{}" , GrpOrd.getOrderNo(),intOrd,intRX); -} if (plistQdToLineupResultCheDO.stream().anyMatch(p -> p.getOrderNo().equals(GrpOrd.getOrderNo()) && p.getCheType().equals("RX"))) { ltLrc = plistQdToLineupResultCheDO.stream().filter(p -> p.getOrderNo().equals(SInfo.getOrderNo()) && p.getCheType().equals("RX")).collect(Collectors.toList()); } @@ -1231,8 +1194,7 @@ if (plistQdToLineupResultCheDO==null) gltGGrpCalRslt.add(GGCR); }); - if (gltGGrpCalRslt.size()==0) - { + if (gltGGrpCalRslt.size() == 0) { return; } //分组计算 @@ -1240,24 +1202,23 @@ if (plistQdToLineupResultCheDO==null) gltGGrpCalRslt.parallelStream().forEach(p -> { // 测试数据 //处理数据多处理 - List ltValues= new ArrayList<>(); - List ltweights= new ArrayList<>(); - List ltOrder= new ArrayList<>(); + List ltValues = new ArrayList<>(); + List ltweights = new ArrayList<>(); + List ltOrder = new ArrayList<>(); // logger.info( "订单总数量:" + p.getLtInfoGPreOrder().size()); - if (p== null) { + if (p == null) { return; } if (p.getLtInfoGPreOrder() == null) { return; } //计算可处理数据最大值 - p.getLtInfoGPreOrder().forEach(e->{ + p.getLtInfoGPreOrder().forEach(e -> { - int intOrdCount = p.getCal_Len()/e.getLen(); + int intOrdCount = p.getCal_Len() / e.getLen(); - if(ltOrder.stream().filter(f->f.equals(e.getOrderNo())).count()==intOrdCount) - { + if (ltOrder.stream().filter(f -> f.equals(e.getOrderNo())).count() == intOrdCount) { return; } ltOrder.add(e.getOrderNo());//添加订单号 @@ -1270,8 +1231,8 @@ if (plistQdToLineupResultCheDO==null) long[][] weights = new long[1][ltweights.size()]; for (int i = 0; i < ltValues.size(); i++) { - values[i] =ltValues.get(i); // 从订单中获取 value - weights[0][i] = ltweights.get(i)+5; // 从订单中获取 weights + values[i] = ltValues.get(i); // 从订单中获取 value + weights[0][i] = ltweights.get(i) + 5; // 从订单中获取 weights } //是否展宽 @@ -1335,7 +1296,7 @@ if (plistQdToLineupResultCheDO==null) } //设置保存数据 - public void SetSaveDate(SlabInfoDO SInfo){ + public void SetSaveDate(SlabInfoDO SInfo) { SetPmPdSlab(SInfo);//组板板坯表 命令板坯表 命令大板表 SetPmPdPlateCut();//大板粗切位置表 SetPmPdBlockPos();//组合子板位置表 @@ -1348,9 +1309,9 @@ if (plistQdToLineupResultCheDO==null) } //组板板坯表 - public void SetPmPdSlab(SlabInfoDO SInfo){ - for(int i = 0; i < gltGGrpCalRslt.size(); i++){ - GGrpCalRslt ggcr=gltGGrpCalRslt.get(i); + 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 @@ -1393,15 +1354,15 @@ if (plistQdToLineupResultCheDO==null) .filter(item -> orderNo.equals(item.getOrderNo()) && mscLineNo.equals(item.getMscLineNo())) .findFirst(); if (!ultDetectMethodCode.isEmpty()) { - if(!coolCode.isEmpty()){ + if (!coolCode.isEmpty()) { break; - }else{ - coolCode = nvl(matchingItem.get().getCoolCode(),""); + } else { + coolCode = nvl(matchingItem.get().getCoolCode(), ""); } - }else{ - ultDetectMethodCode = nvl(matchingItem.get().getUltDetectMethodCode(),""); - if (coolCode.isEmpty()){ - coolCode = nvl(matchingItem.get().getCoolCode(),""); + } else { + ultDetectMethodCode = nvl(matchingItem.get().getUltDetectMethodCode(), ""); + if (coolCode.isEmpty()) { + coolCode = nvl(matchingItem.get().getCoolCode(), ""); } } } @@ -1424,8 +1385,8 @@ if (plistQdToLineupResultCheDO==null) Optional pmProContProdAttrDOItem = plistPmProContProdAttrDO.stream() .filter(item -> orderNo.equals(item.getOrderNo())) .findFirst(); - urgOrderFlag = String.valueOf(nvl(pmProContProdAttrDOItem.get().getUrgOrderFlag(),"")); - if(!urgOrderFlag.isEmpty()){ + urgOrderFlag = String.valueOf(nvl(pmProContProdAttrDOItem.get().getUrgOrderFlag(), "")); + if (!urgOrderFlag.isEmpty()) { break; } } @@ -1505,9 +1466,9 @@ if (plistQdToLineupResultCheDO==null) pmPdSlabDO.setSampleLenTail(ggcr.getSmp_Len()); pmPdSlabDO.setSampleLenMid(ggcr.getSmp_Len()); pmPdSlabDO.setRsCode("0"); - if(BigDecimal.valueOf(ggcr.getCal_Wid()).compareTo(SInfo.getSlabActWid()) > 0){ + if (BigDecimal.valueOf(ggcr.getCal_Wid()).compareTo(SInfo.getSlabActWid()) > 0) { pmPdSlabDO.setBroadFlag("1"); //需要展宽 - }else{ + } else { pmPdSlabDO.setBroadFlag("0"); } @@ -1522,16 +1483,16 @@ if (plistQdToLineupResultCheDO==null) pmPdSlabDO.setLastUpdateDate(now); SetPmCmdSlab(pmPdSlabDO);//命令板坯表 - SetPmCmdLargePlt(pmPdSlabDO,ggcr);//命令大板表 + SetPmCmdLargePlt(pmPdSlabDO, ggcr);//命令大板表 pmPdSlabDOList.add(pmPdSlabDO); } } //大板粗切位置表 - public void SetPmPdPlateCut(){ - for(int i = 0; i < gltGGrpCalRslt.size(); i++){ - GGrpCalRslt ggcr=gltGGrpCalRslt.get(i); + public void SetPmPdPlateCut() { + for (int i = 0; i < gltGGrpCalRslt.size(); i++) { + GGrpCalRslt ggcr = gltGGrpCalRslt.get(i); PmPdPlateCutDO pmPdPlateCutDO = new PmPdPlateCutDO(); pmPdPlateCutDO.setPdMatNo(ggcr.getVirtualSlabNo()); //TODO 粗切类型 粗切位置 位置序号 取值待定 @@ -1548,16 +1509,16 @@ if (plistQdToLineupResultCheDO==null) } //组合子板位置表 - public void SetPmPdBlockPos(){ - for(int i = 0; i < gltGGrpCalRslt.size(); i++){ - GGrpCalRslt ggcr=gltGGrpCalRslt.get(i); + public void SetPmPdBlockPos() { + for (int i = 0; i < gltGGrpCalRslt.size(); i++) { + GGrpCalRslt ggcr = gltGGrpCalRslt.get(i); List orderNoList = ggcr.getLtActInfoGPreOrder().stream() .map(GPreOrder::getOrderNo).distinct().collect(Collectors.toList()); //合同号去重 - for(int j = 0; j < orderNoList.size(); j++){ + for (int j = 0; j < orderNoList.size(); j++) { PmPdBlockPosDO pmPdBlockPosDO = new PmPdBlockPosDO(); pmPdBlockPosDO.setPdMatNo(ggcr.getVirtualSlabNo()); pmPdBlockPosDO.setOrderNo(orderNoList.get(j)); - pmPdBlockPosDO.setOrderSeqNo(j+1);//TODO 订单序号 暂时以实际订单信息列表顺序 + pmPdBlockPosDO.setOrderSeqNo(j + 1);//TODO 订单序号 暂时以实际订单信息列表顺序 Integer blockPlateNum = ggcr.getLtActInfoGPreOrder().stream() // 当前合同号在实际合同列表中的条数 .filter(item -> item.getOrderNo().equals(pmPdBlockPosDO.getOrderNo())) .collect(Collectors.toList()) @@ -1581,12 +1542,12 @@ if (plistQdToLineupResultCheDO==null) GGrpCalRslt ggcr=gltGGrpCalRslt.get(i); List orderNoList = ggcr.getLtActInfoGPreOrder().stream() .map(GPreOrder::getOrderNo).distinct().collect(Collectors.toList()); //合同号去重 - for(int j = 0; j < orderNoList.size(); j++){ + for (int j = 0; j < orderNoList.size(); j++) { PmPdContSumDO pmPdContSumDO = new PmPdContSumDO(); pmPdContSumDO.setPdMatNo(ggcr.getVirtualSlabNo()); pmPdContSumDO.setOrderNo(orderNoList.get(j)); - pmPdContSumDO.setOrderSeqNo(BigDecimal.valueOf(j+1)); + pmPdContSumDO.setOrderSeqNo(BigDecimal.valueOf(j + 1)); List gPreOrders = ggcr.getLtActInfoGPreOrder().stream() // 当前合同号在实际合同列表中的条数 .filter(item -> item.getOrderNo().equals(pmPdContSumDO.getOrderNo())) .collect(Collectors.toList()); @@ -1610,29 +1571,29 @@ if (plistQdToLineupResultCheDO==null) pmPdContSumDO.setLastUpdatedBy(781L); pmPdContSumDO.setCreationDate(now); pmPdContSumDO.setLastUpdateDate(now); - SetPmCmdCont(pmPdContSumDO,gPreOrders.get(0));//命令参数表 + SetPmCmdCont(pmPdContSumDO, gPreOrders.get(0));//命令参数表 pmPdContSumDOList.add(pmPdContSumDO); } } } //组板小板位置表 - public void SetPmSmallPltPos(){ - for(int i = 0; i < gltGGrpCalRslt.size(); i++){ + public void SetPmSmallPltPos() { + for (int i = 0; i < gltGGrpCalRslt.size(); i++) { GGrpCalRslt ggcr = gltGGrpCalRslt.get(i); - for(int j = 0 ; j < ggcr.getLtActInfoGPreOrder().size(); j++){ + for (int j = 0; j < ggcr.getLtActInfoGPreOrder().size(); j++) { GPreOrder gpo = ggcr.getLtActInfoGPreOrder().get(j); PmSmallPltPosDO pmSmallPltPosDO = new PmSmallPltPosDO(); pmSmallPltPosDO.setPdMatNo(ggcr.getVirtualSlabNo()); pmSmallPltPosDO.setOrderNo(gpo.getOrderNo()); - pmSmallPltPosDO.setOrderSeqNo(j+1); + pmSmallPltPosDO.setOrderSeqNo(j + 1); pmSmallPltPosDO.setSlabNo(ggcr.getSlabNo()); Optional resultPmProContProdAttrDO = plistPmProContProdAttrDO.stream() .filter(item -> gpo.getOrderNo().equals(item.getOrderNo())) //根据合同号查询生产合同产品属性表 .findFirst(); - if(resultPmProContProdAttrDO.get().getTrimCode().equals("0")){ + if (resultPmProContProdAttrDO.get().getTrimCode().equals("0")) { pmSmallPltPosDO.setSmallPlateDivNo("000"); - }else{ + } else { pmSmallPltPosDO.setSmallPlateDivNo(SMALL_PLATE_DIV_NO[j]); } pmSmallPltPosDO.setPickModeLenDir(0);//TODO 取板方式 长度方向 不知道怎么取暂时默认为0 @@ -1659,7 +1620,7 @@ if (plistQdToLineupResultCheDO==null) } //命令板坯表 - public void SetPmCmdSlab(PmPdSlabDO pmPdSlabDO){ + public void SetPmCmdSlab(PmPdSlabDO pmPdSlabDO) { PmCmdSlabDO pmCmdSlabDO = new PmCmdSlabDO(); pmCmdSlabDO.setPonoSlabNo(pmPdSlabDO.getVirtualSlabNo()); pmCmdSlabDO.setTmpSlabNo(pmPdSlabDO.getVirtualSlabNo()); @@ -1725,7 +1686,7 @@ if (plistQdToLineupResultCheDO==null) } //命令大板表 - public void SetPmCmdLargePlt(PmPdSlabDO pmPdSlabDO,GGrpCalRslt gGrpCalRslt){ + public void SetPmCmdLargePlt(PmPdSlabDO pmPdSlabDO, GGrpCalRslt gGrpCalRslt) { PmCmdLargePltDO pmCmdLargePltDO = new PmCmdLargePltDO(); pmCmdLargePltDO.setPonoSlabNo(pmPdSlabDO.getVirtualSlabNo()); pmCmdLargePltDO.setTmpSlabNo(pmPdSlabDO.getVirtualSlabNo()); @@ -1810,9 +1771,9 @@ if (plistQdToLineupResultCheDO==null) pmCmdLargePltDO.setFormPlateTime(now); int count = gGrpCalRslt.getLtActInfoGPreOrder().size(); pmCmdLargePltDO.setOtherPlateNo1(SMALL_PLATE_DIV_NO[count]); - pmCmdLargePltDO.setOtherPlateNo2(SMALL_PLATE_DIV_NO[count+1]); - pmCmdLargePltDO.setOtherPlateNo3(SMALL_PLATE_DIV_NO[count+2]); - pmCmdLargePltDO.setOtherPlateNo4(SMALL_PLATE_DIV_NO[count+3]); + pmCmdLargePltDO.setOtherPlateNo2(SMALL_PLATE_DIV_NO[count + 1]); + pmCmdLargePltDO.setOtherPlateNo3(SMALL_PLATE_DIV_NO[count + 2]); + pmCmdLargePltDO.setOtherPlateNo4(SMALL_PLATE_DIV_NO[count + 3]); pmCmdLargePltDO.setMscLineNo(pmPdSlabDO.getMscLineNo()); pmCmdLargePltDO.setCreatedBy(781L);//TODO 创建人修改人,暂时默认781 BKGY @@ -1823,7 +1784,7 @@ if (plistQdToLineupResultCheDO==null) } //命令参数表 - public void SetPmCmdCont(PmPdContSumDO pmPdContSumDO, GPreOrder gPreOrder){ + public void SetPmCmdCont(PmPdContSumDO pmPdContSumDO, GPreOrder gPreOrder) { PmCmdContDO pmCmdContDO = new PmCmdContDO(); pmCmdContDO.setPonoSlabNo(pmPdContSumDO.getPdMatNo()); pmCmdContDO.setTmpSlabNo(pmPdContSumDO.getPdMatNo()); @@ -1912,7 +1873,7 @@ if (plistQdToLineupResultCheDO==null) } //命令小板表 - public void SetPmCmdSmallPlt(PmSmallPltPosDO pmSmallPltPosDO){ + public void SetPmCmdSmallPlt(PmSmallPltPosDO pmSmallPltPosDO) { PmCmdSmallPltDO pmCmdSmallPltDO = new PmCmdSmallPltDO(); pmCmdSmallPltDO.setPonoSlabNo(pmSmallPltPosDO.getPdMatNo()); pmCmdSmallPltDO.setTmpSlabNo(pmSmallPltPosDO.getPdMatNo());