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 0a30f9e..40cc143 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 @@ -48,8 +48,6 @@ public class SubController { private static List gltGGrpCalRslt = new CopyOnWriteArrayList<>(); - - private static int intOrdNum = 0; private static int intGrpNum = 0; @@ -147,14 +145,13 @@ public class SubController { logger.info("***二次分组数量*** " + gltGCalGrp.size()); - if (gltGCalGrp.size()>0){ + if (gltGCalGrp.size() > 0) { SetGroupCalRslt(p); } - } ); @@ -185,28 +182,28 @@ public class SubController { //1板坯数据 tasks.add(() -> { plistSlab = subService.getSlabInfo(); - logger.info("******1板坯数据获取完毕*******"); +// logger.info("******1板坯数据获取完毕*******"); return null; }); //2订单数据 tasks.add(() -> { plistOrder = subService.getOrderInfo(); - logger.info("******2订单数据获取完毕*******"); +// logger.info("******2订单数据获取完毕*******"); return null; }); //3生产合同产品属性表 tasks.add(() -> { plistPmProContProdAttrDO = subService.getPmProCountProdAttr(); - logger.info("******3生产合同产品属性表数据获取完毕*******"); +// logger.info("******3生产合同产品属性表数据获取完毕*******"); return null; }); //4合同产线工艺参数表 tasks.add(() -> { plistPmContMscTechDO = subService.getPmContMscTech(); - logger.info("******4合同产线工艺参数表数据获取完毕*******"); +// logger.info("******4合同产线工艺参数表数据获取完毕*******"); return null; }); @@ -214,133 +211,133 @@ public class SubController { tasks.add(() -> { // plistPmProContProdAttrDO = subService.getPmProCountProdAttr(); Thread.sleep(10000); // 休眠10秒钟 - logger.info("******5生产合同产品属性表数据获取完毕*******"); +// logger.info("******5生产合同产品属性表数据获取完毕*******"); return null; }); //6组板设计规则集 tasks.add(() -> { plistPmPdRuleSetDO = subService.getPmPdRuleSet(); - logger.info("******6组板设计规则集数据获取完毕*******"); +// logger.info("******6组板设计规则集数据获取完毕*******"); return null; }); //7组板设计规则集 tasks.add(() -> { plistPmPdRuleItemDO = subService.getPmPdRuleItem(); - logger.info("******7组板设计规则集数据获取完毕*******"); +// logger.info("******7组板设计规则集数据获取完毕*******"); return null; }); //8最小轧制厚度公差范围基准表 tasks.add(() -> { plistPmMinThickTolBtDO = subService.getPmMinThickTolBt(); - logger.info("******8最小轧制厚度公差范围基准表数据获取完毕*******"); +// logger.info("******8最小轧制厚度公差范围基准表数据获取完毕*******"); return null; }); //9钢板轧制规格对应收得率基准表 tasks.add(() -> { plistPmPlateSpecYieldBtDO = subService.getPmPlateSpecYieldBt(); - logger.info("******9钢板轧制规格对应收得率基准表数据获取完毕*******"); +// logger.info("******9钢板轧制规格对应收得率基准表数据获取完毕*******"); return null; }); //10强度级别对照基准表 tasks.add(() -> { plistPmStCodeBtDO = subService.getPmStCodeBt(); - logger.info("******10强度级别对照基准表数据获取完毕*******"); +// logger.info("******10强度级别对照基准表数据获取完毕*******"); return null; }); //11粗切位置决定基准表 tasks.add(() -> { plistPmCutPlaceBtDO = subService.getPmCutPlaceBt(); - logger.info("******11粗切位置决定基准表数据获取完毕*******"); +// logger.info("******11粗切位置决定基准表数据获取完毕*******"); return null; }); //12组板常数基准表 tasks.add(() -> { plistPmPdConstBtDO = subService.getPmPdConstBt(); - logger.info("******12组板常数基准表数据获取完毕*******"); +// logger.info("******12组板常数基准表数据获取完毕*******"); return null; }); //13钢板切缝切头尾范围基准表 tasks.add(() -> { plistPmPlateCutLenBtDO = subService.getPmPlateCutLenBt(); - logger.info("******13钢板切缝切头尾范围基准表数据获取完毕*******"); +// logger.info("******13钢板切缝切头尾范围基准表数据获取完毕*******"); return null; }); //14组板临时收得率基准表 tasks.add(() -> { plistPmPdTmpYieldBtDO = subService.getPmPdTmpYieldBt(); - logger.info("******14组板临时收得率基准表数据获取完毕*******"); +// logger.info("******14组板临时收得率基准表数据获取完毕*******"); return null; }); //15钢板切边量基准表 tasks.add(() -> { plistPmPlateTrimBtDO = subService.getPmPlateTrimBt(); - logger.info("******15钢板切边量基准表数据获取完毕*******"); +// logger.info("******15钢板切边量基准表数据获取完毕*******"); return null; }); //16余材组板内部钢种以优充次对照表 tasks.add(() -> { plistPmSlabReplBtDO = subService.getPmSlabReplBt(); - logger.info("******16余材组板内部钢种以优充次对照表数据获取完毕*******"); +// logger.info("******16余材组板内部钢种以优充次对照表数据获取完毕*******"); return null; }); //17热处理炉基准规格表 tasks.add(() -> { plistPmHeatTreatFurnaceBtDO = subService.getPmHeatTreatFurnaceBt(); - logger.info("******17热处理炉基准规格表数据获取完毕*******"); +// logger.info("******17热处理炉基准规格表数据获取完毕*******"); return null; }); //18特殊钢种余量增加表 tasks.add(() -> { plistPmSpeStAddvBtDO = subService.getPmSpeStAddvBt(); - logger.info("******18特殊钢种余量增加表数据获取完毕*******"); +// logger.info("******18特殊钢种余量增加表数据获取完毕*******"); return null; }); //19合同处理成分结果数据 tasks.add(() -> { plistQdToLineupResultCheDO = subService.getQdToLineupResultChe(); - logger.info("******19合同处理成分结果数据获取完毕*******"); +// logger.info("******19合同处理成分结果数据获取完毕*******"); return null; }); //20合同处理坯料性能要求 tasks.add(() -> { plistQdToLineupResultSlabphyDO = subService.getQdToLineupResultSlabphy(); - logger.info("******20合同处理坯料性能要求数据获取完毕*******"); +// logger.info("******20合同处理坯料性能要求数据获取完毕*******"); return null; }); //21炉次工序成分代表实绩表 tasks.add(() -> { plistQeTqHeatcheStandResultDO = subService.getQeTqHeatcheStandResult(); - logger.info("******21炉次工序成分代表实绩表数据获取完毕*******"); +// logger.info("******21炉次工序成分代表实绩表数据获取完毕*******"); return null; }); //22炉次待委托表 tasks.add(() -> { plistQeTqPonoWaitTestDO = subService.getQeTqPonoWaitTest(); - logger.info("******22炉次待委托表数据获取完毕*******"); +// logger.info("******22炉次待委托表数据获取完毕*******"); return null; }); //23坯料低倍委托实绩表 tasks.add(() -> { plistQeTqSlabMacroResultDO = subService.getQeTqSlabMacroResult(); - logger.info("******23坯料低倍委托实绩表数据获取完毕*******"); +// logger.info("******23坯料低倍委托实绩表数据获取完毕*******"); return null; }); @@ -461,6 +458,26 @@ public class SubController { //存在订单,添加可计算分组 if (GCG.getLtInfoGPreOrder().size() > 0) { + +// GCG.getLtInfoGPreOrder().stream().filter(e->e.) + //最大宽度 + OptionalInt maxWidth = GCG.getLtInfoGPreOrder().stream() + .mapToInt(GPreOrder::getWid) + .max(); + //最大宽度余量 + OptionalInt maxAddWidth = GCG.getLtInfoGPreOrder().stream() + .mapToInt(GPreOrder::getWid) + .max(); + //最大厚度公差最小值 + Optional maxTolThkMin = GCG.getLtInfoGPreOrder().stream() + .map(GPreOrder::getThickTolMin) + .reduce(BigDecimal::max); + + int intWid = maxWidth.orElse(0); + BigDecimal decThk = maxThk.orElse(BigDecimal.ZERO); + + + gltGCalGrp.add(GCG); } @@ -486,6 +503,7 @@ public class SubController { } //订单要求化学成分 + logger.info("化学成分订单号:"+GrpOrd.getOrderNo()); List ltLrc = new ArrayList<>(); 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()); @@ -502,7 +520,7 @@ public class SubController { boolean blnChk = ltLrc.stream().anyMatch(p -> { if (!ltQthsr.stream().anyMatch(e -> e.getElm().equals(p.getElm()) && (e.getTestOriginalResult().compareTo(NumberUtils.createBigDecimal(p.getElmMin())) >= 0 - && e.getTestOriginalResult().compareTo(NumberUtils.createBigDecimal(p.getElmMax())) >= 0))) { + && e.getTestOriginalResult().compareTo(NumberUtils.createBigDecimal(p.getElmMax())) <= 0))) { return false; } return true; @@ -1045,7 +1063,7 @@ public class SubController { //endregion - //region 单线程 调试用 + //region 单线程 调试用 // if (gltOrder.size() > 0) { // for (GPreOrder p : gltOrder) { // boolean found = false; @@ -1088,48 +1106,48 @@ public class SubController { } - public void SetGroupCalRslt(SlabInfoDO SInfo){ + public void SetGroupCalRslt(SlabInfoDO SInfo) { //轧机最大长度 - int intRollMaxLen = plistPmPdConstBtDO.stream().filter(p->p.getRollLineNo()=="30").findFirst().orElse(null).getHpmMaxPLen().intValue(); + int intRollMaxLen = plistPmPdConstBtDO.stream().filter(p -> p.getRollLineNo().equals("30")).findFirst().orElse(null).getHpmMaxPLen().intValue(); //轧机最小长度 - int intRollMinLen = plistPmPdConstBtDO.stream().filter(p->p.getRollLineNo()=="30").findFirst().orElse(null).getHpmMinPLen().intValue(); + int intRollMinLen = plistPmPdConstBtDO.stream().filter(p -> p.getRollLineNo().equals("30")).findFirst().orElse(null).getHpmMinPLen().intValue(); - gltGCalGrp.parallelStream().forEach(e->{ +// gltGCalGrp.parallelStream().forEach(e->{ + gltGCalGrp.forEach(e -> { //实例化计算结果数组 - GGrpCalRslt GGCR=new GGrpCalRslt(); + GGrpCalRslt GGCR = new GGrpCalRslt(); //可轧制最大长度 - int intMaxLen =0; + int intMaxLen = 0; //轧制最大宽度 - int intWid= e.getWid(); + int intWid = e.getWid(); //轧制最大厚度 BigDecimal intThk = e.getThk(); //板坯长度 - int intSlabLen =SInfo.getSlabActLen().intValue(); + int intSlabLen = SInfo.getSlabActLen().intValue(); //判断可轧制最大长度 TODO:厚度计算Decimal取整计算,会有误差,后续判断误差值修正计算 - if ((BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).compareTo(BigDecimal.valueOf(intRollMaxLen))>0 ){ - intMaxLen=intRollMaxLen; - }else { - intMaxLen=(BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).intValue(); + if ((BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).compareTo(BigDecimal.valueOf(intRollMaxLen)) > 0) { + intMaxLen = intRollMaxLen; + } else { + intMaxLen = (BigDecimal.valueOf(intSlabLen).divide(intThk.multiply(BigDecimal.valueOf(intWid)), RoundingMode.HALF_UP)).intValue(); } //不能小于可轧制的最小长度 - if (intMaxLen{ - +// gltGGrpCalRslt.parallelStream().forEach(p -> { + gltGGrpCalRslt.forEach(p -> { // 测试数据 // 生成 values 和 weights 数组 @@ -1137,8 +1155,8 @@ public class SubController { long[][] weights = new long[0][p.getLtInfoGPreOrder().size()]; for (int i = 0; i < p.getLtInfoGPreOrder().size(); i++) { - values[i] = p.getLtInfoGPreOrder().get(i).getIDValue(); // 从订单中获取 value - weights[0][i] = (long)p.getLtInfoGPreOrder().get(i).getInfoPmProContProdAttrDO().getOrderLen()+5; // 从订单中获取 weights + values[i] = p.getLtInfoGPreOrder().get(i).getIDValue(); // 从订单中获取 value + weights[0][i] = (long) p.getLtInfoGPreOrder().get(i).getInfoPmProContProdAttrDO().getOrderLen() + 5; // 从订单中获取 weights } //是否展宽 @@ -1150,22 +1168,22 @@ public class SubController { //} //TODO:轧制方向,轧制模式 没有其他值暂不考虑,之后数据完善后需要考虑 - PmPlateCutLenBtDO PPCLB = plistPmPlateCutLenBtDO.stream(). - filter(f -> f.getMscLineNo() == "1030" - && f.getBrrNeed() ==((p.getCal_Wid()>SInfo.getSlabActWid().intValue())?"1":"0") - && f.getPlateThickFrom().compareTo(p.getCal_Thk())<=0 - && f.getPlateThickTo().compareTo(p.getCal_Thk())>=0 - && f.getSlabThickFrom().compareTo(SInfo.getSlabActThk())<=0 - && f.getSlabThickFrom().compareTo(SInfo.getSlabActThk())>=0 - && f.getCombinePlateWidthFrom().compareTo(BigDecimal.valueOf(p.getCal_Wid()))<=0 - && f.getCombinePlateWidthTo().compareTo(BigDecimal.valueOf(p.getCal_Wid()))<=0 - ).findFirst().orElse(null); + PmPlateCutLenBtDO PPCLB = plistPmPlateCutLenBtDO.stream(). + filter(f -> f.getMscLineNo().equals("1030") + && f.getBrrNeed().equals((p.getCal_Wid() > SInfo.getSlabActWid().intValue()) ? "1" : "0") + && f.getPlateThickFrom().compareTo(p.getCal_Thk()) <= 0 + && f.getPlateThickTo().compareTo(p.getCal_Thk()) >= 0 + && f.getSlabThickFrom().compareTo(SInfo.getSlabActThk()) <= 0 + && f.getSlabThickFrom().compareTo(SInfo.getSlabActThk()) >= 0 + && f.getCombinePlateWidthFrom().compareTo(BigDecimal.valueOf(p.getCal_Wid())) <= 0 + && f.getCombinePlateWidthTo().compareTo(BigDecimal.valueOf(p.getCal_Wid())) <= 0 + ).findFirst().orElse(null); //切头 int intHead = PPCLB.getHeadCut().intValue(); //切尾 - int intTail=PPCLB.getTailCut().intValue(); + int intTail = PPCLB.getTailCut().intValue(); //去掉切头尾长度 - int intCap =p.getCal_Len()-intHead-intTail; + int intCap = p.getCal_Len() - intHead - intTail; long[] capacities = {intCap}; @@ -1180,15 +1198,14 @@ public class SubController { //实例化实际订单号 p.setLtActInfoGPreOrder(new ArrayList<>()); - int indexi=i; - p.getLtActInfoGPreOrder().add(p.getLtInfoGPreOrder().stream().filter(m-> m.getIDValue()== ltInt.get(indexi)).collect(Collectors.toList()).get(0)); + int indexi = i; + p.getLtActInfoGPreOrder().add(p.getLtInfoGPreOrder().stream().filter(m -> m.getIDValue() == ltInt.get(indexi)).collect(Collectors.toList()).get(0)); } //根据实际订单再计算 - }); } 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 dad09b1..3f69520 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 @@ -16,6 +16,15 @@ public class GGrpCalRslt { //虚拟号 private String VirtualSlabNo; + //虚拟板坯长度 + private int VirtualSlab_Len; + + //虚拟板坯宽度 + private int VirtualSlab_Wid; + + //虚拟板坯厚度 + private BigDecimal VirtualSlab_Thk; + //宽度 private int Cal_Wid; //厚度 diff --git a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GPreOrder.java b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GPreOrder.java index acbbbd0..daaee99 100644 --- a/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GPreOrder.java +++ b/1024shop-manager/1024shop-manager/src/main/java/net/xdclass/shopmanager/model/GPreOrder.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; import java.util.List; @Data @@ -19,6 +20,21 @@ public class GPreOrder { //实际长度 private Integer intActLen; + //宽度 + private int Wid; + + //厚度 + private BigDecimal Thk; + + //长度 + private int Len; + + // 厚度公差上限 + private BigDecimal thickTolMax; + + //厚度公差下限 + private BigDecimal thickTolMin; + //合同信息 private PmProContDO infoPmProContDo;