|
@@ -4623,6 +4623,63 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void apsScheduleRestart3() {
|
|
|
+ String bocaiTenantId = "0001651000000015EFDD";
|
|
|
+ Thread thread1 = new Thread(() -> {
|
|
|
+ log.info("连续调度5天线程开始执行:{}", bocaiTenantId);
|
|
|
+ SysUserVo currentUser = new SysUserVo();
|
|
|
+ currentUser.setId("8672bf72ab274bec83052868ae336b38");
|
|
|
+ currentUser.setName("管理员");
|
|
|
+ List<SysOrganizationVo> organizationVoList = new LinkedList<>();
|
|
|
+ SysOrganizationDo org = sysOrganizationService.getById(bocaiTenantId);
|
|
|
+ SysOrganizationVo sysOrganizationVo = BeanUtil.toBean(org, SysOrganizationVo.class);
|
|
|
+ organizationVoList.add(sysOrganizationVo);
|
|
|
+ currentUser.setOrganizationDoList(organizationVoList);
|
|
|
+ CXCommonUtils.getCurrentUserFactoryId(currentUser);
|
|
|
+
|
|
|
+ DateTime nowDate = DateUtil.date();
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ String needScheduleStartDate = DateUtil.format(DateUtil.offsetDay(nowDate, 1), "yyyy-MM-dd 12:00:00");
|
|
|
+ String needScheduleEndDate = DateUtil.format(DateUtil.offsetDay(nowDate, 6), "yyyy-MM-dd 12:00:00");
|
|
|
+
|
|
|
+ while (true) {
|
|
|
+ // 按照所属工厂加锁
|
|
|
+ RLock rLock = redissonClient.getLock(bocaiTenantId);
|
|
|
+ boolean isLocked = rLock.isLocked();
|
|
|
+ // 锁是否被占用
|
|
|
+ if (isLocked) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(640000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ApsProcessOperationProcessEquDo latest = this.baseMapper.selectLatestEqu();
|
|
|
+ if (latest.getPlanstartdate().before(DateUtil.parse(needScheduleStartDate))) {
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ nowDate = DateUtil.offsetDay(nowDate, 1);
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ //冷轧5天
|
|
|
+// String lenzhaEndDate = DateUtil.format(DateUtil.offsetDay(DateUtil.parse(needScheduleStartDate), 5), "yyyy-MM-dd HH:mm:ss");
|
|
|
+ apsScheduleRestart(null, needScheduleStartDate, needScheduleEndDate, currentUser, null, true, false);
|
|
|
+ //退火5天
|
|
|
+ apsScheduleRestart(null, needScheduleStartDate, needScheduleEndDate, currentUser, null, false, true);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ log.info("连续调度5天线程执行完成:{}", bocaiTenantId);
|
|
|
+ });
|
|
|
+ thread1.start();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void apsScheduleRestart2() {
|
|
|
String bancaiTenantId = "0001S31000000000J0TR";
|