|
@@ -66,7 +66,11 @@ public class ApsServiceImpl implements ApsService {
|
|
|
// 全局配置
|
|
|
ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
|
|
|
BeanUtil.copyProperties(process.getApsOverallConfig(),apsOverallConfig);
|
|
|
- apsOverallConfig.setStartTime(process.getApsOverallConfig().getStartTime().plusMinutes(totaltime));
|
|
|
+ if(process.getRooprocess() != null && process.getRooprocess().getStartTime() != null){
|
|
|
+ apsOverallConfig.setStartTime(process.getRooprocess().getStartTime().plusMinutes(totaltime));
|
|
|
+ }else{
|
|
|
+ apsOverallConfig.setStartTime(process.getApsOverallConfig().getStartTime().plusMinutes(totaltime));
|
|
|
+ }
|
|
|
// 开始时间设置
|
|
|
process.setApsOverallConfig(apsOverallConfig);
|
|
|
// 前后道工序置空
|
|
@@ -82,6 +86,48 @@ public class ApsServiceImpl implements ApsService {
|
|
|
return apsSolutionTuihuo;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 退火
|
|
|
+ * @param apsSolution
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void tuihuoApsSch(ApsSolution apsSolution){
|
|
|
+ ApsSolution apsSolutionTh = tuihuoAps(apsSolution);
|
|
|
+ // 退火工序求解器运行
|
|
|
+ int processNum1 = apsSolutionTh.getProcessesList().size();
|
|
|
+ int runPlanSeconds1 = (processNum1)*30;
|
|
|
+ // CPU核数
|
|
|
+ String cores = Runtime.getRuntime().availableProcessors() + "";
|
|
|
+ SolverFactory<ApsSolution> solverFactory1 = SolverFactory.create(new SolverConfig()
|
|
|
+ .withEnvironmentMode(EnvironmentMode.REPRODUCIBLE)
|
|
|
+ .withSolutionClass(ApsSolution.class)
|
|
|
+ .withEntityClasses(ProductionProcesses.class)
|
|
|
+ .withConstraintProviderClass(ApsConstraintProvider.class)
|
|
|
+ .withTerminationSpentLimit(Duration.ofSeconds(runPlanSeconds1))
|
|
|
+ .withMoveThreadCount(cores)
|
|
|
+ );
|
|
|
+ Solver<ApsSolution> solver1 = solverFactory1.buildSolver();
|
|
|
+ ApsSolution solvedBalance1 = solver1.solve(apsSolutionTh);
|
|
|
+ log.info("**************退火排程评分分析***************");
|
|
|
+ SolutionManager<ApsSolution, HardSoftScore> scoreManager1 = SolutionManager.create(solverFactory1);
|
|
|
+ ScoreExplanation<ApsSolution, HardSoftScore> explain1 = scoreManager1.explain(solvedBalance1);
|
|
|
+ log.info(explain1.toString());
|
|
|
+ log.info("**************退火排程评分分析***************");
|
|
|
+
|
|
|
+ // 锁定退火工序
|
|
|
+ for (ProductionProcesses process : apsSolution.getProcessesList()) {
|
|
|
+ List<ProductionProcesses> collect = solvedBalance1.getProcessesList().stream().filter(v -> v.getId().equals(process.getId())).collect(Collectors.toList());
|
|
|
+ if(collect != null && collect.size()>0){
|
|
|
+ process.setStartTime(collect.get(0).getStartTime());
|
|
|
+ process.setEndTime(collect.get(0).getEndTime());
|
|
|
+ process.setEquipmentId(collect.get(0).getEquipmentId());
|
|
|
+ process.setEquipment(collect.get(0).getEquipment());
|
|
|
+ process.setDelay(collect.get(0).getDelay());
|
|
|
+ process.setIfLock(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取所有前道工序的时间总和
|
|
|
* @param process
|