|
@@ -143,7 +143,7 @@ public class ProductionScheduleTaServiceImpl implements ProductionScheduleTaServ
|
|
|
.withSolutionClass(ApsSolutionTa.class)
|
|
|
.withEntityClasses(ProductionProcessesTa.class, EquipmentTa.class)
|
|
|
.withConstraintProviderClass(ApsConstraintListProvider.class)
|
|
|
- .withTerminationConfig(new TerminationConfig().withUnimprovedSecondsSpentLimit(60L))
|
|
|
+ .withTerminationConfig(new TerminationConfig().withUnimprovedSecondsSpentLimit(30L))
|
|
|
// .withTerminationSpentLimit(Duration.ofSeconds(180))
|
|
|
.withMoveThreadCount(cores)
|
|
|
);
|
|
@@ -307,6 +307,18 @@ public class ProductionScheduleTaServiceImpl implements ProductionScheduleTaServ
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // 交货期处理
|
|
|
+ if(!minTimePros){
|
|
|
+ Date deliveryDate = v.getProduceOrder().get(0).getDeliveryDate();
|
|
|
+ LocalDateTime deliveryLTime = deliveryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
|
|
|
+ LocalDateTime startTime = v.getApsOverallConfig().getStartTime();
|
|
|
+ LocalDateTime endTime = startTime.plusHours(24);
|
|
|
+ if(deliveryLTime.compareTo(startTime) > 0 && deliveryLTime.compareTo(endTime) <= 0){
|
|
|
+ minTimePros = true;
|
|
|
+ }else{
|
|
|
+ minTimePros = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return minTimePros;
|
|
|
}).collect(Collectors.toList());
|
|
@@ -320,6 +332,66 @@ public class ProductionScheduleTaServiceImpl implements ProductionScheduleTaServ
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 提前排序,根据最后一道工序的辊以及宽度排序
|
|
|
+ if(equipments != null && equipments.size() == 1){
|
|
|
+ Map<String,List<ProductionProcessesTa>> gGroupPros = new HashMap<>();
|
|
|
+ // 当前设备排程前最后一道工序的辊
|
|
|
+ EquipmentTa equipmentTa = equipments.get(0);
|
|
|
+ String lastZjgid = equipmentTa.getLastZjgid();
|
|
|
+ if(StrUtil.isBlank(lastZjgid)){
|
|
|
+ if(equipmentTa.getEquipmentRunTimes() != null && equipmentTa.getEquipmentRunTimes().size()>0){
|
|
|
+ Collections.sort(equipmentTa.getEquipmentRunTimes(),Comparator.comparing(EquipmentRunTime::getEndRunTime));
|
|
|
+ lastZjgid = equipmentTa.getEquipmentRunTimes().get(equipmentTa.getEquipmentRunTimes().size()-1).getZjgid();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按辊分组
|
|
|
+ for (ProductionProcessesTa toApsLastPro : toApsLastPros) {
|
|
|
+ if(toApsLastPro.getOptionalEquipmentZg() != null && toApsLastPro.getOptionalEquipmentZg().size()>0){
|
|
|
+ String gunid = toApsLastPro.getOptionalEquipmentZg().get(equipmentTa.getId());
|
|
|
+ if(StrUtil.isNotBlank(gunid)){
|
|
|
+ if(gGroupPros.get(gunid)==null){
|
|
|
+ List<ProductionProcessesTa> gPros = new ArrayList<>();
|
|
|
+ gPros.add(toApsLastPro);
|
|
|
+ gGroupPros.put(gunid,gPros);
|
|
|
+ }else{
|
|
|
+ gGroupPros.get(gunid).add(toApsLastPro);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(gGroupPros.get("notgun")==null){
|
|
|
+ List<ProductionProcessesTa> gPros = new ArrayList<>();
|
|
|
+ gPros.add(toApsLastPro);
|
|
|
+ gGroupPros.put(gunid,gPros);
|
|
|
+ }else{
|
|
|
+ gGroupPros.get("notgun").add(toApsLastPro);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断是否存在设备排程前最后一道工序的相同辊
|
|
|
+ List<ProductionProcessesTa> sortedPros = new ArrayList<>();
|
|
|
+ List<List<ProductionProcessesTa>> sySortedPros = new ArrayList<>();
|
|
|
+
|
|
|
+ if(StrUtil.isNotBlank(lastZjgid) && gGroupPros.get(lastZjgid) != null && gGroupPros.get(lastZjgid).size()>0){
|
|
|
+ sortedPros.addAll(gGroupPros.get(lastZjgid));
|
|
|
+ String finalLastZjgid = lastZjgid;
|
|
|
+ gGroupPros.forEach((k, v)->{
|
|
|
+ if(!k.equals(finalLastZjgid)){
|
|
|
+ sySortedPros.add(v);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ gGroupPros.forEach((k, v)->{
|
|
|
+ sySortedPros.add(v);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 按照size从大到小排序
|
|
|
+ Collections.sort(sySortedPros, (o1, o2) -> o2.size() - o1.size());
|
|
|
+ for (List<ProductionProcessesTa> sySortedPro : sySortedPros) {
|
|
|
+ sortedPros.addAll(sySortedPro);
|
|
|
+ }
|
|
|
+ toApsLastPros = sortedPros;
|
|
|
+ }
|
|
|
+
|
|
|
toApsLastPros.addAll(minTimeAfterPros);
|
|
|
}else {
|
|
|
toApsLastPros.addAll(toApsPros);
|
|
@@ -336,6 +408,12 @@ public class ProductionScheduleTaServiceImpl implements ProductionScheduleTaServ
|
|
|
}*/
|
|
|
System.out.println("---------------------------当前设备"+equDes+" 开始调度排程---------------------------");
|
|
|
log.info("---------------------------当前设备"+equDes+" 开始调度排程---------------------------");
|
|
|
+ /*if(equDes.contains("09be204864014e88ac19d5ac9950fa32")){
|
|
|
+ int abc = 1;
|
|
|
+ }*/
|
|
|
+ /*List<ProductionProcessesTa> test1 = apsSolution1.getProcessesList().stream().filter(v -> !v.getId().equals("fd865f2c41164165b60d123a644b5f98")).collect(Collectors.toList());
|
|
|
+ apsSolution1.setProcessesList(test1);*/
|
|
|
+
|
|
|
ApsSolutionTa solvedBalance1 = solver.solve(apsSolution1);
|
|
|
for (ProductionProcessesTa productionProcesses : solvedBalance1.getProcessesList()) {
|
|
|
if(productionProcesses.getOptionalEquipmentZg() != null && productionProcesses.getOptionalEquipmentZg().size()>0){
|
|
@@ -1130,6 +1208,10 @@ public class ProductionScheduleTaServiceImpl implements ProductionScheduleTaServ
|
|
|
process.getApsOverallConfig().setWeightdifference(productionScheduleVo.getWeightdifference());
|
|
|
process.getApsOverallConfig().setMidweightdifference(productionScheduleVo.getMidweightdifference());
|
|
|
process.getApsOverallConfig().setScheduleType(productionScheduleVo.getScheduleType());
|
|
|
+ if("dd".equals(productionScheduleVo.getScheduleType().getScheduleType())){
|
|
|
+ process.getApsOverallConfig().setStartTimeLong(startDate.getTime());
|
|
|
+ process.getApsOverallConfig().setStartTime(startTime);
|
|
|
+ }
|
|
|
|
|
|
if(StrUtil.isBlank(process.getTaskType())){
|
|
|
process.setTaskType("processes");
|