fangpy 10 ヶ月 前
コミット
f8e972bdf4

+ 5 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/domain/ProduceOrder.java

@@ -29,6 +29,11 @@ public class ProduceOrder implements Serializable {
      */
     private String orderName;
 
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
     /**
      * 交货日期
      */

+ 15 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/domain/ProductionProcesses.java

@@ -123,6 +123,11 @@ public class ProductionProcesses implements Serializable {
      */
     private String processType;
 
+    /**
+     * 工序名称
+     */
+    private String processName;
+
     /**
      * 所属的生产订单
      */
@@ -415,6 +420,8 @@ public class ProductionProcesses implements Serializable {
                 maxDelay = 2000;
             } else if (this.processType.equals("冷轧")) {
                 maxDelay = 2000;
+            }else if (this.processType.equals("箔轧")) {
+                maxDelay = 5000;
             } else{
                 maxDelay = 1000;
             }
@@ -951,6 +958,14 @@ public class ProductionProcesses implements Serializable {
         this.maxheatroll = maxheatroll;
     }
 
+    public String getProcessName() {
+        return processName;
+    }
+
+    public void setProcessName(String processName) {
+        this.processName = processName;
+    }
+
     public String getSeriSort(){
         String sortStr = this.getId();
         if(this.getStartTime() != null){

+ 51 - 7
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/score/ApsConstraintProvider.java

@@ -26,10 +26,10 @@ public class ApsConstraintProvider implements ConstraintProvider {
     public Constraint[] defineConstraints(ConstraintFactory constraintFactory) {
         return new Constraint[]{
                 // HARD
-//                hasOnePreGbAfterNowNew(constraintFactory),
-//                nextLockProNew(constraintFactory),
-                hasOnePreGbAfterNow(constraintFactory),
-                nextLockPro(constraintFactory),
+                hasOnePreGbAfterNowNew(constraintFactory),
+                nextLockProNew(constraintFactory),
+//                hasOnePreGbAfterNow(constraintFactory),
+//                nextLockPro(constraintFactory),
                 eqTimeCross(constraintFactory),
                 seriesProduceTimeWait(constraintFactory),
                 seriesProduceWashTimeWait(constraintFactory),
@@ -38,7 +38,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
                 eqTimeCrossMinTuihuo(constraintFactory),
 //                twoLineZz(constraintFactory),
                 // MEDIUM
-//                deliveryDate(constraintFactory),
+                deliveryDate(constraintFactory),
                 expecteddays(constraintFactory),
                 seriesProduce(constraintFactory),
                 seriesProduceWashingFurnace(constraintFactory),
@@ -945,6 +945,28 @@ public class ApsConstraintProvider implements ConstraintProvider {
                             }
                         }
                     }
+                }else if ("箔轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
+                    // 宽度从大到小
+                    String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
+                    String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
+                    if(serspre.length == 5 && sersafter.length == 5){
+                        String s1 = serspre[2];
+                        String s2 = sersafter[2];
+                        try {
+                            BigDecimal volumeWidth = new BigDecimal(s1);
+                            BigDecimal volumeWidth1 = new BigDecimal(s2);
+                            if(volumeWidth.compareTo(volumeWidth1)<0){
+                                if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(hasStartTimeProcess.get(i).getCutfinishmin())
+                                        .plusMinutes(hasStartTimeProcess.get(i+1).getPrepressworkmin()).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
+                                    b++;
+                                    conflictRoptions1.put("hard-seriesProduceTimeWait","和下道工序没有预留足够的上机准备时间和下机收尾时间");
+                                    conflictRoptions2.put("hard-seriesProduceTimeWait","和上道工序没有预留足够的上机准备时间和下机收尾时间");
+                                }
+                            }
+                        }catch (Exception e){
+                            e.printStackTrace();
+                        }
+                    }
                 }
             }
         }
@@ -1561,7 +1583,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
                     Long expecteddays = expecteddaysCount(productionProcesses);
                     return (int)(expecteddays*10000);
                 })
-                .asConstraint("deliveryDate");
+                .asConstraint("expecteddays");
     }
 
     private Long expecteddaysCount(ProductionProcesses productionProcesses){
@@ -1678,7 +1700,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
      */
     private Constraint seriesProduce(ConstraintFactory constraintFactory){
         return constraintFactory.forEach(ProductionProcesses.class)
-                .filter((processes) -> "铸轧".equals(processes.getProcessType()) || "冷轧".equals(processes.getProcessType()))
+                .filter((processes) -> "铸轧".equals(processes.getProcessType()) || "冷轧".equals(processes.getProcessType()) || "箔轧".equals(processes.getProcessType()))
                 .groupBy(ProductionProcesses::getEquipmentId, ConstraintCollectors.toList())
                 .filter((equipmentId,processes) -> {
                     if(processes != null && processes.size()>0){
@@ -1880,6 +1902,28 @@ public class ApsConstraintProvider implements ConstraintProvider {
                                 }
                             }
                         }
+                    }else if ("箔轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
+                        // 宽度从大到小
+                        String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
+                        String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
+                        if(serspre.length == 5 && sersafter.length == 5){
+                            String s1 = serspre[2];
+                            String s2 = sersafter[2];
+                            try {
+                                BigDecimal volumeWidth = new BigDecimal(s1);
+                                BigDecimal volumeWidth1 = new BigDecimal(s2);
+                                if(volumeWidth.compareTo(volumeWidth1)<0){
+                                    b = b+5;
+                                    if(hasStartTimeProcess.get(i).getId() != null){
+                                        conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
+                                    }else{
+                                        conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
+                                    }
+                                }
+                            }catch (Exception e){
+                                e.printStackTrace();
+                            }
+                        }
                     }
                 }
             }

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

@@ -121,6 +121,17 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
         List<ProductionProcesses> otherThproces = new ArrayList<>();
         List<ProductionProcesses> otherNotThproces = new ArrayList<>();
         ApsSolution apsSolution = getPreApsSolution(productionScheduleVo,otherThproces);
+        // 判断是否有非锁定的工序
+        boolean hasSchedulePro = false;
+        for (ProductionProcesses productionProcesses : apsSolution.getProcessesList()) {
+            if(!productionProcesses.getIfLock()){
+                hasSchedulePro = true;
+                break;
+            }
+        }
+        if(!hasSchedulePro){
+            throw new ApsException("没有可排程的工序");
+        }
         //非铸轧第一道工序,提前排程
         List<ProductionProcesses> otherNotZzFirstProces = new ArrayList<>();
         // 铸轧提前排序
@@ -181,9 +192,9 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
                 }
             }
         }
-        if(notLocks.size() == 0){
-            throw new ApsException("没有可排程的工序");
-        }
+//        if(notLocks.size() == 0){
+//
+//        }
         apsSolution.setProcessesList(notLocks);
         ApsSolution solvedBalance = solver.solve(apsSolution);
         log.info("**************排程评分分析***************");
@@ -901,7 +912,7 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
                     }
                 }
                 if(providedEq.size() == 0){
-                    throw new ApsException("500","作业ID:"+ process.getBsProcessesId().get(0) + "可选设备不能为空");
+                    throw new ApsException("500","坯料计划号:"+process.getProduceOrder().get(0).getOrderNo()+"作业名称:"+ process.getProcessName() + ",可选设备不能为空");
                 }
                 process.setOptionalProviderEquipments(providedEq);
             }

+ 1 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/util/ApsConstants.java

@@ -23,6 +23,7 @@ public class ApsConstants {
         constraintDesc.put("nextLockPro","与下道工序开始时间不符合规则");
 //        constraintDesc.put("seriesProduceTimeWait","没有预留足够的上机准备时间和下机收尾时间");
         constraintDesc.put("deliveryDate","不满足订单交货期");
+        constraintDesc.put("expecteddays","不满足铸轧外工序交货天数");
 //        constraintDesc.put("seriesProduce","与上道工序作业不能连续生产");
 
         hardConstraint.add("eqTypeSame");