Browse Source

排程优化-退火合并优化

fangpy 9 months ago
parent
commit
2c34af65c6

+ 8 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/domain/ApsOverallConfig.java

@@ -79,5 +79,13 @@ public class ApsOverallConfig implements Serializable {
      * 成退组炉宽差,默认:200mm
      */
     private Integer furnacedifference;
+    /**
+     * 中退组炉卷重差(吨)
+     */
+    private BigDecimal weightdifference;
+    /**
+     * 成退组炉卷重差(吨)
+     */
+    private BigDecimal midweightdifference;
 
 }

+ 12 - 2
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/listener/TaskStartTimeListener.java

@@ -568,6 +568,16 @@ public class TaskStartTimeListener implements VariableListener<ApsSolution, Prod
                     if(process.getApsOverallConfig().getFurnacedifference() != null && process.getApsOverallConfig().getFurnacedifference()>0){
                         ctkc = new BigDecimal(process.getApsOverallConfig().getFurnacedifference());
                     }
+                    // 读取配置中的卷重差
+                    BigDecimal ztjzc = new BigDecimal("4");
+                    BigDecimal ctjzc = new BigDecimal("2");
+                    if(process.getApsOverallConfig().getWeightdifference() != null){
+                        ztjzc = process.getApsOverallConfig().getWeightdifference();
+                    }
+                    if(process.getApsOverallConfig().getMidweightdifference() != null){
+                        ctjzc = process.getApsOverallConfig().getMidweightdifference();
+                    }
+
                     BigDecimal zthc = new BigDecimal("0.05");
                     BigDecimal cthc = new BigDecimal("0.05");
                     List<ApsAnnealingDifferenceDo> apsAnnealingDifferences = process.getApsOverallConfig().getApsAnnealingDifferences();
@@ -608,11 +618,11 @@ public class TaskStartTimeListener implements VariableListener<ApsSolution, Prod
                     if("成退".equals(process.getProcessType())){
                         btVolumeWidth = ctkc;
                         btVolumeThickness = cthc;
-                        btSinglerollweight = new BigDecimal("1");
+                        btSinglerollweight = ctjzc;
                     }else if ("中退".equals(process.getProcessType())){
                         btVolumeWidth = ztkc;
                         btVolumeThickness = zthc;
-                        btSinglerollweight = new BigDecimal("1");
+                        btSinglerollweight = ztjzc;
                     }
                     if(maxVolumeWidth.subtract(minVolumeWidth).compareTo(btVolumeWidth)<=0 && maxVolumeThickness.subtract(minVolumeThickness).compareTo(btVolumeThickness)<=0
                             && maxSinglerollweight.subtract(minSinglerollweight).compareTo(btSinglerollweight)<=0){

+ 29 - 2
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/score/ApsConstraintProvider.java

@@ -225,6 +225,9 @@ public class ApsConstraintProvider implements ConstraintProvider {
     private Constraint nextLockProNew(ConstraintFactory constraintFactory) {
         return constraintFactory.forEach(ProductionProcesses.class)
                 .filter(productionProcesses -> {
+                    if(productionProcesses.getId().equals("d6ea246661804ca5982b81b9a691a34e")){
+                        int a1 = 0;
+                    }
                     boolean bln = false;
                     List<ProductionProcesses> nextProcesses = productionProcesses.getNextProcesses();
                     if(nextProcesses != null && nextProcesses.size()>0){
@@ -1540,6 +1543,16 @@ public class ApsConstraintProvider implements ConstraintProvider {
                 if(processes.get(0).getApsOverallConfig().getFurnacedifference() != null && processes.get(0).getApsOverallConfig().getFurnacedifference()>0){
                     ctkc = new BigDecimal(processes.get(0).getApsOverallConfig().getFurnacedifference());
                 }
+                // 读取配置中的卷重差
+                BigDecimal ztjzc = new BigDecimal("4");
+                BigDecimal ctjzc = new BigDecimal("2");
+                if(processes.get(0).getApsOverallConfig().getWeightdifference() != null){
+                    ztjzc = processes.get(0).getApsOverallConfig().getWeightdifference();
+                }
+                if(processes.get(0).getApsOverallConfig().getMidweightdifference() != null){
+                    ctjzc = processes.get(0).getApsOverallConfig().getMidweightdifference();
+                }
+
                 BigDecimal zthc = new BigDecimal("0.05");
                 BigDecimal cthc = new BigDecimal("0.05");
                 List<ApsAnnealingDifferenceDo> apsAnnealingDifferences = processes.get(0).getApsOverallConfig().getApsAnnealingDifferences();
@@ -1577,11 +1590,11 @@ public class ApsConstraintProvider implements ConstraintProvider {
                 if("成退".equals(processType)){
                     btVolumeWidth = ctkc;
                     btVolumeThickness = cthc;
-                    btSinglerollweight = new BigDecimal("1");
+                    btSinglerollweight = ctjzc;
                 }else if ("中退".equals(processType)){
                     btVolumeWidth = ztkc;
                     btVolumeThickness = zthc;
-                    btSinglerollweight = new BigDecimal("1");
+                    btSinglerollweight = ztjzc;
                 }
                 if(maxVolumeWidth.subtract(minVolumeWidth).compareTo(btVolumeWidth)>0 || maxVolumeThickness.subtract(minVolumeThickness).compareTo(btVolumeThickness)>0
                         || maxSinglerollweight.subtract(minSinglerollweight).compareTo(btSinglerollweight)>0){
@@ -1906,6 +1919,10 @@ public class ApsConstraintProvider implements ConstraintProvider {
                         if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
                             String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
                             String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
+                            // 获取产品类型二级
+                            String bfcplx = serspre[1].split("-")[0];
+                            // 获取产品类型二级
+                            String afcplx = sersafter[1].split("-")[0];
                             if(serspre.length == 5 && sersafter.length == 5){
                                 // 铸轧换辊兼容规则
                                 if(!zzSeriesJr(hasStartTimeProcess.get(i),hasStartTimeProcess.get(i+1),apsNochangeRollerDos)){
@@ -1938,6 +1955,16 @@ public class ApsConstraintProvider implements ConstraintProvider {
                                             }else{
                                                 conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反立板的连续约束");
                                             }
+                                        }else{
+                                            // 二级产品类型不一样的也需要立板
+                                            if(!bfcplx.equals(afcplx)){
+                                                b = b+8;
+                                                if(hasStartTimeProcess.get(i).getId() != null){
+                                                    conflictRoptions1.put("soft-seriesProduceZz",conflictRoptions1.get("soft-seriesProduceZz") == null ? "和后一道工序违反立板的连续约束" : conflictRoptions1.get("soft-seriesProduceZz")+";和后一道工序违反立板的连续约束");
+                                                }else{
+                                                    conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反立板的连续约束");
+                                                }
+                                            }
                                         }
                                     }catch (Exception e){
                                         e.printStackTrace();

+ 23 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/service/impl/ApsServiceImpl.java

@@ -287,6 +287,14 @@ public class ApsServiceImpl implements ApsService {
                             productionProcesses.setEquipment(process.getEquipment());
                             productionProcesses.setDelay(process.getDelay());
                             productionProcesses.setIfLock(true);
+                            // 前后道工序设置
+                            if(relPros.containsKey(productionProcesses.getId())){
+                                Map<String, List<ProductionProcesses>> stringListMap = relPros.get(productionProcesses.getId());
+                                productionProcesses.setPreviousProcesses(stringListMap.get("pres"));
+                                productionProcesses.setNextProcesses(stringListMap.get("nexts"));
+                            }
+                            // 递归推理前道工序
+                            proMaxTimeSet(productionProcesses,productionProcesses,0);
                         }
                     }
                 }
@@ -454,6 +462,21 @@ public class ApsServiceImpl implements ApsService {
         }*/
     }
 
+    private void proMaxTimeSet(ProductionProcesses rootPro,ProductionProcesses prePro,Integer preMins){
+        if(preMins>0){
+            prePro.setMaxStartTime(rootPro.getStartTime().minusMinutes(preMins+prePro.getProduceTime()));
+        }
+        if(prePro.getPreviousProcesses() != null && prePro.getPreviousProcesses().size()>0){
+            for (ProductionProcesses previousProcess : prePro.getPreviousProcesses()) {
+                Integer preMinsNow = preMins;
+                if(prePro.getMinWaitTime() != null && prePro.getMinWaitTime()>0){
+                    preMinsNow = preMinsNow + prePro.getMinWaitTime();
+                }
+                proMaxTimeSet(rootPro,previousProcess,preMinsNow);
+            }
+        }
+    }
+
     private void setPreOrderMark(List<ProductionProcesses> pres,Map<String,Integer> sortMap){
         List<ProductionProcesses> prepres = new ArrayList<>();
         if(pres != null && pres.size()>0){

+ 2 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/service/impl/ProductionScheduleServiceImpl.java

@@ -895,6 +895,8 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
             process.getApsOverallConfig().setApsAnnealingDifferences(productionScheduleVo.getApsAnnealingDifferences());
             process.getApsOverallConfig().setMiddifference(productionScheduleVo.getMiddifference());
             process.getApsOverallConfig().setFurnacedifference(productionScheduleVo.getFurnacedifference());
+            process.getApsOverallConfig().setWeightdifference(productionScheduleVo.getWeightdifference());
+            process.getApsOverallConfig().setMidweightdifference(productionScheduleVo.getMidweightdifference());
 
             if(StrUtil.isBlank(process.getTaskType())){
                 process.setTaskType("processes");

+ 8 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/vo/ProductionScheduleVo.java

@@ -102,5 +102,13 @@ public class ProductionScheduleVo {
      * 成退组炉宽差,默认:200mm
      */
     private Integer furnacedifference;
+    /**
+     * 中退组炉卷重差(吨)
+     */
+    private BigDecimal weightdifference;
+    /**
+     * 成退组炉卷重差(吨)
+     */
+    private BigDecimal midweightdifference;
 
 }