Procházet zdrojové kódy

排程优化-退火合并优化

fangpy před 7 měsíci
rodič
revize
cd336c1381

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

@@ -1783,8 +1783,9 @@ public class ApsConstraintProvider implements ConstraintProvider {
                     if(deliveryMinDate == null){
                         return false;
                     }
-                    Boolean bol = productionProcesses.getNextProcesses() == null &&
-                            productionProcesses.getEndTime().atZone(zoneId).toInstant().toEpochMilli()>deliveryMinDate.getTime();
+//                    Boolean bol = productionProcesses.getNextProcesses() == null &&
+//                            productionProcesses.getEndTime().atZone(zoneId).toInstant().toEpochMilli()>deliveryMinDate.getTime();
+                    Boolean bol = productionProcesses.getEndTime().atZone(zoneId).toInstant().toEpochMilli()>deliveryMinDate.getTime();
                     return bol;
                 })
                 .penalize(HardMediumSoftScore.ONE_MEDIUM,(productionProcesses) ->{

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

@@ -452,7 +452,7 @@ public class ApsServiceImpl implements ApsService {
                                 productionProcesses.setNextProcesses(stringListMap.get("nexts"));
                             }
                             // 递归推理前道工序
-                            proMaxTimeSet(productionProcesses,productionProcesses,0);
+//                            proMaxTimeSet(productionProcesses,productionProcesses,0);
                         }
                     }
                 }
@@ -745,7 +745,9 @@ public class ApsServiceImpl implements ApsService {
         if(pres != null && pres.size()>0){
             for (ProductionProcesses pre : pres) {
                 sortMap.put("sortInt",sortMap.get("sortInt")-1);
-                pre.setOrderMark(sortMap.get("sortInt"));
+                if(pre.getOrderMark() != null && pre.getOrderMark()>sortMap.get("sortInt")){
+                    pre.setOrderMark(sortMap.get("sortInt"));
+                }
                 if(pre.getPreviousProcesses() != null && pre.getPreviousProcesses().size()>0){
                     prepres.addAll(pre.getPreviousProcesses());
                 }

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

@@ -295,6 +295,7 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
         solvedBalance.getProcessesList().addAll(hasLocks);
         // 退火合并工序排程完拆分
         if(otherThproces != null && otherThproces.size()>0){
+            List<ProductionProcesses> otherThproce1 = new ArrayList<>();
             for (ProductionProcesses otherThproce : otherThproces) {
                 if(StrUtil.isNotBlank(otherThproce.getMergeThMainId())){
                     ProductionProcesses thpro = null;
@@ -323,18 +324,37 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
                                 }
                             }
                         }
-                        /*if(otherThproce.getPreviousProcesses() != null && otherThproce.getPreviousProcesses().size()>0){
-                            for (ProductionProcesses previousProcess : otherThproce.getPreviousProcesses()) {
-                                List<String> nextids = new ArrayList<>();
-                                nextids.add(otherThproce.getId());
-                                previousProcess.setNextProcessesIds(nextids);
-                            }
-                        }*/
                         if(thpro.getProcessType().equals("小卷成退")){
                             thpro.setMinThPcNum(thpro.getMinThPcNum()-otherThproce.getMinThPcNum());
                         }
+                    }else{
+                        otherThproce1.add(otherThproce);
                     }
+                }
+            }
+            if(otherThproce1 != null && otherThproce1.size()>0){
+                for (ProductionProcesses otherThproce : otherThproce1) {
+                    if(StrUtil.isNotBlank(otherThproce.getMergeThMainId())){
+                        ProductionProcesses thpro = null;
+                        for (ProductionProcesses productionProcesses : otherThproces) {
+                            if(productionProcesses.getId().equals(otherThproce.getMergeThMainId())){
+                                thpro = productionProcesses;
+                                break;
+                            }
+                        }
+                        if(thpro != null){
+                            otherThproce.setStartTime(thpro.getStartTime());
+                            otherThproce.setEndTime(thpro.getEndTime());
+                            otherThproce.setEquipmentId(thpro.getEquipmentId());
+                            otherThproce.setEquipment(thpro.getEquipment());
+                            otherThproce.setConflictRoptions(thpro.getConflictRoptions());
 
+                            thpro.setOpeProducePcNum(1);
+                            if(thpro.getProcessType().equals("小卷成退")){
+                                thpro.setMinThPcNum(thpro.getMinThPcNum()-otherThproce.getMinThPcNum());
+                            }
+                        }
+                    }
                 }
             }
         }