Browse Source

排程优化-退火合并优化

fangpy 6 months ago
parent
commit
759c72007f

+ 34 - 0
rw-aps-server/src/main/java/com/rongwei/rwapsserver/aps/score/ApsConstraintProvider.java

@@ -2168,6 +2168,34 @@ public class ApsConstraintProvider implements ConstraintProvider {
                             // 前后道所属作业ID
                             String processId1 = hasStartTimeProcess.get(i).getBsProcessesId().get(0);
                             String processId2 = hasStartTimeProcess.get(i+1).getBsProcessesId().get(0);
+                            // 判断原有前后两道历史工序是否连续
+                            boolean ispreafterLx = false;
+                            if(prepro.getId() == null && nextpro.getId() != null && hasStartTimeProcess.size()>i+2
+                                    && hasStartTimeProcess.get(i+2).getId() == null){
+                                ProductionProcesses nextnextpro = hasStartTimeProcess.get(i + 2);
+                                if(StrUtil.isNotBlank(prepro.getProZg()) && StrUtil.isNotBlank(nextnextpro.getProZg())){
+                                    if(prepro.getProZg().equals(nextnextpro.getProZg())){
+                                        String[] sersafterafter = nextnextpro.getSeriesProduceMark().split("\\^_\\^");
+                                        BigDecimal i3 = new BigDecimal(sersafterafter[2]);
+                                        if(i1.compareTo(i3)>=0){
+                                            ispreafterLx = true;
+                                        }
+                                    }
+                                }
+                            } else if (prepro.getId() != null && nextpro.getId() == null && i>0
+                                    && hasStartTimeProcess.get(i-1).getId() == null) {
+                                ProductionProcesses preprepro = hasStartTimeProcess.get(i-1);
+                                if(StrUtil.isNotBlank(preprepro.getProZg()) && StrUtil.isNotBlank(nextpro.getProZg())){
+                                    if(preprepro.getProZg().equals(nextpro.getProZg())){
+                                        String[] sersprepre = preprepro.getSeriesProduceMark().split("\\^_\\^");
+                                        BigDecimal i0 = new BigDecimal(sersprepre[2]);
+                                        if(i0.compareTo(i2)>=0){
+                                            ispreafterLx = true;
+                                        }
+                                    }
+                                }
+                            }
+
                             if(StrUtil.isNotBlank(prepro.getProZg()) && StrUtil.isNotBlank(nextpro.getProZg())){
                                 String preZg = prepro.getProZg();
                                 String nextZg = nextpro.getProZg();
@@ -2181,6 +2209,9 @@ public class ApsConstraintProvider implements ConstraintProvider {
                                 }else{
                                     if((i1.add(new BigDecimal("30"))).compareTo(i2)<0){
                                         b = b+8;
+                                        if(ispreafterLx){
+                                            b = b+8;
+                                        }
                                         if(hasStartTimeProcess.get(i).getId() != null){
                                             conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
                                         }else{
@@ -2188,6 +2219,9 @@ public class ApsConstraintProvider implements ConstraintProvider {
                                         }
                                     }else if(i1.compareTo(i2)<0 && (i1.add(new BigDecimal("30"))).compareTo(i2)>=0){
                                         b = b+7;
+                                        if(ispreafterLx){
+                                            b = b+8;
+                                        }
                                         if(hasStartTimeProcess.get(i).getId() != null){
                                             conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
                                         }else{

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

@@ -2168,7 +2168,17 @@ public class ApsServiceImpl implements ApsService {
         if(!hasMid.contains(rootPro.getId())){
             hasMid.add(rootPro.getId());
             List<ProductionProcesses> nextProcesses = rootPro.getNextProcesses();
-            if("否".equals(rootPro.getIssubsection()) && ("冷轧".equals(rootPro.getProcessType()) || "箔轧".equals(rootPro.getProcessType())) && !rootPro.getIfLock()){
+            // 冷轧或箔轧前后辊不一样不能合并
+            boolean issameg = true;
+            if(nextProcesses != null && nextProcesses.size()>0){
+                if(rootPro.getProZg() != null && nextProcesses.get(0).getProZg() != null){
+                    if(rootPro.getProZg().equals(nextProcesses.get(0).getProZg())){
+                        issameg = false;
+                    }
+                }
+            }
+            if("否".equals(rootPro.getIssubsection()) && ("冷轧".equals(rootPro.getProcessType()) || "箔轧".equals(rootPro.getProcessType()))
+                    && !rootPro.getIfLock() && issameg){
                 // 是否连续冷轧、箔轧
                 boolean hasSeries = false;
                 if(StrUtil.isNotBlank(seriesKey) && StrUtil.isNotBlank(protype) && protype.equals(rootPro.getProcessType())

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

@@ -252,9 +252,6 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
                     continue;
                 }
                 try{
-                    /*if(v.contains("a7be0cbf99764d00a1025e480ed8c89c")){
-                        int aa = 1/0;
-                    }*/
                     log.info("分批排程开始,当前批次坯料计划ID:"+v);
                     ApsSolution apsSolution1 = new ApsSolution();
                     apsSolution1.setStartTime(apsSolution.getStartTime());

+ 5 - 2
rw-aps-server/src/test/java/com/rongwei/rwapsserver/RwApsServerApplicationTests.java

@@ -92,8 +92,11 @@ class RwApsServerApplicationTests {
             }
         }
         syids = syids1;*/
-        String apsPlanStartDateStr = DateUtil.formatDateTime(new Date());
-        System.out.println(apsPlanStartDateStr);
+        /*String apsPlanStartDateStr = DateUtil.formatDateTime(new Date());
+        System.out.println(apsPlanStartDateStr);*/
+        List<String> aa = new ArrayList<>();
+        aa.add("1");aa.add("2");aa.add("3");
+        String a3 = aa.get(3);
     }
 
 }