|
@@ -583,7 +583,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
})
|
|
|
.penalize(HardMediumSoftScore.ONE_MEDIUM,(equipmentId,processes)->{
|
|
|
int counNum = seriesZzLbCount(processes);
|
|
|
- return counNum;
|
|
|
+ return counNum*1000;
|
|
|
})
|
|
|
.asConstraint("seriesZzLb");
|
|
|
}
|
|
@@ -591,8 +591,10 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
private int seriesZzLbCount(List<ProductionProcesses> processes){
|
|
|
int b = 0;
|
|
|
Equipment equipment = null;
|
|
|
+ List<ApsNochangeRollerDo> apsNochangeRollerDos = null;
|
|
|
if(processes != null && processes.size()>0){
|
|
|
equipment = processes.get(0).getEquipment();
|
|
|
+ apsNochangeRollerDos = processes.get(0).getApsOverallConfig().getApsNochangeRollerDos();
|
|
|
}
|
|
|
|
|
|
List<ProductionProcesses> hasStartTimeProcess = processes.stream().filter(v -> v.getStartTime() != null).collect(Collectors.toList());
|
|
@@ -672,8 +674,8 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
boolean lbserice = true;
|
|
|
if(serspre.length == 5 && sersafter.length == 5){
|
|
|
// 合金不同则需要换辊和立板
|
|
|
- if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
- if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
+ if(!zzSeriesJr(hasStartTimeProcess.get(i),hasStartTimeProcess.get(i+1),apsNochangeRollerDos)){
|
|
|
+ if(syLb.compareTo(new BigDecimal("0"))>0 && hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
// 只有存在当前排程的作业才会记录扣分数
|
|
|
if(nextPro.getId() != null){
|
|
|
b++;
|
|
@@ -692,7 +694,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
BigDecimal i1 = new BigDecimal(s1);
|
|
|
BigDecimal i2 = new BigDecimal(s2);
|
|
|
if(i1.compareTo(i2)<0){
|
|
|
- if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
+ if(syLb.compareTo(new BigDecimal("0"))>0 && hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
if(nextPro.getId() != null){
|
|
|
b++;
|
|
|
conflictRoptions2.put("soft-seriesZzLb","和上道工序没有预留足够的周期立板时间");
|
|
@@ -701,7 +703,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
zqlb = new BigDecimal("0");
|
|
|
lbserice = false;
|
|
|
}else if(i1.compareTo(i2)>0){
|
|
|
- if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(standingtime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
+ if(syLb.compareTo(new BigDecimal("0"))>0 && hasStartTimeProcess.get(i).getEndTime().plusMinutes(standingtime).plusMinutes(syLbTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
if(nextPro.getId() != null){
|
|
|
b++;
|
|
|
conflictRoptions2.put("soft-seriesZzLb","和上道工序没有预留足够的周期立板时间");
|
|
@@ -718,13 +720,13 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
// 判断是否满足立板周期连续
|
|
|
if(lbserice){
|
|
|
if(syLb.compareTo(nextPro.getSinglerollweight())<0){
|
|
|
- zqlb = new BigDecimal("0");
|
|
|
- if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(standingtime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
+// zqlb = new BigDecimal("0");
|
|
|
+ /*if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(standingtime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
if(nextPro.getId() != null){
|
|
|
b++;
|
|
|
conflictRoptions2.put("soft-seriesZzLb","和上道工序没有预留足够的周期立板时间");
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -789,8 +791,10 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
private int seriesProduceTimeWaitCount(List<ProductionProcesses> processes){
|
|
|
int b = 0;
|
|
|
Equipment equipment = null;
|
|
|
+ List<ApsNochangeRollerDo> apsNochangeRollerDos = null;
|
|
|
if(processes != null && processes.size()>0){
|
|
|
equipment = processes.get(0).getEquipment();
|
|
|
+ apsNochangeRollerDos = processes.get(0).getApsOverallConfig().getApsNochangeRollerDos();
|
|
|
}
|
|
|
if(processes.size() == 7){
|
|
|
int a = 0;
|
|
@@ -830,7 +834,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
hasStartTimeProcess.add(0,pp);
|
|
|
}
|
|
|
for(int i=0;i<hasStartTimeProcess.size()-1;i++){
|
|
|
- if(hasStartTimeProcess.get(i).getId() == null && hasStartTimeProcess.get(i).getId() == null){
|
|
|
+ if(hasStartTimeProcess.get(i).getId() == null && hasStartTimeProcess.get(i+1).getId() == null){
|
|
|
continue;
|
|
|
}
|
|
|
ProductionProcesses prePro = hasStartTimeProcess.get(i);
|
|
@@ -868,7 +872,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
if(serspre.length == 5 && sersafter.length == 5){
|
|
|
// 合金不同则需要换辊和立板
|
|
|
- if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
+ if(!zzSeriesJr(hasStartTimeProcess.get(i),hasStartTimeProcess.get(i+1),apsNochangeRollerDos)){
|
|
|
if(hasStartTimeProcess.get(i).getEndTime().plusMinutes(maxTime).compareTo(hasStartTimeProcess.get(i+1).getStartTime())>0){
|
|
|
b++;
|
|
|
conflictRoptions1.put("hard-seriesProduceTimeWait","和下道工序没有预留足够的换辊和立板时间");
|
|
@@ -1776,8 +1780,10 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
private int seriesProduceCount(List<ProductionProcesses> processes){
|
|
|
int b = 0;
|
|
|
Equipment equipment = null;
|
|
|
+ List<ApsNochangeRollerDo> apsNochangeRollerDos = null;
|
|
|
if(processes != null && processes.size()>0){
|
|
|
equipment = processes.get(0).getEquipment();
|
|
|
+ apsNochangeRollerDos = processes.get(0).getApsOverallConfig().getApsNochangeRollerDos();
|
|
|
}
|
|
|
if(equipment.getId().equals("0001be252874536843730b100056")){
|
|
|
int abc = 1;
|
|
@@ -1841,17 +1847,11 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
Map<String, String> conflictRoptions1 = hasStartTimeProcess.get(i).getConflictRoptions();
|
|
|
Map<String, String> conflictRoptions2 = hasStartTimeProcess.get(i+1).getConflictRoptions();
|
|
|
if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
|
|
|
- /*if(conflictRoptions1.containsKey("soft-seriesProduceZz")){
|
|
|
- conflictRoptions1.remove("soft-seriesProduceZz");
|
|
|
- }
|
|
|
- if(conflictRoptions2.containsKey("soft-seriesProduceZz")){
|
|
|
- conflictRoptions2.remove("soft-seriesProduceZz");
|
|
|
- }*/
|
|
|
String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
|
|
|
String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
|
|
|
if(serspre.length == 5 && sersafter.length == 5){
|
|
|
- // 合金不同或者产品类型不同则需要换辊和立板
|
|
|
- if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
+ // 铸轧换辊兼容规则
|
|
|
+ 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")+";和后一道工序违反换辊和立板的连续约束");
|
|
@@ -1888,12 +1888,6 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
}
|
|
|
} else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
- /*if(conflictRoptions1.containsKey("soft-seriesProduceLz")){
|
|
|
- conflictRoptions1.remove("soft-seriesProduceLz");
|
|
|
- }
|
|
|
- if(conflictRoptions2.containsKey("soft-seriesProduceLz")){
|
|
|
- conflictRoptions2.remove("soft-seriesProduceLz");
|
|
|
- }*/
|
|
|
String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
|
|
|
String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
|
|
|
// 前后道所属作业ID
|
|
@@ -1995,6 +1989,71 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 铸轧判断合金产品类型是否兼容
|
|
|
+ * @param beforePro
|
|
|
+ * @param afterPro
|
|
|
+ * @param apsNochangeRollerDos
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean zzSeriesJr(ProductionProcesses beforePro,ProductionProcesses afterPro,List<ApsNochangeRollerDo> apsNochangeRollerDos){
|
|
|
+ boolean ifJr = false;
|
|
|
+ String[] serspre = beforePro.getSeriesProduceMark().split("\\^_\\^");
|
|
|
+ String[] sersafter = afterPro.getSeriesProduceMark().split("\\^_\\^");
|
|
|
+ if(serspre.length == 5 && sersafter.length == 5){
|
|
|
+ // 合金和产品类型
|
|
|
+ // 前一道作业合金、产品类型
|
|
|
+ String bfhj = serspre[0];
|
|
|
+ // 获取产品类型二级
|
|
|
+ String bfcplx = serspre[1].split("-")[0];
|
|
|
+ // 后一道作业合金、产品类型
|
|
|
+ String afhj = sersafter[0];
|
|
|
+ // 获取产品类型二级
|
|
|
+ String afcplx = sersafter[1].split("-")[0];
|
|
|
+ // 铸轧合金兼容配置
|
|
|
+ if(apsNochangeRollerDos != null && apsNochangeRollerDos.size()>0){
|
|
|
+ for (ApsNochangeRollerDo apsNochangeRollerDo : apsNochangeRollerDos) {
|
|
|
+ // 判断合金是否都包含,且相同
|
|
|
+ if(bfhj.equals(afhj)){
|
|
|
+ if(StrUtil.isNotBlank(apsNochangeRollerDo.getWorkingalloy())){
|
|
|
+ if(apsNochangeRollerDo.getWorkingalloy().contains(bfhj) && apsNochangeRollerDo.getWorkingalloy().contains(afhj)){
|
|
|
+ // 判断产品类型是包含还是不包含的关系
|
|
|
+ if("包含".equals(apsNochangeRollerDo.getCompatibilityrules())){
|
|
|
+ // 产品类型不为空
|
|
|
+ if(StrUtil.isNotBlank(apsNochangeRollerDo.getJobproducttype())){
|
|
|
+ if(apsNochangeRollerDo.getJobproducttype().contains(bfcplx) && apsNochangeRollerDo.getJobproducttype().contains(afcplx)){
|
|
|
+ ifJr = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 产品类型为空
|
|
|
+ else{
|
|
|
+ ifJr = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else if ("不包含".equals(apsNochangeRollerDo.getCompatibilityrules())) {
|
|
|
+ // 产品类型不为空
|
|
|
+ if(StrUtil.isNotBlank(apsNochangeRollerDo.getJobproducttype())){
|
|
|
+ if(!apsNochangeRollerDo.getJobproducttype().contains(bfcplx) && !apsNochangeRollerDo.getJobproducttype().contains(afcplx)){
|
|
|
+ ifJr = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 产品类型为空
|
|
|
+ else{
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return ifJr;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 铸轧连续生产洗炉约束
|
|
|
* @param constraintFactory
|