|
@@ -855,11 +855,16 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
for (EquipmentRunTime equipmentRunTime : equipment.getEquipmentRunTimes()) {
|
|
|
ProductionProcesses pp = new ProductionProcesses();
|
|
|
pp.setStartTime(equipmentRunTime.getStartRunTime());
|
|
|
+ pp.setEquipment(equipment);
|
|
|
+ pp.setEndTime(equipmentRunTime.getEndRunTime());
|
|
|
pp.setSeriesProduceMark(equipmentRunTime.getSeriesProduceMark());
|
|
|
pp.setProcessType(equipmentRunTime.getProcessType());
|
|
|
+ pp.setVolumeMetal(equipmentRunTime.getVolumeMetal());
|
|
|
+ pp.setVolumeMetalstate(equipmentRunTime.getVolumeMetalstate());
|
|
|
pp.setBsProcessesId(Arrays.asList(new String[]{"haspcprocess"}));
|
|
|
pp.setVolumeWidth(equipmentRunTime.getTotalVolumeWidth());
|
|
|
pp.setSinglerollweight(equipmentRunTime.getTotalSinglerollweight());
|
|
|
+ pp.setVolumeThickness(equipmentRunTime.getTotalThickness());
|
|
|
pp.setConflictRoptions(new HashMap<>());
|
|
|
if(equipmentRunTime.getOccupyType().equals("process")){
|
|
|
pp.setTaskType("processes");
|
|
@@ -905,7 +910,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
- if(prePro.getEndTime().compareTo(nextPro.getStartTime()) == 1){
|
|
|
+ if(prePro.getEndTime().compareTo(nextPro.getStartTime()) > 0){
|
|
|
if("2".equals(type)){
|
|
|
// System.out.println("1:作业加工时间有交叉");
|
|
|
conflictRoptions1.put("hard-eqTimeCrossTuihuo","作业加工时间有交叉");
|
|
@@ -920,10 +925,106 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
List<ProductionProcesses> v = entry.getValue();
|
|
|
BigDecimal totalWidth = new BigDecimal("0");
|
|
|
BigDecimal totalWeight = new BigDecimal("0");
|
|
|
+ Set<String> metalSet = new HashSet<>();
|
|
|
+ Set<String> processTypeSet = new HashSet<>();
|
|
|
+ Set<String> metalstateSet = new HashSet<>();
|
|
|
+ // 最大、最小宽度
|
|
|
+ BigDecimal maxVolumeWidth = null;
|
|
|
+ BigDecimal minVolumeWidth = null;
|
|
|
+ // 最大、最小厚度
|
|
|
+ BigDecimal maxVolumeThickness = null;
|
|
|
+ BigDecimal minVolumeThickness = null;
|
|
|
+ // 最大、最小重量
|
|
|
+ BigDecimal maxSinglerollweight = null;
|
|
|
+ BigDecimal minSinglerollweight = null;
|
|
|
+
|
|
|
for (ProductionProcesses productionProcesses : v) {
|
|
|
totalWidth = totalWidth.add(productionProcesses.getVolumeWidth()).add(productionProcesses.getEquipment().getEquipmentParameter().getFurnace());
|
|
|
totalWeight = totalWeight.add(productionProcesses.getSinglerollweight());
|
|
|
+ metalSet.add(productionProcesses.getVolumeMetal());
|
|
|
+ processTypeSet.add(productionProcesses.getProcessType());
|
|
|
+ metalstateSet.add(productionProcesses.getVolumeMetalstate());
|
|
|
+ // 宽度
|
|
|
+ if(maxVolumeWidth == null){
|
|
|
+ maxVolumeWidth = productionProcesses.getVolumeWidth();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getVolumeWidth().compareTo(maxVolumeWidth)>0){
|
|
|
+ maxVolumeWidth = productionProcesses.getVolumeWidth();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(minVolumeWidth == null){
|
|
|
+ minVolumeWidth = productionProcesses.getVolumeWidth();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getVolumeWidth().compareTo(minVolumeWidth)<0){
|
|
|
+ minVolumeWidth = productionProcesses.getVolumeWidth();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 厚度
|
|
|
+ if(maxVolumeThickness == null){
|
|
|
+ maxVolumeThickness = productionProcesses.getVolumeThickness();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getVolumeThickness().compareTo(maxVolumeThickness)>0){
|
|
|
+ maxVolumeThickness = productionProcesses.getVolumeThickness();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(minVolumeThickness == null){
|
|
|
+ minVolumeThickness = productionProcesses.getVolumeThickness();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getVolumeThickness().compareTo(minVolumeThickness)<0){
|
|
|
+ minVolumeThickness = productionProcesses.getVolumeThickness();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 重量
|
|
|
+ if(maxSinglerollweight == null){
|
|
|
+ maxSinglerollweight = productionProcesses.getSinglerollweight();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getSinglerollweight().compareTo(maxSinglerollweight)>0){
|
|
|
+ maxSinglerollweight = productionProcesses.getSinglerollweight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(minSinglerollweight == null){
|
|
|
+ minSinglerollweight = productionProcesses.getSinglerollweight();
|
|
|
+ }else{
|
|
|
+ if(productionProcesses.getSinglerollweight().compareTo(minSinglerollweight)<0){
|
|
|
+ minSinglerollweight = productionProcesses.getSinglerollweight();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+ // 工序类型、合金、合金状态要一致
|
|
|
+ if(metalSet.size()>1 || processTypeSet.size()>1 || metalstateSet.size()>1){
|
|
|
+ if("2".equals(type)){
|
|
|
+ for (ProductionProcesses productionProcesses : v) {
|
|
|
+ productionProcesses.getConflictRoptions().put("hard-eqTimeCrossTuihuo","不满足退火合并规则");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ b++;
|
|
|
+ }
|
|
|
+ // 重量、宽度、厚度要满足一定规则
|
|
|
+ else{
|
|
|
+ String processType = v.get(0).getProcessType();
|
|
|
+ BigDecimal btVolumeWidth = null;
|
|
|
+ BigDecimal btVolumeThickness = null;
|
|
|
+ BigDecimal btSinglerollweight = null;
|
|
|
+ if("成退".equals(processType)){
|
|
|
+ btVolumeWidth = new BigDecimal("50");
|
|
|
+ btVolumeThickness = new BigDecimal("0.05");
|
|
|
+ btSinglerollweight = new BigDecimal("1");
|
|
|
+ }else if ("中退".equals(processType)){
|
|
|
+ btVolumeWidth = new BigDecimal("100");
|
|
|
+ btVolumeThickness = new BigDecimal("0.08");
|
|
|
+ btSinglerollweight = new BigDecimal("1");
|
|
|
+ }
|
|
|
+ if(maxVolumeWidth.subtract(minVolumeWidth).compareTo(btVolumeWidth)>0 || maxVolumeThickness.subtract(minVolumeThickness).compareTo(btVolumeThickness)>0
|
|
|
+ || maxSinglerollweight.subtract(minSinglerollweight).compareTo(btSinglerollweight)>0){
|
|
|
+ if("2".equals(type)){
|
|
|
+ for (ProductionProcesses productionProcesses : v) {
|
|
|
+ productionProcesses.getConflictRoptions().put("hard-eqTimeCrossTuihuo","不满足退火合并规则");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ b++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if(totalWidth.compareTo(v.get(0).getEquipment().getEquipmentParameter().getEquipmentWidth())>0
|
|
|
|| totalWeight.compareTo(v.get(0).getEquipment().getEquipmentParameter().getEquipmentBearing())>0){
|
|
|
if("2".equals(type)){
|
|
@@ -1128,6 +1229,8 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
pp.setBsProcessesId(Arrays.asList(new String[]{"lastprocess"}));
|
|
|
pp.setConflictRoptions(new HashMap<>());
|
|
|
hasStartTimeProcess.add(0,pp);
|
|
|
+ }else{
|
|
|
+ b = b+2;
|
|
|
}
|
|
|
for(int i=0;i<hasStartTimeProcess.size()-1;i++){
|
|
|
if(hasStartTimeProcess.get(i).getSeriesProduceMark() != null && hasStartTimeProcess.get(i+1).getSeriesProduceMark() != null){
|
|
@@ -1145,7 +1248,7 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
if(serspre.length == 5 && sersafter.length == 5){
|
|
|
// 合金不同或者产品类型不同则需要换辊和立板
|
|
|
if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
- b = b+2;
|
|
|
+ b = b+4;
|
|
|
conflictRoptions1.put("soft-seriesProduceZz","和后一道工序违反换辊和立板的连续约束");
|
|
|
conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反换辊和立板的连续约束");
|
|
|
}else{
|
|
@@ -1158,11 +1261,11 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
BigDecimal i1 = new BigDecimal(s1);
|
|
|
BigDecimal i2 = new BigDecimal(s2);
|
|
|
if(i1.compareTo(i2)<0){
|
|
|
- b = b+2;
|
|
|
+ b = b+4;
|
|
|
conflictRoptions1.put("soft-seriesProduceZz","和后一道工序违反换辊和立板的连续约束");
|
|
|
conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反换辊和立板的连续约束");
|
|
|
}else if(i1.compareTo(i2)>0){
|
|
|
- b++;
|
|
|
+ b = b+3;
|
|
|
conflictRoptions1.put("soft-seriesProduceZz","和后一道工序违反立板的连续约束");
|
|
|
conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反立板的连续约束");
|
|
|
}
|
|
@@ -1172,6 +1275,9 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
}
|
|
|
}
|
|
|
} else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
+ /*if(hasStartTimeProcess.size() == 2){
|
|
|
+ System.out.println(hasStartTimeProcess);
|
|
|
+ }*/
|
|
|
if(conflictRoptions1.containsKey("soft-seriesProduceLz")){
|
|
|
conflictRoptions1.remove("soft-seriesProduceLz");
|
|
|
}
|
|
@@ -1202,29 +1308,29 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
BigDecimal i2 = new BigDecimal(s2);
|
|
|
// 后端工序大于前道工序,并且大于30mm
|
|
|
if((i1.add(new BigDecimal("30"))).compareTo(i2)<0){
|
|
|
- b = b+6;
|
|
|
+ b = b+7;
|
|
|
conflictRoptions1.put("soft-seriesProduceLz","和后一道工序违反换辊的连续约束");
|
|
|
conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
|
|
|
}
|
|
|
// 后端工序大于前道工序,并且小于30mm
|
|
|
else if(i1.compareTo(i2)<0 && (i1.add(new BigDecimal("30"))).compareTo(i2)>=0){
|
|
|
- b = b+5;
|
|
|
+ b = b+6;
|
|
|
conflictRoptions1.put("soft-seriesProduceLz","和后一道工序违反换辊的连续约束");
|
|
|
conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
|
|
|
}
|
|
|
// 后端工序小于前道工序
|
|
|
else if(i1.compareTo(i2)>0){
|
|
|
- b = b+4;
|
|
|
+ b = b+5;
|
|
|
}
|
|
|
// 宽度相等的情况下
|
|
|
else{
|
|
|
// 输入厚度不同
|
|
|
if(t1.compareTo(t2) != 0){
|
|
|
- b = b+3;
|
|
|
+ b = b+4;
|
|
|
}else{
|
|
|
// 输出厚度不同
|
|
|
if(to1.compareTo(to2) != 0){
|
|
|
- b = b+2;
|
|
|
+ b = b+3;
|
|
|
}else{
|
|
|
// 不属于同一作业
|
|
|
if(!processId1.equals(processId2)){
|
|
@@ -1497,7 +1603,12 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
.groupBy(ProductionProcesses::getUniqueBsProcessesId,ConstraintCollectors.toList())
|
|
|
.filter((equipmentEquassociated,processes) -> {
|
|
|
if(processes != null && processes.size()>0){
|
|
|
- return true;
|
|
|
+ Map<String, List<ProductionProcesses>> listMap = processes.stream().collect(Collectors.groupingBy(ProductionProcesses::getEquipmentId));
|
|
|
+ if(listMap != null && listMap.size()>1){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|