|
@@ -56,8 +56,8 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
|
|
|
@Override
|
|
|
public ProductionScheduleRetVo productionSchedule(ProductionScheduleVo productionScheduleVo) throws Exception{
|
|
|
List<String> blankids = new ArrayList<>();
|
|
|
- blankids.add("3dffee02b25141cfb6a38624e855f9b2");
|
|
|
- blankids.add("133bea9029db4db4b199a3c578a5695c");
|
|
|
+ blankids.add("1dd64c0a6bca4d5fb84055a598d488b4");
|
|
|
+// blankids.add("1dd64c0a6bca4d5fb84055a598d488b4");
|
|
|
// blankids.add("7efe679a8e3c4942b88758617cdbc312");
|
|
|
// blankids.add("acf4460f9488459780c0dc7d8038f1f9");
|
|
|
// blankids.add("efeb1f8d01b04cdb9921c0d1711bb967");
|
|
@@ -371,31 +371,138 @@ public class ProductionScheduleServiceImpl implements ProductionScheduleService
|
|
|
}
|
|
|
});
|
|
|
SolutionManager<ApsSolution, HardSoftScore> scoreManager = SolutionManager.create(solverFactory);
|
|
|
+ // 判断是否存在小卷退火并且没有最大等待时间
|
|
|
+ List<String> xjctids = new ArrayList<>();
|
|
|
+ List<ProductionProcesses> xjctidPros = new ArrayList<>();
|
|
|
+ for (ProductionProcesses productionProcesses : apsSolution1.getProcessesList()) {
|
|
|
+ if(productionProcesses.getProcessType().equals("小卷成退") && productionProcesses.getMaxWaitTime() == null){
|
|
|
+ xjctids.add(productionProcesses.getId());
|
|
|
+ xjctidPros.add(productionProcesses);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(xjctidPros != null && xjctidPros.size() > 0){
|
|
|
+ for (ProductionProcesses xjctidpro : xjctidPros) {
|
|
|
+ List<ProductionProcesses> nextProcesses = xjctidpro.getNextProcesses();
|
|
|
+ while (nextProcesses != null && nextProcesses.size() > 0) {
|
|
|
+ List<ProductionProcesses> nextProcesses1 = new ArrayList<>();
|
|
|
+ for (ProductionProcesses nextProcess : nextProcesses) {
|
|
|
+ xjctids.add(nextProcess.getId());
|
|
|
+ if(nextProcess.getNextProcesses() != null && nextProcess.getNextProcesses().size() > 0){
|
|
|
+ nextProcesses1.addAll(nextProcess.getNextProcesses());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ nextProcesses = nextProcesses1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 小卷成退所有前道工序
|
|
|
+ List<ProductionProcesses> xjctpres = new ArrayList<>();
|
|
|
+ // 小卷成退所有后道工序
|
|
|
+ List<ProductionProcesses> xjctafters = new ArrayList<>();
|
|
|
+ if(xjctids != null && xjctids.size() > 0){
|
|
|
+ for (ProductionProcesses productionProcesses : apsSolution1.getProcessesList()) {
|
|
|
+ if(xjctids.contains(productionProcesses.getId())){
|
|
|
+ xjctafters.add(productionProcesses);
|
|
|
+ }else {
|
|
|
+ xjctpres.add(productionProcesses);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ xjctpres = apsSolution1.getProcessesList();
|
|
|
+ }
|
|
|
+ // 小卷成退前道工序先排程
|
|
|
+ if(xjctpres != null && xjctpres.size() > 0){
|
|
|
+ apsSolution1.setProcessesList(xjctpres);
|
|
|
+ ApsSolution solvedBalance1 = solver.solve(apsSolution1);
|
|
|
+ log.info("**************排程评分分析***************");
|
|
|
+ ScoreExplanation<ApsSolution, HardSoftScore> explain = scoreManager.explain(solvedBalance1);
|
|
|
+ log.info(explain.toString());
|
|
|
+ log.info("**************排程评分分析***************");
|
|
|
+ productionScheduleRetVo.setScoreResult(scoreManager.explain(solvedBalance1).toString());
|
|
|
+ // 得分分析
|
|
|
+ softExplain(explain,solvedBalance1.getProcessesList());
|
|
|
+
|
|
|
+ solvedBalance.getProcessesList().addAll(solvedBalance1.getProcessesList());
|
|
|
+ thOrderids.addAll(v);
|
|
|
|
|
|
- ApsSolution solvedBalance1 = solver.solve(apsSolution1);
|
|
|
- log.info("**************排程评分分析***************");
|
|
|
- ScoreExplanation<ApsSolution, HardSoftScore> explain = scoreManager.explain(solvedBalance1);
|
|
|
- log.info(explain.toString());
|
|
|
- log.info("**************排程评分分析***************");
|
|
|
- productionScheduleRetVo.setScoreResult(scoreManager.explain(solvedBalance1).toString());
|
|
|
- // 得分分析
|
|
|
- softExplain(explain,solvedBalance1.getProcessesList());
|
|
|
- /*if("default".equals(productionScheduleVo.getScheduleType().getScheduleType())){
|
|
|
- apsUtils.maxTimeXz(solvedBalance1);
|
|
|
- log.info("**************最终排程评分分析***************");
|
|
|
- ScoreExplanation<ApsSolution, HardSoftScore> explain1 = scoreManager.explain(solvedBalance1);
|
|
|
- log.info(explain1.toString());
|
|
|
- log.info("**************最终排程评分分析***************");
|
|
|
+ // 排程结束的数据手动添加到设备占用列表中
|
|
|
+ setEqRunTimes(solvedBalance1.getProcessesList());
|
|
|
+ }
|
|
|
+ // 小卷成退及后道工序后排程
|
|
|
+ if(xjctafters != null && xjctafters.size() > 0){
|
|
|
+ for (ProductionProcesses xjctafter : xjctafters) {
|
|
|
+ if(xjctafter.getProcessType().equals("小卷成退")){
|
|
|
+ xjctafter.setThFzdDelays(null);
|
|
|
+ // 前道工序最晚结束时间
|
|
|
+ LocalDateTime startTime = xjctafter.getApsOverallConfig().getStartTime();
|
|
|
+ ProductionProcesses preProcess = null;
|
|
|
+ if(xjctafter.getPreviousProcesses() != null && xjctafter.getPreviousProcesses().size() > 0){
|
|
|
+ for (ProductionProcesses previousProcess : xjctafter.getPreviousProcesses()) {
|
|
|
+ List<ProductionProcesses> pres = solvedBalance.getProcessesList().stream().filter(pv -> pv.getId().equals(previousProcess.getId())).collect(Collectors.toList());
|
|
|
+ previousProcess.setStartTime(pres.get(0).getStartTime());
|
|
|
+ previousProcess.setEndTime(pres.get(0).getEndTime());
|
|
|
+ previousProcess.setEquipmentId(pres.get(0).getEquipmentId());
|
|
|
+ previousProcess.setEquipment(pres.get(0).getEquipment());
|
|
|
+ previousProcess.setDelay(pres.get(0).getDelay());
|
|
|
+ previousProcess.setIfLock(true);
|
|
|
+ if(previousProcess.getEndTime().compareTo(startTime)>0){
|
|
|
+ startTime = previousProcess.getEndTime();
|
|
|
+ preProcess = previousProcess;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 前道工序流转时间
|
|
|
+ Integer lzTimes = 0;
|
|
|
+ if(preProcess != null){
|
|
|
+ lzTimes = xjctafter.getApsOverallConfig().getRoamTime().get("WORKSHOP_IN");
|
|
|
+ }
|
|
|
+ if(xjctafter.getMinWaitTime() != null && lzTimes<xjctafter.getMinWaitTime()){
|
|
|
+ lzTimes = xjctafter.getMinWaitTime();
|
|
|
+ }
|
|
|
+ if(lzTimes>0){
|
|
|
+ startTime = startTime.plusMinutes(lzTimes);
|
|
|
+ }
|
|
|
+ // 增加可排程时间点
|
|
|
+ for (Equipment optionalProviderEquipment : xjctafter.getOptionalProviderEquipments()) {
|
|
|
+ List<EquipmentRunTime> runTimes = optionalProviderEquipment.getEquipmentRunTimes();
|
|
|
+ if(runTimes != null && runTimes.size() > 0){
|
|
|
+ for (EquipmentRunTime runTime : runTimes) {
|
|
|
+ // 历史排程记录开始时间大于最早排程开始时间
|
|
|
+ if(runTime.getStartRunTime() != null && runTime.getStartRunTime().compareTo(startTime)>0){
|
|
|
+ // 使用Duration类计算两个LocalDateTime之间的差异
|
|
|
+ Duration duration = Duration.between(startTime, runTime.getStartRunTime());
|
|
|
+ // 将差异转换为分钟
|
|
|
+ long minutes = duration.toMinutes();
|
|
|
+ if(xjctafter.getThFzdDelays() == null){
|
|
|
+ xjctafter.setThFzdDelays(new ArrayList<>());
|
|
|
+ xjctafter.getThFzdDelays().add((int) minutes);
|
|
|
+ }else{
|
|
|
+ xjctafter.getThFzdDelays().add((int) minutes);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ apsSolution1.setProcessesList(xjctafters);
|
|
|
+ ApsSolution solvedBalance1 = solver.solve(apsSolution1);
|
|
|
+ log.info("**************小卷成退及之后排程评分分析***************");
|
|
|
+ ScoreExplanation<ApsSolution, HardSoftScore> explain = scoreManager.explain(solvedBalance1);
|
|
|
+ log.info(explain.toString());
|
|
|
+ log.info("**************小卷成退及之后排程评分分析***************");
|
|
|
productionScheduleRetVo.setScoreResult(scoreManager.explain(solvedBalance1).toString());
|
|
|
// 得分分析
|
|
|
- softExplain(explain1,solvedBalance1.getProcessesList());
|
|
|
- }*/
|
|
|
+ softExplain(explain,solvedBalance1.getProcessesList());
|
|
|
|
|
|
- solvedBalance.getProcessesList().addAll(solvedBalance1.getProcessesList());
|
|
|
- thOrderids.addAll(v);
|
|
|
+ solvedBalance.getProcessesList().addAll(solvedBalance1.getProcessesList());
|
|
|
+ thOrderids.addAll(v);
|
|
|
+
|
|
|
+ // 排程结束的数据手动添加到设备占用列表中
|
|
|
+ setEqRunTimes(solvedBalance1.getProcessesList());
|
|
|
+ }
|
|
|
|
|
|
- // 排程结束的数据手动添加到设备占用列表中
|
|
|
- setEqRunTimes(solvedBalance1.getProcessesList());
|
|
|
}catch (Exception e){
|
|
|
exOrderIds.addAll(v);
|
|
|
if(productionScheduleRetVo.getMsg() == null){
|