|
@@ -37,7 +37,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
deliveryDate(constraintFactory),
|
|
|
seriesProduce(constraintFactory),
|
|
|
seriesProduceWashingFurnace(constraintFactory),
|
|
|
- mergeTuihuo(constraintFactory),
|
|
|
+// mergeTuihuo(constraintFactory),
|
|
|
sameEquipment(constraintFactory),
|
|
|
|
|
|
sameProcessSeries(constraintFactory),
|
|
@@ -574,6 +574,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
pp.setProcessType(equipmentRunTime.getProcessType());
|
|
|
pp.setApsOverallConfig(hasStartTimeProcess.get(0).getApsOverallConfig());
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(pp);
|
|
|
}
|
|
|
}
|
|
@@ -618,6 +619,11 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
if(!processes.get(0).getProcessType().equals("铸轧") && !processes.get(0).getProcessType().equals("冷轧")){
|
|
|
return false;
|
|
|
}
|
|
|
+ for (ProductionProcesses process : processes) {
|
|
|
+ if(process.getConflictRoptions().containsKey("hard-seriesProduceTimeWait")){
|
|
|
+ process.getConflictRoptions().remove("hard-seriesProduceTimeWait");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
int counNum = seriesProduceTimeWaitCount(processes);
|
|
|
if(counNum>0){
|
|
@@ -655,6 +661,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setPrepressworkmin(equipmentRunTime.getPrepressworkmin() == null ? 0 : equipmentRunTime.getPrepressworkmin());
|
|
|
pp.setCutfinishmin(equipmentRunTime.getCutfinishmin() == null ? 0 : equipmentRunTime.getCutfinishmin());
|
|
|
pp.setApsOverallConfig(hasStartTimeProcess.get(0).getApsOverallConfig());
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(pp);
|
|
|
}
|
|
|
}
|
|
@@ -668,9 +675,17 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setCutfinishmin(equipment.getLastProcessCutfinishmin() == null ? 0 : equipment.getLastProcessCutfinishmin());
|
|
|
pp.setEndTime(equipment.getLastProcessEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime());
|
|
|
pp.setApsOverallConfig(hasStartTimeProcess.get(0).getApsOverallConfig());
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(0,pp);
|
|
|
}
|
|
|
for(int i=0;i<hasStartTimeProcess.size()-1;i++){
|
|
|
+ if(hasStartTimeProcess.get(i).getId() == null && hasStartTimeProcess.get(i).getId() == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ProductionProcesses prePro = hasStartTimeProcess.get(i);
|
|
|
+ ProductionProcesses nextPro = hasStartTimeProcess.get(i+1);
|
|
|
+ Map<String, String> conflictRoptions1 = prePro.getConflictRoptions();
|
|
|
+ Map<String, String> conflictRoptions2 = nextPro.getConflictRoptions();
|
|
|
if(hasStartTimeProcess.get(i).getSeriesProduceMark() != null && hasStartTimeProcess.get(i+1).getSeriesProduceMark() != null){
|
|
|
if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
|
|
|
if(!hasStartTimeProcess.get(i).getSeriesProduceMark().equals(hasStartTimeProcess.get(i+1).getSeriesProduceMark())){
|
|
@@ -690,6 +705,8 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
b++;
|
|
|
+ conflictRoptions1.put("hard-seriesProduceTimeWait","和下道工序没有预留足够的换辊和立板时间");
|
|
|
+ conflictRoptions2.put("hard-seriesProduceTimeWait","和上道工序没有预留足够的换辊和立板时间");
|
|
|
}
|
|
|
}else{
|
|
|
// 合金相同情况下后面的宽度大于前面的宽度需要换辊和立板
|
|
@@ -703,10 +720,14 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
if(i1.compareTo(i2)<0){
|
|
|
if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
b++;
|
|
|
+ conflictRoptions1.put("hard-seriesProduceTimeWait","和下道工序没有预留足够的换辊和立板时间");
|
|
|
+ conflictRoptions2.put("hard-seriesProduceTimeWait","和上道工序没有预留足够的换辊和立板时间");
|
|
|
}
|
|
|
}else if(i1.compareTo(i2)>0){
|
|
|
if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(standingtime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
b++;
|
|
|
+ conflictRoptions1.put("hard-seriesProduceTimeWait","和下道工序没有预留足够的立板时间");
|
|
|
+ conflictRoptions2.put("hard-seriesProduceTimeWait","和上道工序没有预留足够的立板时间");
|
|
|
}
|
|
|
}
|
|
|
}catch (Exception e){
|
|
@@ -723,6 +744,8 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
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","和上道工序没有预留足够的上机准备时间和下机收尾时间");
|
|
|
}
|
|
|
}else{
|
|
|
String s1 = serspre[2];
|
|
@@ -734,6 +757,8 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
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){
|
|
@@ -789,8 +814,13 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
return pro.getProcessType().equals("成退") || pro.getProcessType().equals("中退");
|
|
|
})
|
|
|
.groupBy(ProductionProcesses::getEquipmentId,ConstraintCollectors.toList())
|
|
|
- .filter((equipmentEquassociated,processes) -> {
|
|
|
+ .filter((equipmentId,processes) -> {
|
|
|
if(processes != null && processes.size()>0){
|
|
|
+ for (ProductionProcesses process : processes) {
|
|
|
+ if(process.getConflictRoptions().containsKey("hard-eqTimeCrossTuihuo")){
|
|
|
+ process.getConflictRoptions().remove("hard-eqTimeCrossTuihuo");
|
|
|
+ }
|
|
|
+ }
|
|
|
Integer num = eqTimeCrossTuihuoCount(processes,"1");
|
|
|
if(num>0){
|
|
|
return true;
|
|
@@ -800,7 +830,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
return false;
|
|
|
}
|
|
|
})
|
|
|
- .penalize(HardMediumSoftScore.ONE_HARD,(equipmentEquassociated,processes)->{
|
|
|
+ .penalize(HardMediumSoftScore.ONE_HARD,(equipmentId,processes)->{
|
|
|
Integer num = eqTimeCrossTuihuoCount(processes,"2");
|
|
|
return num*100;
|
|
|
})
|
|
@@ -830,6 +860,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setBsProcessesId(Arrays.asList(new String[]{"haspcprocess"}));
|
|
|
pp.setVolumeWidth(equipmentRunTime.getTotalVolumeWidth());
|
|
|
pp.setSinglerollweight(equipmentRunTime.getTotalSinglerollweight());
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
if(equipmentRunTime.getOccupyType().equals("process")){
|
|
|
pp.setTaskType("processes");
|
|
|
}else {
|
|
@@ -847,12 +878,6 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
ProductionProcesses nextPro = hasStartTimeProcess.get(i+1);
|
|
|
Map<String, String> conflictRoptions1 = prePro.getConflictRoptions();
|
|
|
Map<String, String> conflictRoptions2 = nextPro.getConflictRoptions();
|
|
|
- if(conflictRoptions1.containsKey("hard-eqTimeCrossTuihuo")){
|
|
|
- conflictRoptions1.remove("hard-eqTimeCrossTuihuo");
|
|
|
- }
|
|
|
- if(conflictRoptions2.containsKey("hard-eqTimeCrossTuihuo")){
|
|
|
- conflictRoptions2.remove("hard-eqTimeCrossTuihuo");
|
|
|
- }
|
|
|
// 开始时间相等为合并工序
|
|
|
if (prePro.getStartTime().compareTo(nextPro.getStartTime()) == 0){
|
|
|
if(prePro.getTaskType().equals("maintenance") || nextPro.getTaskType().equals("maintenance")){
|
|
@@ -1088,6 +1113,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setSeriesProduceMark(equipmentRunTime.getSeriesProduceMark());
|
|
|
pp.setProcessType(equipmentRunTime.getProcessType());
|
|
|
pp.setBsProcessesId(Arrays.asList(new String[]{"haspcprocess"}));
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(pp);
|
|
|
}
|
|
|
}
|
|
@@ -1100,6 +1126,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setSeriesProduceMark(equipment.getLastSeriesProduceMark());
|
|
|
pp.setProcessType(equipment.getLastProcessType());
|
|
|
pp.setBsProcessesId(Arrays.asList(new String[]{"lastprocess"}));
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(0,pp);
|
|
|
}
|
|
|
for(int i=0;i<hasStartTimeProcess.size()-1;i++){
|
|
@@ -1281,6 +1308,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
pp.setProcessType(equipmentRunTime.getProcessType());
|
|
|
pp.setApsOverallConfig(hasStartTimeProcess.get(0).getApsOverallConfig());
|
|
|
+ pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(pp);
|
|
|
}
|
|
|
}
|
|
@@ -1483,7 +1511,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
System.out.println("*********************************");
|
|
|
}*/
|
|
|
Map<String, List<ProductionProcesses>> listMap = processes.stream().collect(Collectors.groupingBy(ProductionProcesses::getEquipmentId));
|
|
|
- return listMap.size()*1000;
|
|
|
+ return listMap.size()*100;
|
|
|
})
|
|
|
.asConstraint("sameEquipment");
|
|
|
}
|