|
@@ -48,7 +48,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
ApsSolution apsSolutionTuihuo = new ApsSolution();
|
|
|
List<ProductionProcesses> tuihuos = new ArrayList<>();
|
|
|
for (ProductionProcesses process : apsSolution.getProcessesList()) {
|
|
|
- if(process.getProcessType().equals("成退") || process.getProcessType().equals("中退") || process.getProcessType().equals("小卷成退")){
|
|
|
+ if((process.getProcessType().equals("成退") || process.getProcessType().equals("中退") || process.getProcessType().equals("小卷成退")) && !process.getIfLock()){
|
|
|
List<Integer> preTimes = new ArrayList<>();
|
|
|
getAllPreTime(process,preTimes);
|
|
|
if(preTimes != null && preTimes.size()>0){
|
|
@@ -66,8 +66,22 @@ public class ApsServiceImpl implements ApsService {
|
|
|
// 全局配置
|
|
|
ApsOverallConfig apsOverallConfig = new ApsOverallConfig();
|
|
|
BeanUtil.copyProperties(process.getApsOverallConfig(),apsOverallConfig);
|
|
|
- if(process.getRooprocess() != null && process.getRooprocess().getStartTime() != null){
|
|
|
- apsOverallConfig.setStartTime(process.getRooprocess().getStartTime().plusMinutes(totaltime));
|
|
|
+ LocalDateTime startTime = null;
|
|
|
+ if(process.getMergeRooprocess() != null && process.getMergeRooprocess().size()>0){
|
|
|
+ for (ProductionProcesses mergeRooprocess : process.getMergeRooprocess()) {
|
|
|
+ if(mergeRooprocess.getStartTime() != null){
|
|
|
+ if(startTime == null){
|
|
|
+ startTime = mergeRooprocess.getStartTime();
|
|
|
+ }else{
|
|
|
+ if(mergeRooprocess.getStartTime().compareTo(startTime)>0){
|
|
|
+ startTime = mergeRooprocess.getStartTime();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(startTime != null){
|
|
|
+ apsOverallConfig.setStartTime(startTime.plusMinutes(totaltime));
|
|
|
}else{
|
|
|
apsOverallConfig.setStartTime(process.getApsOverallConfig().getStartTime().plusMinutes(totaltime));
|
|
|
}
|
|
@@ -91,8 +105,39 @@ public class ApsServiceImpl implements ApsService {
|
|
|
* @param apsSolution
|
|
|
*/
|
|
|
@Override
|
|
|
- public void tuihuoApsSch(ApsSolution apsSolution,List<ProductionProcesses> otherThproces){
|
|
|
+ public void tuihuoApsSch(ApsSolution apsSolution,List<ProductionProcesses> otherThproces,List<ProductionProcesses> otherNotZzFirstProces,ProductionScheduleVo productionScheduleVo){
|
|
|
+ if(otherNotZzFirstProces != null && otherNotZzFirstProces.size()>0){
|
|
|
+ otherNotZzFirstProces = new ArrayList<>();
|
|
|
+
|
|
|
+ List<ProductionProcesses> processesList = this.zzProcessAps(productionScheduleVo, apsSolution, otherNotZzFirstProces);
|
|
|
+ if(processesList != null && processesList.size()>0 && !processesList.get(0).getProcessType().equals("铸轧")){
|
|
|
+ for (ProductionProcesses productionProcesses : processesList) {
|
|
|
+ for (ProductionProcesses processes : apsSolution.getProcessesList()) {
|
|
|
+ if(processes.getId().equals(productionProcesses.getId())){
|
|
|
+ processes.setStartTime(productionProcesses.getStartTime());
|
|
|
+ processes.setEndTime(productionProcesses.getEndTime());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
ApsSolution apsSolutionTh = tuihuoAps(apsSolution);
|
|
|
+ if(otherNotZzFirstProces != null && otherNotZzFirstProces.size()>0){
|
|
|
+ // 取消第一道工序非铸轧提前排程的锁定状态
|
|
|
+ if(otherNotZzFirstProces != null && otherNotZzFirstProces.size()>0){
|
|
|
+ for (ProductionProcesses otherSerProcesMerge : apsSolution.getProcessesList()) {
|
|
|
+ List<ProductionProcesses> list1 = otherNotZzFirstProces.stream().filter(v -> v.getId().equals(otherSerProcesMerge.getId())).collect(Collectors.toList());
|
|
|
+ if(list1 != null && list1.size()>0){
|
|
|
+ otherSerProcesMerge.setIfLock(false);
|
|
|
+ otherSerProcesMerge.setStartTime(null);
|
|
|
+ otherSerProcesMerge.setEndTime(null);
|
|
|
+ otherSerProcesMerge.setEquipment(null);
|
|
|
+ otherSerProcesMerge.setEquipmentId(null);
|
|
|
+ otherSerProcesMerge.setDelay(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// 退火工序求解器运行
|
|
|
int processNum1 = apsSolutionTh.getProcessesList().size();
|
|
|
int runPlanSeconds1 = (processNum1)*30;
|
|
@@ -108,7 +153,32 @@ public class ApsServiceImpl implements ApsService {
|
|
|
);
|
|
|
Solver<ApsSolution> solver1 = solverFactory1.buildSolver();
|
|
|
// 按照宽度排序
|
|
|
- apsSolutionTh.getProcessesList().sort(Comparator.comparing(ProductionProcesses::getSeriesProduceMark));
|
|
|
+// apsSolutionTh.getProcessesList().sort(Comparator.comparing(ProductionProcesses::getSeriesProduceMark));
|
|
|
+ Collections.sort(apsSolutionTh.getProcessesList(),(v1,v2)->{
|
|
|
+ int a = 0;
|
|
|
+ // 合金
|
|
|
+ String alloy1 = v1.getVolumeMetal();
|
|
|
+ String alloy2 = v2.getVolumeMetal();
|
|
|
+ // 合金状态
|
|
|
+ String alloystatus1 = v1.getVolumeMetalstate();
|
|
|
+ String alloystatus2 = v2.getVolumeMetalstate();
|
|
|
+ // 合金
|
|
|
+ if(alloy1.compareTo(alloy2) == 0){
|
|
|
+ // 合金状态
|
|
|
+ if(alloystatus1 == null || alloystatus2 == null || alloystatus1.compareTo(alloystatus2) == 0){
|
|
|
+ if(v1.getApsOverallConfig().getStartTime().compareTo(v2.getApsOverallConfig().getStartTime()) == 0){
|
|
|
+ a = v2.getVolumeWidth().compareTo(v1.getVolumeWidth());
|
|
|
+ }else{
|
|
|
+ a = v2.getApsOverallConfig().getStartTime().compareTo(v1.getApsOverallConfig().getStartTime());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ a = alloystatus1.compareTo(alloystatus2);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ a = alloy1.compareTo(alloy2);
|
|
|
+ }
|
|
|
+ return a;
|
|
|
+ });
|
|
|
ApsSolution solvedBalance1 = solver1.solve(apsSolutionTh);
|
|
|
log.info("**************退火排程评分分析***************");
|
|
|
SolutionManager<ApsSolution, HardSoftScore> scoreManager1 = SolutionManager.create(solverFactory1);
|
|
@@ -297,14 +367,19 @@ public class ApsServiceImpl implements ApsService {
|
|
|
* @param preTimes
|
|
|
*/
|
|
|
private void getAllPreTime(ProductionProcesses process,List<Integer> preTimes){
|
|
|
- if(process.getPreviousProcesses() != null){
|
|
|
+ if(process.getPreviousProcesses() != null && process.getPreviousProcesses().size()>0 && !"铸轧".equals(process.getPreviousProcesses().get(0).getProcessType())){
|
|
|
Integer lzTime = process.getApsOverallConfig().getRoamTime().get("WORKSHOP_IN");
|
|
|
if(process.getPreviousProcesses().get(0).getMinWaitTime() != null){
|
|
|
if(process.getPreviousProcesses().get(0).getMinWaitTime()>lzTime){
|
|
|
lzTime = process.getPreviousProcesses().get(0).getMinWaitTime();
|
|
|
}
|
|
|
}
|
|
|
- int pretime = process.getPreviousProcesses().get(0).getProduceTime() * process.getPreviousProcesses().get(0).getProducePcNum() + lzTime;
|
|
|
+ int pretime = 0;
|
|
|
+ if(process.getPreviousProcesses().get(0).getProcessType().equals("退火")){
|
|
|
+ pretime = process.getPreviousProcesses().get(0).getProduceTime() + lzTime;
|
|
|
+ }else{
|
|
|
+ pretime = process.getPreviousProcesses().get(0).getProduceTime() * process.getPreviousProcesses().size() + lzTime;
|
|
|
+ }
|
|
|
preTimes.add(pretime);
|
|
|
getAllPreTime(process.getPreviousProcesses().get(0),preTimes);
|
|
|
}
|
|
@@ -492,6 +567,8 @@ public class ApsServiceImpl implements ApsService {
|
|
|
if(i>0){
|
|
|
// 设置待合并退火的主ID
|
|
|
thps.get(i).setMergeThMainId(thps.get(0).getId());
|
|
|
+ // 设置合并作业的根节点
|
|
|
+ thps.get(0).getMergeRooprocess().add(thps.get(i).getRooprocess());
|
|
|
otherThproces.add(thps.get(i));
|
|
|
// 退火前一道作业设置下一作业ID
|
|
|
ProductionProcesses prepro = allProMap.get(thps.get(i).getPreviousProcessesIds().get(0));
|
|
@@ -1698,6 +1775,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<ProductionProcesses> zzProcessAps(ProductionScheduleVo productionScheduleVo, ApsSolution apsSolution,List<ProductionProcesses> otherNotZzFirstProces) {
|
|
|
+ List<ProductionProcesses> retPros = null;
|
|
|
ApsSolution apsSolutionZz = new ApsSolution();
|
|
|
List<ProductionProcesses> zzprocesList = new ArrayList<>();
|
|
|
for (ProductionProcesses process : apsSolution.getProcessesList()) {
|
|
@@ -1799,7 +1877,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
}
|
|
|
}
|
|
|
List<ProductionProcesses> mergeZzLists = solvedBalance1.getProcessesList().stream().filter(v ->v.getMergeProOrders() != null && v.getMergeProOrders().size() > 0).collect(Collectors.toList());
|
|
|
- if(mergeZzLists != null && mergeZzLists.size() > 0){
|
|
|
+ if(mergeZzLists != null && mergeZzLists.size() > 0 && mergeZzLists.get(0).getProcessType().equals("铸轧")){
|
|
|
for (ProductionProcesses mergeZz : mergeZzLists) {
|
|
|
List<String> mergeProOrders = mergeZz.getMergeProOrders();
|
|
|
boolean hasreplacenextLock = false;
|
|
@@ -1824,7 +1902,9 @@ public class ApsServiceImpl implements ApsService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ retPros = solvedBalance1.getProcessesList();
|
|
|
}
|
|
|
- return null;
|
|
|
+ return retPros;
|
|
|
}
|
|
|
}
|