|
@@ -99,6 +99,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
@Override
|
|
|
public void apsSchedule(List<ApsBlankOrderVo> apsBlankOrders, ApsTypeVo apsType, SysUserVo currentUser, List<String> needUnLockProcessIdList, DateTime scheduleStartDate) {
|
|
|
logger.info("**********排程请求开始**********");
|
|
|
+ DateTime startTime = DateUtil.date();
|
|
|
if (apsType.getScheduleType() == null) {
|
|
|
apsType.setScheduleType("default");
|
|
|
}
|
|
@@ -155,9 +156,9 @@ public class ApsServiceImpl implements ApsService {
|
|
|
}
|
|
|
// 冷轧连续性问题重排
|
|
|
if (apsType != null && StrUtil.isNotBlank(apsType.getScheduleType()) && "dd".equals(apsType.getScheduleType())) {
|
|
|
- lzlxOrderSchedule(apsBlankOrders, currentUser, apsType, needUnLockProcessIdList, scheduleStartDate);
|
|
|
+ lzlxOrderSchedule(apsBlankOrders, currentUser, apsType, needUnLockProcessIdList, scheduleStartDate, startTime);
|
|
|
} else {
|
|
|
- apsOrderScheduleNew(apsBlankOrders, currentUser, apsType, needUnLockProcessIdList);
|
|
|
+ apsOrderScheduleNew(apsBlankOrders, currentUser, apsType, needUnLockProcessIdList, startTime);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -361,7 +362,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- private void apsOrderScheduleNew(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, ApsTypeVo apsType, List<String> needUnLockProcessIdList) {
|
|
|
+ private void apsOrderScheduleNew(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, ApsTypeVo apsType, List<String> needUnLockProcessIdList, DateTime startTime) {
|
|
|
logger.info("预排程开始...");
|
|
|
// 插单重排的优先排程
|
|
|
List<ApsBlankOrderVo> cdorders = apsBlankOrders.stream().filter(v -> "1".equals(v.getCdbs())).collect(Collectors.toList());
|
|
@@ -389,7 +390,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
Date finalApsPlanStartDate = apsPlanStartDate;
|
|
|
if (cdorders != null && cdorders.size() > 0) {
|
|
|
try {
|
|
|
- apsOrderScheduleApsNew(cdorders, currentUser, allEqs, finalApsPlanStartDate, apsType, needUnLockProcessIdList);
|
|
|
+ apsOrderScheduleApsNew(cdorders, currentUser, allEqs, finalApsPlanStartDate, apsType, needUnLockProcessIdList, startTime);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.info("排程异常", e);
|
|
@@ -485,7 +486,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
}
|
|
|
return a;
|
|
|
});
|
|
|
- apsOrderScheduleApsNew(v, currentUser, allEqs, finalApsPlanStartDate, apsType, null);
|
|
|
+ apsOrderScheduleApsNew(v, currentUser, allEqs, finalApsPlanStartDate, apsType, null, startTime);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
logger.info("排程异常", e);
|
|
@@ -516,7 +517,7 @@ public class ApsServiceImpl implements ApsService {
|
|
|
* @param apsBlankOrders
|
|
|
* @param currentUser
|
|
|
*/
|
|
|
- private void lzlxOrderSchedule(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, ApsTypeVo apsType, List<String> needUnLockProcessIdList, DateTime scheduleStartDate) {
|
|
|
+ private void lzlxOrderSchedule(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, ApsTypeVo apsType, List<String> needUnLockProcessIdList, DateTime scheduleStartDate, DateTime startTime) {
|
|
|
logger.info("调度排程开始...");
|
|
|
// 坯料计划排序
|
|
|
Collections.sort(apsBlankOrders, (v1, v2) -> {
|
|
@@ -620,10 +621,10 @@ public class ApsServiceImpl implements ApsService {
|
|
|
// needScheduleDate = DateUtil.format(DateUtil.offsetDay(nowDate, 2), "yyyy-MM-dd");
|
|
|
// }
|
|
|
// DateTime chongpaiStartDate = DateUtil.parseDate(needScheduleDate);
|
|
|
- apsOrderScheduleApsNew(apsBlankOrders, currentUser, allEqs, scheduleStartDate, apsType, needUnLockProcessIdList);
|
|
|
+ apsOrderScheduleApsNew(apsBlankOrders, currentUser, allEqs, scheduleStartDate, apsType, needUnLockProcessIdList, startTime);
|
|
|
}
|
|
|
|
|
|
- private void apsOrderScheduleApsNew(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, Map<String, Equipment> allEqs, Date apsPlanStartDate, ApsTypeVo apsType, List<String> needUnLockProcessIdList) {
|
|
|
+ private void apsOrderScheduleApsNew(List<ApsBlankOrderVo> apsBlankOrders, SysUserVo currentUser, Map<String, Equipment> allEqs, Date apsPlanStartDate, ApsTypeVo apsType, List<String> needUnLockProcessIdList, DateTime startTime) {
|
|
|
// 设备数据每批次开始清空
|
|
|
allEqs.clear();
|
|
|
// 排程前解锁所有待排程订单
|
|
@@ -769,6 +770,8 @@ public class ApsServiceImpl implements ApsService {
|
|
|
logger.info("排程数据:" + JSONUtil.toJsonStr(apsProductionSchedule, jsonConfig));
|
|
|
// APS平台排程接口调用
|
|
|
ProductionScheduleRetVo productionScheduleRetVo = rwApsServer.productionSchedule(apsProductionSchedule);
|
|
|
+ //排程结束时间
|
|
|
+ DateTime endTime = DateUtil.date();
|
|
|
//日志写入文件
|
|
|
logWriter(JSONUtil.toJsonStr(apsProductionSchedule, jsonConfig), JSONUtil.toJsonStr(productionScheduleRetVo, jsonConfig), apsType.getScheduleType());
|
|
|
if (!"200".equals(productionScheduleRetVo.getCode())) {
|
|
@@ -812,6 +815,22 @@ public class ApsServiceImpl implements ApsService {
|
|
|
throw new CustomException(productionScheduleRetVo.getMsg() + " " + DateUtil.formatDateTime(new Date()));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //排程结束后,查询修改时间在排程开始-排程结束之间的待开工的明细,判断其冲突
|
|
|
+ List<ApsProcessOperationProcessEquCheckVo> list = apsProcessOperationProcessEquDao.getNeedCheckEquList(startTime, endTime, CXCommonUtils.getCurrentUserFactoryId(currentUser));
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ for (ApsProcessOperationProcessEquCheckVo equDo : list) {
|
|
|
+ apsProcessOperationProcessEquService.checkProcessingTimeConflict(equDo,
|
|
|
+ null, null, null, equDo.getProcessWay(), new LinkedList<>());
|
|
|
+ ApsProcessOperationProcessEquDo apsProcessOperationProcessEquDo = apsProcessOperationProcessEquService.getById(equDo.getId());
|
|
|
+ // 判断是否存在设备不可用
|
|
|
+ apsProcessOperationProcessEquService.inspectionEquipmentIsAvailable(apsProcessOperationProcessEquDo,
|
|
|
+ apsProcessOperationProcessEquDo.getProcessdeviceid(),
|
|
|
+ apsProcessOperationProcessEquDo.getPlanstartdate(),
|
|
|
+ apsProcessOperationProcessEquDo.getPlanenddate(),
|
|
|
+ new LinkedList<>());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -825,9 +844,9 @@ public class ApsServiceImpl implements ApsService {
|
|
|
String now = DateUtil.format(DateUtil.date(), "yyyy-MM-dd");
|
|
|
fileName += DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss");
|
|
|
String filePath = "./rw-aps/" + now + "/scheduleReqAndRes/" + fileName + "req.txt";
|
|
|
- String content = req+
|
|
|
- "\r\n"+"====================================================================================\r\n"
|
|
|
- +res;
|
|
|
+ String content = req +
|
|
|
+ "\r\n" + "====================================================================================\r\n"
|
|
|
+ + res;
|
|
|
|
|
|
// 创建File对象
|
|
|
File file = new File(filePath);
|