|
@@ -234,6 +234,10 @@ public class ApsConstraintListProvider implements ConstraintProvider {
|
|
|
}
|
|
|
if(deliveryMinDate == null){
|
|
|
return false;
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getApsOverallConfig().getStartTime().atZone(zoneId).toInstant().toEpochMilli()>deliveryMinDate.getTime()){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
Boolean bol = productionProcesses.getEndTime().atZone(zoneId).toInstant().toEpochMilli()>deliveryMinDate.getTime();
|
|
|
return bol;
|
|
@@ -254,7 +258,7 @@ public class ApsConstraintListProvider implements ConstraintProvider {
|
|
|
int aa = 0;
|
|
|
}
|
|
|
return i;*/
|
|
|
- return 100;
|
|
|
+ return 1000;
|
|
|
})
|
|
|
.asConstraint("deliveryDate");
|
|
|
}
|
|
@@ -344,18 +348,35 @@ public class ApsConstraintListProvider implements ConstraintProvider {
|
|
|
.penalize(HardMediumSoftScore.ONE_MEDIUM,(equipment) -> {
|
|
|
int b = 0;
|
|
|
List<ProductionProcessesTa> tasks = new ArrayList<>();
|
|
|
- tasks.addAll(equipment.getTasks());
|
|
|
|
|
|
- if(tasks != null && tasks.size()>1){
|
|
|
+ if(equipment.getTasks() != null && equipment.getTasks().size()>0){
|
|
|
+ if(equipment.getLastProcessEndTime() != null){
|
|
|
+ ProductionProcessesTa pta = new ProductionProcessesTa();
|
|
|
+ LocalDateTime eqlastTime = equipment.getLastProcessEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime startTime = equipment.getTasks().get(0).getApsOverallConfig().getStartTime();
|
|
|
+ if(startTime.compareTo(eqlastTime)>0){
|
|
|
+ pta.setStartTime(startTime.plusMinutes(-10));
|
|
|
+ pta.setEndTime(startTime);
|
|
|
+ }else{
|
|
|
+ pta.setStartTime(eqlastTime.plusMinutes(-10));
|
|
|
+ pta.setEndTime(eqlastTime);
|
|
|
+ }
|
|
|
+ tasks.add(pta);
|
|
|
+ }
|
|
|
+ tasks.addAll(equipment.getTasks());
|
|
|
+
|
|
|
// 根据开始时间排序
|
|
|
- Collections.sort(tasks, Comparator.comparing(ProductionProcessesTa::getStartTime));
|
|
|
- for (int i = 0; i < tasks.size()-1; i++) {
|
|
|
- ProductionProcessesTa preTask = tasks.get(i);
|
|
|
- ProductionProcessesTa nextTask = tasks.get(i + 1);
|
|
|
- if(preTask.getEndTime().plusMinutes(60).compareTo(nextTask.getStartTime())<0){
|
|
|
- b = b + 20;
|
|
|
+ if(tasks.size()>1){
|
|
|
+ Collections.sort(tasks, Comparator.comparing(ProductionProcessesTa::getStartTime));
|
|
|
+ for (int i = 0; i < tasks.size()-1; i++) {
|
|
|
+ ProductionProcessesTa preTask = tasks.get(i);
|
|
|
+ ProductionProcessesTa nextTask = tasks.get(i + 1);
|
|
|
+ if(preTask.getEndTime().plusMinutes(60).compareTo(nextTask.getStartTime())<0){
|
|
|
+ b = b + 100;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
return b;
|
|
|
})
|
|
@@ -467,9 +488,7 @@ public class ApsConstraintListProvider implements ConstraintProvider {
|
|
|
if(hasStartTimeProcess.get(i).getId() == null){
|
|
|
continue;
|
|
|
}else{
|
|
|
- if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
|
|
|
-// b = b+15;
|
|
|
- }else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
+ if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
b = b+10;
|
|
|
}else if ("箔轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
b = b+5;
|
|
@@ -483,85 +502,7 @@ public class ApsConstraintListProvider implements ConstraintProvider {
|
|
|
if(hasStartTimeProcess.get(i).getSeriesProduceMark() != null && hasStartTimeProcess.get(i+1).getSeriesProduceMark() != null){
|
|
|
Map<String, String> conflictRoptions1 = hasStartTimeProcess.get(i).getConflictRoptions();
|
|
|
Map<String, String> conflictRoptions2 = hasStartTimeProcess.get(i+1).getConflictRoptions();
|
|
|
- if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
|
|
|
- if(hasStartTimeProcess.get(i+1).getId() == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- 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(zqlb.compareTo(new BigDecimal("0")) == 0){
|
|
|
- if(hasStartTimeProcess.get(i).getLastSerialLbWeight() != null){
|
|
|
- zqlb = hasStartTimeProcess.get(i).getLastSerialLbWeight();
|
|
|
- }else{
|
|
|
- zqlb = hasStartTimeProcess.get(i).getSinglerollweight();
|
|
|
- }
|
|
|
- }else{
|
|
|
- zqlb = zqlb.add(hasStartTimeProcess.get(i).getSinglerollweight());
|
|
|
- }
|
|
|
- // 铸轧立板是否连续
|
|
|
- boolean lbserice = true;
|
|
|
- if(serspre.length == 5 && sersafter.length == 5){
|
|
|
- // 铸轧换辊兼容规则
|
|
|
- if(!zzSeriesJr(hasStartTimeProcess.get(i),hasStartTimeProcess.get(i+1),apsNochangeRollerDos)){
|
|
|
- b = b+15;
|
|
|
- if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
- conflictRoptions1.put("soft-seriesProduceZz",conflictRoptions1.get("soft-seriesProduceZz") == null ? "和后一道工序违反换辊和立板的连续约束" : conflictRoptions1.get("soft-seriesProduceZz")+";和后一道工序违反换辊和立板的连续约束");
|
|
|
- }else{
|
|
|
- conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反换辊和立板的连续约束");
|
|
|
- }
|
|
|
- zqlb = new BigDecimal("0");
|
|
|
- lbserice = false;
|
|
|
- }else{
|
|
|
- // 合金相同情况下后面的宽度大于前面的宽度需要换辊和立板
|
|
|
- // 合金相同情况下后面的宽度小于前面的宽度需要立板
|
|
|
- // 合金相同情况下后面的宽度等于前面的宽度换辊和立板都不需要
|
|
|
- String s1 = serspre[2];
|
|
|
- String s2 = sersafter[2];
|
|
|
- try{
|
|
|
- BigDecimal i1 = new BigDecimal(s1);
|
|
|
- BigDecimal i2 = new BigDecimal(s2);
|
|
|
- if(i1.compareTo(i2)<0){
|
|
|
- b = b+15;
|
|
|
- if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
- conflictRoptions1.put("soft-seriesProduceZz",conflictRoptions1.get("soft-seriesProduceZz") == null ? "和后一道工序违反换辊和立板的连续约束" : conflictRoptions1.get("soft-seriesProduceZz")+";和后一道工序违反换辊和立板的连续约束");
|
|
|
- }else{
|
|
|
- conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反换辊和立板的连续约束");
|
|
|
- }
|
|
|
- zqlb = new BigDecimal("0");
|
|
|
- lbserice = false;
|
|
|
- }else if(i1.compareTo(i2)>0){
|
|
|
- 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","和前一道工序违反立板的连续约束");
|
|
|
- }
|
|
|
- zqlb = new BigDecimal("0");
|
|
|
- lbserice = false;
|
|
|
- }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","和前一道工序违反立板的连续约束");
|
|
|
- }
|
|
|
- zqlb = new BigDecimal("0");
|
|
|
- lbserice = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType()) || "箔轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
+ if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType()) || "箔轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
ProductionProcessesTa prepro = hasStartTimeProcess.get(i);
|
|
|
ProductionProcessesTa nextpro = hasStartTimeProcess.get(i+1);
|
|
|
String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
|
|
@@ -702,31 +643,6 @@ public class ApsConstraintListProvider 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","和前一道工序违反换辊的连续约束");
|
|
|
- }
|
|
|
- } else if (volumeWidth.compareTo(volumeWidth1)<0) {
|
|
|
- b = b+1;
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|
|
|
}
|
|
|
}
|