|
@@ -123,16 +123,16 @@ public class ApsServiceImpl implements ApsService {
|
|
|
BigDecimal singlerollweight2 = v2.getSinglerollweight();
|
|
|
|
|
|
int a = 0;
|
|
|
- // 宽度
|
|
|
- if(prowidth1.compareTo(prowidth2) == 0){
|
|
|
- // 合金
|
|
|
- if(alloy1.compareTo(alloy2) == 0){
|
|
|
- // 合金状态
|
|
|
- if(alloystatus1 == null || alloystatus2 == null || alloystatus1.compareTo(alloystatus2) == 0){
|
|
|
- // 产品类型
|
|
|
- if(producttype1 == null || producttype2 == null || producttype1.compareTo(producttype2) == 0){
|
|
|
- // 厚度
|
|
|
- if(thickness1.compareTo(thickness2) == 0){
|
|
|
+ // 合金
|
|
|
+ if(alloy1.compareTo(alloy2) == 0){
|
|
|
+ // 产品类型
|
|
|
+ if(producttype1 == null || producttype2 == null || producttype1.compareTo(producttype2) == 0){
|
|
|
+ // 宽度
|
|
|
+ if(prowidth1.compareTo(prowidth2) == 0){
|
|
|
+ // 厚度
|
|
|
+ if(thickness1.compareTo(thickness2) == 0){
|
|
|
+ // 合金状态
|
|
|
+ if(alloystatus1 == null || alloystatus2 == null || alloystatus1.compareTo(alloystatus2) == 0){
|
|
|
// 重量
|
|
|
if(singlerollweight1.compareTo(singlerollweight2) == 0){
|
|
|
a = 0;
|
|
@@ -142,47 +142,118 @@ public class ApsServiceImpl implements ApsService {
|
|
|
a = 1;
|
|
|
}
|
|
|
}else{
|
|
|
- if(thickness1.compareTo(thickness2) > 0){
|
|
|
- a = -1;
|
|
|
- }else{
|
|
|
- a = 1;
|
|
|
- }
|
|
|
+ a = alloystatus1.compareTo(alloystatus2);
|
|
|
}
|
|
|
}else{
|
|
|
- a = producttype1.compareTo(producttype2);
|
|
|
+ if(thickness1.compareTo(thickness2) > 0){
|
|
|
+ a = -1;
|
|
|
+ }else{
|
|
|
+ a = 1;
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
- a = alloystatus1.compareTo(alloystatus2);
|
|
|
+ if(prowidth1.compareTo(prowidth2) > 0){
|
|
|
+ a = -1;
|
|
|
+ }else{
|
|
|
+ a = 1;
|
|
|
+ }
|
|
|
}
|
|
|
}else{
|
|
|
- a = alloy1.compareTo(alloy2);
|
|
|
+ a = producttype1.compareTo(producttype2);
|
|
|
}
|
|
|
}else{
|
|
|
- if(prowidth1.compareTo(prowidth2) > 0){
|
|
|
- a = -1;
|
|
|
- }else{
|
|
|
- a = 1;
|
|
|
- }
|
|
|
+ a = alloy1.compareTo(alloy2);
|
|
|
}
|
|
|
return a;
|
|
|
});
|
|
|
-
|
|
|
+ // 排程
|
|
|
+ List<ProductionScheduleVo> productionScheduleVos = new ArrayList<>();
|
|
|
+ Map<String,List<ApsBlankOrderVo>> dataMap = new HashMap<>();
|
|
|
+ // 自动排序
|
|
|
+ List<List<ApsBlankOrderVo>> apsOrders = new ArrayList<>();
|
|
|
+ for (ApsBlankOrderVo apsBlankOrder : apsBlankOrders) {
|
|
|
+
|
|
|
+ }
|
|
|
apsBlankOrders.forEach((bo)->{
|
|
|
List<ApsBlankOrderVo> v = new ArrayList<>();
|
|
|
v.add(bo);
|
|
|
// 模型转换
|
|
|
ProductionScheduleVo productionScheduleVo = apsProductionScheduleInit(v);
|
|
|
+ productionScheduleVos.add(productionScheduleVo);
|
|
|
+ dataMap.put(productionScheduleVo.getProductionScheduleId(),v);
|
|
|
+ });
|
|
|
+ if(productionScheduleVos != null && productionScheduleVos.size()>0){
|
|
|
+ // 提前退火排程
|
|
|
+ ProductionScheduleVo productionScheduleThVo = new ProductionScheduleVo();
|
|
|
+ productionScheduleThVo.setProductionScheduleId("提前退火排程-"+SecurityUtil.getUUID());
|
|
|
+ productionScheduleThVo.setApsPlanStartDate(productionScheduleVos.get(0).getApsPlanStartDate());
|
|
|
+ productionScheduleThVo.setPlanSeconds(productionScheduleVos.get(0).getPlanSeconds());
|
|
|
+ productionScheduleThVo.setRoamTime(productionScheduleVos.get(0).getRoamTime());
|
|
|
+ productionScheduleThVo.setEnvironmentMode(productionScheduleVos.get(0).getEnvironmentMode());
|
|
|
+ productionScheduleThVo.setWashingtime(productionScheduleVos.get(0).getWashingtime());
|
|
|
+ productionScheduleThVo.setStandingtime(productionScheduleVos.get(0).getStandingtime());
|
|
|
+ productionScheduleThVo.setLooseness(productionScheduleVos.get(0).getLooseness());
|
|
|
+ productionScheduleThVo.setPcspeed(productionScheduleVos.get(0).getPcspeed());
|
|
|
+ List<ProductionProcesses> pros = new ArrayList<>();
|
|
|
+ List<Equipment> equipmentList = new ArrayList<>();
|
|
|
+ Map<String,List<String>> blankProcessIds = new HashMap<>();
|
|
|
+ List<WashingMetal> closealloynames = new ArrayList<>();
|
|
|
+ for (ProductionScheduleVo productionScheduleVo : productionScheduleVos) {
|
|
|
+ pros.addAll(productionScheduleVo.getProcesses());
|
|
|
+ for (Equipment equipment : productionScheduleVo.getEquipmentList()) {
|
|
|
+ List<Equipment> ess = equipmentList.stream().filter(v -> v.getBsEquipmentId().equals(equipment.getBsEquipmentId())).collect(Collectors.toList());
|
|
|
+ if(ess == null || ess.size() == 0){
|
|
|
+ equipmentList.add(equipment);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ blankProcessIds.putAll(productionScheduleVo.getBlankProcessIds());
|
|
|
+ closealloynames.addAll(productionScheduleVo.getClosealloynames());
|
|
|
+ }
|
|
|
+ productionScheduleThVo.setProcesses(pros);
|
|
|
+ productionScheduleThVo.setEquipmentList(equipmentList);
|
|
|
+ productionScheduleThVo.setBlankProcessIds(blankProcessIds);
|
|
|
+ productionScheduleThVo.setClosealloynames(closealloynames);
|
|
|
+ // 退火排程
|
|
|
JSONConfig jsonConfig = JSONConfig.create();
|
|
|
jsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- System.out.println("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
|
|
|
- logger.info("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
|
|
|
+ System.out.println("排程数据:" + JSONUtil.toJsonStr(productionScheduleThVo, jsonConfig));
|
|
|
+ logger.info("排程数据:" + JSONUtil.toJsonStr(productionScheduleThVo, jsonConfig));
|
|
|
// APS平台排程接口调用
|
|
|
- ProductionScheduleRetVo productionScheduleRetVo = rwApsServer.productionSchedule(productionScheduleVo);
|
|
|
- if (!"200".equals(productionScheduleRetVo.getCode())) {
|
|
|
- throw new CustomException(productionScheduleRetVo.getMsg());
|
|
|
+ ProductionScheduleRetVo productionScheduleRetThVo = rwApsServer.productionThSchedule(productionScheduleThVo);
|
|
|
+ if (!"200".equals(productionScheduleRetThVo.getCode())) {
|
|
|
+ throw new CustomException(productionScheduleRetThVo.getMsg());
|
|
|
}
|
|
|
- apsBlankOrderService.apsAfter(productionScheduleRetVo,v);
|
|
|
- });
|
|
|
+
|
|
|
+ // 全部排程
|
|
|
+ for (ProductionScheduleVo productionScheduleVo : productionScheduleVos) {
|
|
|
+ // 退火工序锁定
|
|
|
+ if(productionScheduleRetThVo.getProcesses() != null && productionScheduleRetThVo.getProcesses().size()>0){
|
|
|
+ for (ProductionProcesses process : productionScheduleVo.getProcesses()) {
|
|
|
+ for (ProductionProcesses productionScheduleRetThVoProcess : productionScheduleRetThVo.getProcesses()) {
|
|
|
+ if(productionScheduleRetThVoProcess.getId().equals(process.getId())){
|
|
|
+ process.setEquipmentId(productionScheduleRetThVoProcess.getEquipmentId());
|
|
|
+ List<String> opeqs = new ArrayList<>();
|
|
|
+ opeqs.add(productionScheduleRetThVoProcess.getEquipmentId());
|
|
|
+ process.setOptionalEquipments(opeqs);
|
|
|
+ process.setDelay(0);
|
|
|
+ process.setStartTime(productionScheduleRetThVoProcess.getStartTime());
|
|
|
+ process.setEndTime(productionScheduleRetThVoProcess.getEndTime());
|
|
|
+ process.setIfLock(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ System.out.println("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
|
|
|
+ logger.info("排程数据:" + JSONUtil.toJsonStr(productionScheduleVo, jsonConfig));
|
|
|
+ // APS平台排程接口调用
|
|
|
+ ProductionScheduleRetVo productionScheduleRetVo = rwApsServer.productionSchedule(productionScheduleVo);
|
|
|
+ if (!"200".equals(productionScheduleRetVo.getCode())) {
|
|
|
+ throw new CustomException(productionScheduleRetVo.getMsg());
|
|
|
+ }
|
|
|
+ apsBlankOrderService.apsAfter(productionScheduleRetVo,dataMap.get(productionScheduleVo.getProductionScheduleId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw e;
|
|
@@ -205,7 +276,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
// 待排程坯料计划ID集合
|
|
|
List<String> blankids = apsBlankOrders.stream().map(v -> v.getId()).collect(Collectors.toList());
|
|
|
ProductionScheduleVo productionScheduleVo = new ProductionScheduleVo();
|
|
|
- productionScheduleVo.setProductionScheduleId("批量排程");
|
|
|
+ productionScheduleVo.setProductionScheduleId("批量排程-"+SecurityUtil.getUUID());
|
|
|
List<ApsScheduleConfigDo> apsConfigs = apsScheduleConfigService.list();
|
|
|
ApsScheduleConfigDo apsScheduleConfig = null;
|
|
|
// 松散度
|