|
@@ -87,7 +87,7 @@ public class ApsServiceImpl implements ApsService {
|
|
/**
|
|
/**
|
|
* Aps排程
|
|
* Aps排程
|
|
* @param apsBlankOrders
|
|
* @param apsBlankOrders
|
|
- * @param apsType cd:插单
|
|
|
|
|
|
+ * @param apsType cd:插单,lzcp:冷轧连续重排
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public void apsSchedule(List<ApsBlankOrderVo> apsBlankOrders,String apsType,SysUserVo currentUser) {
|
|
public void apsSchedule(List<ApsBlankOrderVo> apsBlankOrders,String apsType,SysUserVo currentUser) {
|
|
@@ -143,8 +143,12 @@ public class ApsServiceImpl implements ApsService {
|
|
List<String> repcIds = fbNotLock.stream().map(v -> v.getId()).collect(Collectors.toList());
|
|
List<String> repcIds = fbNotLock.stream().map(v -> v.getId()).collect(Collectors.toList());
|
|
logger.info("解锁重排订单:"+repcIds);
|
|
logger.info("解锁重排订单:"+repcIds);
|
|
}
|
|
}
|
|
- apsOrderScheduleNew(apsBlankOrders,currentUser);
|
|
|
|
-// apsOrderSchedule(apsBlankOrders,currentUser);
|
|
|
|
|
|
+ // 冷轧连续性问题重排
|
|
|
|
+ if(StrUtil.isNotBlank(apsType) && "lzcp".equals(apsType)){
|
|
|
|
+ lzlxOrderSchedule(apsBlankOrders,currentUser);
|
|
|
|
+ }else{
|
|
|
|
+ apsOrderScheduleNew(apsBlankOrders,currentUser);
|
|
|
|
+ }
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
logger.info("排程异常",e);
|
|
logger.info("排程异常",e);
|
|
@@ -385,6 +389,77 @@ public class ApsServiceImpl implements ApsService {
|
|
if(voms != null && voms.size()>0){
|
|
if(voms != null && voms.size()>0){
|
|
voms.forEach((k, v)->{
|
|
voms.forEach((k, v)->{
|
|
try{
|
|
try{
|
|
|
|
+ // 坯料计划排序
|
|
|
|
+ Collections.sort(v,(v1,v2)->{
|
|
|
|
+ // 合金
|
|
|
|
+ String alloy1 = v1.getAlloy();
|
|
|
|
+ String alloy2 = v2.getAlloy();
|
|
|
|
+ // 合金状态
|
|
|
|
+ String alloystatus1 = v1.getAlloystatus();
|
|
|
|
+ String alloystatus2 = v2.getAlloystatus();
|
|
|
|
+ // 产品类型
|
|
|
|
+ String producttype1 = v1.getProducttype();
|
|
|
|
+ String producttype2 = v2.getProducttype();
|
|
|
|
+ // 宽度
|
|
|
|
+ BigDecimal prowidth1 = v1.getProwidth();
|
|
|
|
+ BigDecimal prowidth2 = v2.getProwidth();
|
|
|
|
+ // 厚度
|
|
|
|
+ BigDecimal thickness1 = v1.getThickness();
|
|
|
|
+ BigDecimal thickness2 = v2.getThickness();
|
|
|
|
+ // 重量
|
|
|
|
+ BigDecimal singlerollweight1 = v1.getSinglerollweight();
|
|
|
|
+ BigDecimal singlerollweight2 = v2.getSinglerollweight();
|
|
|
|
+
|
|
|
|
+ int a = 0;
|
|
|
|
+ // 插单优先
|
|
|
|
+ if(v1.getCdbs().compareTo(v2.getCdbs()) == 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){
|
|
|
|
+ // 按照订单排序
|
|
|
|
+ if(v1.getProductionorderid().compareTo(v2.getProductionorderid()) == 0){
|
|
|
|
+ // 卷数从大到小
|
|
|
|
+ a = v2.getRollnum().compareTo(v1.getRollnum());
|
|
|
|
+ }else{
|
|
|
|
+ a = v1.getProductionorderid().compareTo(v2.getProductionorderid());
|
|
|
|
+ }
|
|
|
|
+ }else if(singlerollweight1.compareTo(singlerollweight2) > 0){
|
|
|
|
+ a = -1;
|
|
|
|
+ }else{
|
|
|
|
+ a = 1;
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ a = alloystatus1.compareTo(alloystatus2);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ if(thickness1.compareTo(thickness2) > 0){
|
|
|
|
+ a = -1;
|
|
|
|
+ }else{
|
|
|
|
+ a = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ if(prowidth1.compareTo(prowidth2) > 0){
|
|
|
|
+ a = -1;
|
|
|
|
+ }else{
|
|
|
|
+ a = 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ a = producttype1.compareTo(producttype2);
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ a = v1.getCdbs().compareTo(v2.getCdbs());
|
|
|
|
+ }
|
|
|
|
+ return a;
|
|
|
|
+ });
|
|
apsOrderScheduleApsNew(v,currentUser,allEqs, finalApsPlanStartDate);
|
|
apsOrderScheduleApsNew(v,currentUser,allEqs, finalApsPlanStartDate);
|
|
}catch (Exception e) {
|
|
}catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -410,9 +485,12 @@ public class ApsServiceImpl implements ApsService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void apsOrderScheduleApsNew(List<ApsBlankOrderVo> apsBlankOrders,SysUserVo currentUser,Map<String,Equipment> allEqs,Date apsPlanStartDate){
|
|
|
|
- // 设备数据每批次开始清空
|
|
|
|
- allEqs.clear();
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 冷轧连续混排
|
|
|
|
+ * @param apsBlankOrders
|
|
|
|
+ * @param currentUser
|
|
|
|
+ */
|
|
|
|
+ private void lzlxOrderSchedule(List<ApsBlankOrderVo> apsBlankOrders,SysUserVo currentUser){
|
|
// 坯料计划排序
|
|
// 坯料计划排序
|
|
Collections.sort(apsBlankOrders,(v1,v2)->{
|
|
Collections.sort(apsBlankOrders,(v1,v2)->{
|
|
// 合金
|
|
// 合金
|
|
@@ -435,12 +513,12 @@ public class ApsServiceImpl implements ApsService {
|
|
BigDecimal singlerollweight2 = v2.getSinglerollweight();
|
|
BigDecimal singlerollweight2 = v2.getSinglerollweight();
|
|
|
|
|
|
int a = 0;
|
|
int a = 0;
|
|
- // 插单优先
|
|
|
|
- if(v1.getCdbs().compareTo(v2.getCdbs()) == 0){
|
|
|
|
- // 产品类型
|
|
|
|
- if(producttype1 == null || producttype2 == null || producttype1.compareTo(producttype2) == 0){
|
|
|
|
- // 宽度
|
|
|
|
- if(prowidth1.compareTo(prowidth2) == 0){
|
|
|
|
|
|
+ // 宽度
|
|
|
|
+ if(prowidth1.compareTo(prowidth2) == 0){
|
|
|
|
+ // 合金
|
|
|
|
+ if(alloy1.compareTo(alloy2) == 0){
|
|
|
|
+ // 产品类型
|
|
|
|
+ if(producttype1 == null || producttype2 == null || producttype1.compareTo(producttype2) == 0){
|
|
// 厚度
|
|
// 厚度
|
|
if(thickness1.compareTo(thickness2) == 0){
|
|
if(thickness1.compareTo(thickness2) == 0){
|
|
// 合金状态
|
|
// 合金状态
|
|
@@ -470,20 +548,43 @@ public class ApsServiceImpl implements ApsService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- if(prowidth1.compareTo(prowidth2) > 0){
|
|
|
|
- a = -1;
|
|
|
|
- }else{
|
|
|
|
- a = 1;
|
|
|
|
- }
|
|
|
|
|
|
+ a = producttype1.compareTo(producttype2);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- a = producttype1.compareTo(producttype2);
|
|
|
|
|
|
+ a = alloy1.compareTo(alloy2);
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- a = v1.getCdbs().compareTo(v2.getCdbs());
|
|
|
|
|
|
+ if(prowidth1.compareTo(prowidth2) > 0){
|
|
|
|
+ a = -1;
|
|
|
|
+ }else{
|
|
|
|
+ a = 1;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return a;
|
|
return a;
|
|
});
|
|
});
|
|
|
|
+ Map<String,Equipment> allEqs = new HashMap<>();
|
|
|
|
+ // 统一排程开始时间
|
|
|
|
+ List<ApsScheduleConfigDo> apsConfigs = apsScheduleConfigService.list();
|
|
|
|
+ Date apsPlanStartDate = new Date();
|
|
|
|
+ if(apsConfigs != null && apsConfigs.size()>0){
|
|
|
|
+ ApsScheduleConfigDo apsScheduleConfig = apsConfigs.get(0);
|
|
|
|
+ int a = 8;
|
|
|
|
+ if (apsScheduleConfig.getStartschedulerun() != null) {
|
|
|
|
+ a = apsScheduleConfig.getStartschedulerun();
|
|
|
|
+ }
|
|
|
|
+ if (apsScheduleConfig.getApsplanstartdate() != null) {
|
|
|
|
+ apsPlanStartDate = apsScheduleConfig.getApsplanstartdate();
|
|
|
|
+ } else {
|
|
|
|
+ apsPlanStartDate = DateUtil.date().offset(DateField.HOUR, a);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Date finalApsPlanStartDate = apsPlanStartDate;
|
|
|
|
+ apsOrderScheduleApsNew(apsBlankOrders,currentUser,allEqs, finalApsPlanStartDate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void apsOrderScheduleApsNew(List<ApsBlankOrderVo> apsBlankOrders,SysUserVo currentUser,Map<String,Equipment> allEqs,Date apsPlanStartDate){
|
|
|
|
+ // 设备数据每批次开始清空
|
|
|
|
+ allEqs.clear();
|
|
// 排程前解锁所有待排程订单
|
|
// 排程前解锁所有待排程订单
|
|
List<String> blankOrderIds = new ArrayList<>();
|
|
List<String> blankOrderIds = new ArrayList<>();
|
|
apsBlankOrders.forEach((bo)->{
|
|
apsBlankOrders.forEach((bo)->{
|
|
@@ -783,6 +884,7 @@ public class ApsServiceImpl implements ApsService {
|
|
produceOrder.setMaxheatroll(apsBlankOrderVo.getMaxheatroll());
|
|
produceOrder.setMaxheatroll(apsBlankOrderVo.getMaxheatroll());
|
|
produceOrder.setOrderNo(apsBlankOrderVo.getBlanknumber());
|
|
produceOrder.setOrderNo(apsBlankOrderVo.getBlanknumber());
|
|
produceOrder.setCustomerOrderId(apsBlankOrderVo.getProductionorderid());
|
|
produceOrder.setCustomerOrderId(apsBlankOrderVo.getProductionorderid());
|
|
|
|
+ produceOrder.setProwidth(apsBlankOrderVo.getProwidth());
|
|
// 期望交货天数
|
|
// 期望交货天数
|
|
produceOrder.setExpecteddays(productionScheduleVo.getExpecteddays());
|
|
produceOrder.setExpecteddays(productionScheduleVo.getExpecteddays());
|
|
if(apsBlankOrderVo.getExpecteddays() != null && apsBlankOrderVo.getExpecteddays()>0){
|
|
if(apsBlankOrderVo.getExpecteddays() != null && apsBlankOrderVo.getExpecteddays()>0){
|