|
@@ -1819,158 +1819,170 @@ public class ApsConstraintProvider implements ConstraintProvider {
|
|
|
b = b+2;
|
|
|
}
|
|
|
}
|
|
|
- for(int i=0;i<hasStartTimeProcess.size()-1;i++){
|
|
|
- if(hasStartTimeProcess.get(i).getId() == null && hasStartTimeProcess.get(i+1).getId() == null){
|
|
|
- continue;
|
|
|
- }
|
|
|
- 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())){
|
|
|
+ for(int i=0;i<hasStartTimeProcess.size();i++){
|
|
|
+ if(i == hasStartTimeProcess.size()-1){
|
|
|
+ if(hasStartTimeProcess.get(i).getId() == null){
|
|
|
+ continue;
|
|
|
+ }else{
|
|
|
+ if("铸轧".equals(hasStartTimeProcess.get(i).getProcessType())){
|
|
|
+ b = b+15;
|
|
|
+ }else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
+ b = b+10;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(hasStartTimeProcess.get(i).getId() == null && hasStartTimeProcess.get(i+1).getId() == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ 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(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])){
|
|
|
- b = b+15;
|
|
|
- if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
- conflictRoptions1.put("soft-seriesProduceZz",conflictRoptions1.get("soft-seriesProduceZz") == null ? "和后一道工序违反换辊和立板的连续约束" : conflictRoptions1.get("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])){
|
|
|
+ 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","和前一道工序违反换辊和立板的连续约束");
|
|
|
+ }
|
|
|
}else{
|
|
|
- conflictRoptions2.put("soft-seriesProduceZz","和前一道工序违反换辊和立板的连续约束");
|
|
|
- }
|
|
|
- }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","和前一道工序违反换辊和立板的连续约束");
|
|
|
- }
|
|
|
- }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","和前一道工序违反立板的连续约束");
|
|
|
+ // 合金相同情况下后面的宽度大于前面的宽度需要换辊和立板
|
|
|
+ // 合金相同情况下后面的宽度小于前面的宽度需要立板
|
|
|
+ // 合金相同情况下后面的宽度等于前面的宽度换辊和立板都不需要
|
|
|
+ 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","和前一道工序违反换辊和立板的连续约束");
|
|
|
+ }
|
|
|
+ }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","和前一道工序违反立板的连续约束");
|
|
|
+ }
|
|
|
}
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- } else if ("冷轧".equals(hasStartTimeProcess.get(i).getProcessType())) {
|
|
|
+ } 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
|
|
|
- String processId1 = hasStartTimeProcess.get(i).getBsProcessesId().get(0);
|
|
|
- String processId2 = hasStartTimeProcess.get(i+1).getBsProcessesId().get(0);
|
|
|
- if(serspre.length == 5 && sersafter.length == 5){
|
|
|
- if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
- b = b+10;
|
|
|
- if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
- conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
|
|
|
+ String[] serspre = hasStartTimeProcess.get(i).getSeriesProduceMark().split("\\^_\\^");
|
|
|
+ String[] sersafter = hasStartTimeProcess.get(i+1).getSeriesProduceMark().split("\\^_\\^");
|
|
|
+ // 前后道所属作业ID
|
|
|
+ String processId1 = hasStartTimeProcess.get(i).getBsProcessesId().get(0);
|
|
|
+ String processId2 = hasStartTimeProcess.get(i+1).getBsProcessesId().get(0);
|
|
|
+ if(serspre.length == 5 && sersafter.length == 5){
|
|
|
+ if(!serspre[0].equals(sersafter[0]) || !serspre[1].equals(sersafter[1])){
|
|
|
+ b = b+10;
|
|
|
+ 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{
|
|
|
- conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
|
|
|
+ // 前道工序宽度、输入物料厚度、输出物料厚度
|
|
|
+ String s1 = serspre[2];
|
|
|
+ BigDecimal t1 = new BigDecimal(serspre[3]);
|
|
|
+ BigDecimal to1 = new BigDecimal(serspre[4]);
|
|
|
+ // 后道工序宽度、输入物料厚度、输出物料厚度
|
|
|
+ String s2 = sersafter[2];
|
|
|
+ BigDecimal t2 = new BigDecimal(sersafter[3]);
|
|
|
+ BigDecimal to2 = new BigDecimal(sersafter[4]);
|
|
|
+ try{
|
|
|
+ BigDecimal i1 = new BigDecimal(s1);
|
|
|
+ BigDecimal i2 = new BigDecimal(s2);
|
|
|
+ // 后端工序大于前道工序,并且大于30mm
|
|
|
+ if((i1.add(new BigDecimal("30"))).compareTo(i2)<0){
|
|
|
+ b = b+7;
|
|
|
+ if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
+ conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
|
|
|
+ }else{
|
|
|
+ conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 后端工序大于前道工序,并且小于30mm
|
|
|
+ else if(i1.compareTo(i2)<0 && (i1.add(new BigDecimal("30"))).compareTo(i2)>=0){
|
|
|
+ b = b+6;
|
|
|
+ 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(i1.compareTo(i2)>0){
|
|
|
+ b = b+5;
|
|
|
+ }
|
|
|
+ // 宽度相等的情况下
|
|
|
+ else{
|
|
|
+ // 输入厚度不同
|
|
|
+ if(t1.compareTo(t2) != 0){
|
|
|
+ b = b+4;
|
|
|
+ }else{
|
|
|
+ // 输出厚度不同
|
|
|
+ if(to1.compareTo(to2) != 0){
|
|
|
+ b = b+3;
|
|
|
+ }else{
|
|
|
+ // 不属于同一作业
|
|
|
+ if(!processId1.equals(processId2)){
|
|
|
+ b = b+1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
- }else{
|
|
|
- // 前道工序宽度、输入物料厚度、输出物料厚度
|
|
|
+ }
|
|
|
+ }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];
|
|
|
- BigDecimal t1 = new BigDecimal(serspre[3]);
|
|
|
- BigDecimal to1 = new BigDecimal(serspre[4]);
|
|
|
- // 后道工序宽度、输入物料厚度、输出物料厚度
|
|
|
String s2 = sersafter[2];
|
|
|
- BigDecimal t2 = new BigDecimal(sersafter[3]);
|
|
|
- BigDecimal to2 = new BigDecimal(sersafter[4]);
|
|
|
- try{
|
|
|
- BigDecimal i1 = new BigDecimal(s1);
|
|
|
- BigDecimal i2 = new BigDecimal(s2);
|
|
|
- // 后端工序大于前道工序,并且大于30mm
|
|
|
- if((i1.add(new BigDecimal("30"))).compareTo(i2)<0){
|
|
|
- b = b+7;
|
|
|
- if(hasStartTimeProcess.get(i).getId() != null){
|
|
|
- conflictRoptions1.put("soft-seriesProduceLz",conflictRoptions1.get("soft-seriesProduceLz") == null ? "和后一道工序违反换辊的连续约束" : conflictRoptions1.get("soft-seriesProduceLz")+";和后一道工序违反换辊的连续约束");
|
|
|
- }else{
|
|
|
- conflictRoptions2.put("soft-seriesProduceLz","和前一道工序违反换辊的连续约束");
|
|
|
- }
|
|
|
- }
|
|
|
- // 后端工序大于前道工序,并且小于30mm
|
|
|
- else if(i1.compareTo(i2)<0 && (i1.add(new BigDecimal("30"))).compareTo(i2)>=0){
|
|
|
- b = b+6;
|
|
|
+ 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(i1.compareTo(i2)>0){
|
|
|
- b = b+5;
|
|
|
- }
|
|
|
- // 宽度相等的情况下
|
|
|
- else{
|
|
|
- // 输入厚度不同
|
|
|
- if(t1.compareTo(t2) != 0){
|
|
|
- b = b+4;
|
|
|
- }else{
|
|
|
- // 输出厚度不同
|
|
|
- if(to1.compareTo(to2) != 0){
|
|
|
- b = b+3;
|
|
|
- }else{
|
|
|
- // 不属于同一作业
|
|
|
- if(!processId1.equals(processId2)){
|
|
|
- b = b+1;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }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","和前一道工序违反换辊的连续约束");
|
|
|
- }
|
|
|
- }
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|