|
@@ -115,7 +115,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
log.info("**************退火排程评分分析***************");
|
|
|
|
|
|
// 锁定退火工序
|
|
|
- for (ProductionProcesses process : apsSolution.getProcessesList()) {
|
|
|
+ /*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());
|
|
@@ -125,6 +125,121 @@ public class ApsServiceImpl implements ApsService {
|
|
|
process.setDelay(collect.get(0).getDelay());
|
|
|
process.setIfLock(true);
|
|
|
}
|
|
|
+ }*/
|
|
|
+
|
|
|
+ // 退火合并工序
|
|
|
+ if(solvedBalance1.getProcessesList() != null && solvedBalance1.getProcessesList().size()>0){
|
|
|
+ Map<String, List<ProductionProcesses>> starttimeProcess = solvedBalance1.getProcessesList().stream()
|
|
|
+ .collect(Collectors.groupingBy(ProductionProcesses::getStartTimeStr));
|
|
|
+ if(starttimeProcess != null && starttimeProcess.size()>0){
|
|
|
+ // 全部待排程作业
|
|
|
+ Map<String,ProductionProcesses> allProMap = new HashMap<>();
|
|
|
+ for (ProductionProcesses productionProcesses : apsSolution.getProcessesList()) {
|
|
|
+ allProMap.put(productionProcesses.getId(),productionProcesses);
|
|
|
+ }
|
|
|
+ // 提前合并退火作业
|
|
|
+ List<ProductionProcesses> otherThproces = new ArrayList<>();
|
|
|
+ starttimeProcess.forEach((k,v)->{
|
|
|
+ if(v.size()>1){
|
|
|
+ List<ProductionProcesses> thps = new ArrayList<>();
|
|
|
+ for (ProductionProcesses productionProcesses : v) {
|
|
|
+ thps.add(allProMap.get(productionProcesses.getId()));
|
|
|
+ }
|
|
|
+ // 按照加工时间从大到小排序
|
|
|
+ Collections.sort(thps, (pro1, pro2) -> pro2.getProduceTime().compareTo(pro1.getProduceTime()));
|
|
|
+ for (int i = 0; i < thps.size(); i++) {
|
|
|
+ if(i>0){
|
|
|
+ // 设置待合并退火的主ID
|
|
|
+ thps.get(i).setMergeThMainId(thps.get(0).getId());
|
|
|
+ otherThproces.add(thps.get(i));
|
|
|
+ for (String previousProcessesId : thps.get(i).getPreviousProcessesIds()) {
|
|
|
+ // 退火前一道作业设置下一作业ID
|
|
|
+ ProductionProcesses prepro = allProMap.get(previousProcessesId);
|
|
|
+ // 合并后关联关系重置
|
|
|
+ if(!prepro.getNextProcessesIds().contains(thps.get(0).getId())){
|
|
|
+ int i1 = prepro.getNextProcessesIds().indexOf(thps.get(i).getId());
|
|
|
+ prepro.getNextProcessesIds().set(i1,thps.get(0).getId());
|
|
|
+ }
|
|
|
+ List<String> list = new ArrayList<>();
|
|
|
+ Set<String> set = new LinkedHashSet<>();
|
|
|
+ for (String nextProcessesId : prepro.getNextProcessesIds()) {
|
|
|
+ set.add(nextProcessesId);
|
|
|
+ }
|
|
|
+ list.addAll(set);
|
|
|
+ prepro.setNextProcessesIds(list);
|
|
|
+ List<ProductionProcesses> nextpros = new ArrayList<>();
|
|
|
+ for (String nextProcessesId : prepro.getNextProcessesIds()) {
|
|
|
+ nextpros.add(allProMap.get(nextProcessesId));
|
|
|
+ }
|
|
|
+ prepro.setNextProcesses(nextpros);
|
|
|
+
|
|
|
+ // 当前合并退火作业设置前一道作业
|
|
|
+ if(!thps.get(0).getPreviousProcessesIds().contains(prepro.getId())){
|
|
|
+ thps.get(0).getPreviousProcessesIds().add(prepro.getId());
|
|
|
+ }
|
|
|
+ List<ProductionProcesses> previousProces = new ArrayList<>();
|
|
|
+ for (String pid : thps.get(0).getPreviousProcessesIds()) {
|
|
|
+ previousProces.add(allProMap.get(pid));
|
|
|
+ }
|
|
|
+ thps.get(0).setPreviousProcesses(previousProces);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 退火后一道作业设置上一道作业ID
|
|
|
+ if(thps.get(i).getNextProcessesIds() != null && thps.get(i).getNextProcessesIds().size()>0){
|
|
|
+ for (String nextProcessesId : thps.get(i).getNextProcessesIds()) {
|
|
|
+ ProductionProcesses nextpro = allProMap.get(nextProcessesId);
|
|
|
+ // 合并后关联关系重置
|
|
|
+ /*List<String> preids = new ArrayList<>();
|
|
|
+ preids.add(thps.get(0).getId());
|
|
|
+ nextpro.setPreviousProcessesIds(preids);*/
|
|
|
+ if(!nextpro.getPreviousProcessesIds().contains(thps.get(0).getId())){
|
|
|
+ int i1 = nextpro.getPreviousProcessesIds().indexOf(thps.get(i).getId());
|
|
|
+ nextpro.getPreviousProcessesIds().set(i1,thps.get(0).getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ProductionProcesses> nextprepros = new ArrayList<>();
|
|
|
+ for (String pid : nextpro.getPreviousProcessesIds()) {
|
|
|
+ nextprepros.add(allProMap.get(pid));
|
|
|
+ }
|
|
|
+ nextpro.setPreviousProcesses(nextprepros);
|
|
|
+
|
|
|
+ // 设置合并退火作业下一道工序
|
|
|
+ thps.get(0).getNextProcessesIds().addAll(thps.get(i).getNextProcessesIds());
|
|
|
+ List<ProductionProcesses> thnexts = new ArrayList<>();
|
|
|
+ for (String pid : thps.get(0).getNextProcessesIds()) {
|
|
|
+ thnexts.add(allProMap.get(pid));
|
|
|
+ }
|
|
|
+ thps.get(0).setNextProcesses(thnexts);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 小卷退火卷数合并
|
|
|
+ if(thps.get(i).getProcessType().equals("小卷成退")){
|
|
|
+ thps.get(0).setMinThPcNum(thps.get(0).getMinThPcNum()+thps.get(i).getMinThPcNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 取第一个作业作为合并作业
|
|
|
+ ProductionProcesses mergePro = thps.get(0);
|
|
|
+ mergePro.setVolumeWidth(mergePro.getVolumeWidth().multiply(new BigDecimal(thps.size())));
|
|
|
+ mergePro.setSinglerollweight(mergePro.getSinglerollweight().multiply(new BigDecimal(thps.size())));
|
|
|
+ mergePro.setOpeProducePcNum(thps.size());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 过滤被合并的退火作业
|
|
|
+ if(otherThproces != null && otherThproces.size()>0){
|
|
|
+ List<ProductionProcesses> mThs = apsSolution.getProcessesList().stream().filter(v -> {
|
|
|
+ boolean a = true;
|
|
|
+ for (ProductionProcesses otherThproce : otherThproces) {
|
|
|
+ if (otherThproce.getId().equals(v.getId())) {
|
|
|
+ a = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ apsSolution.setProcessesList(mThs);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|