Parcourir la source

aps-增加自动调度排程定时任务

sucheng il y a 5 mois
Parent
commit
6d4d6b75d3

+ 15 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsScheduleLogDao.java

@@ -0,0 +1,15 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.rongwei.bsentity.domain.ApsScheduleLogDo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Entity generator.domain.ApsScheduleLog
+ */
+public interface ApsScheduleLogDao extends BaseMapper<ApsScheduleLogDo> {
+
+}
+
+
+
+

+ 3 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsBlankOrderService.java

@@ -70,9 +70,11 @@ public interface ApsBlankOrderService extends IService<ApsBlankOrderDo> {
 
     R checkAddMaterial(AddMaterialReq req);
 
-    void apsScheduleRestart(Integer hour,String chongpaiStartDateStr,String chongpaiEndDateStr);
+    void apsScheduleRestart(Integer hour,String chongpaiStartDateStr,String chongpaiEndDateStr,SysUserVo currentUser);
 
     void sortLenZha(DateTime chongpaiEndDate);
 
     void sortTuiHuo(DateTime chongpaiEndDate);
+
+    void apsScheduleRestart2();
 }

+ 11 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/ApsScheduleLogService.java

@@ -0,0 +1,11 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.rongwei.bsentity.domain.ApsScheduleLogDo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ */
+public interface ApsScheduleLogService extends IService<ApsScheduleLogDo> {
+
+}

+ 95 - 34
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -16,6 +16,10 @@ import com.rongwei.bscommon.sys.service.*;
 import com.rongwei.bscommon.sys.utils.ApsUtils;
 import com.rongwei.bsentity.domain.*;
 import com.rongwei.bsentity.vo.*;
+import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
+import com.rongwei.rwadmincommon.system.service.SysOrganizationService;
+import com.rongwei.rwadmincommon.system.service.impl.SysOrganizationServiceImpl;
+import com.rongwei.rwadmincommon.system.vo.SysOrganizationVo;
 import com.rongwei.rwadmincommon.system.vo.SysUserVo;
 import com.rongwei.rwcommon.base.BaseDo;
 import com.rongwei.rwcommon.base.R;
@@ -39,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.Collator;
+import java.time.LocalTime;
 import java.time.ZoneId;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -121,6 +126,10 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     private ApsProcessOperationProcessEquDao apsProcessOperationProcessEquDao;
     @Autowired
     private ApsProductionProcessesService apsProductionProcessesService;
+    @Autowired
+    private SysOrganizationService sysOrganizationService;
+    @Autowired
+    private ApsScheduleLogService apsScheduleLogService;
 
 
     @Override
@@ -734,21 +743,21 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     @Override
     public void blankOrderAps(List<ApsBlankOrderVo> apsBlankOrders) {
         apsService.apsSchedule(apsBlankOrders, new ApsTypeVo(), null, null, null);
-//        //调度排程
-//        //判断是否是 18:00:00-24:00:00/00:00:00-5:00:00
-//        // 获取当前时间
-//        LocalTime now = LocalTime.now();
-//        // 定义时间段
-//        LocalTime startTime1 = LocalTime.of(18, 0); // 18:00:00
-//        LocalTime endTime1 = LocalTime.of(23, 59, 59); // 23:59:59 (24:00:00 - 1 second)
-//        LocalTime startTime2 = LocalTime.MIDNIGHT; // 00:00:00
-//        LocalTime endTime2 = LocalTime.of(5, 0); // 05:00:00
-//        // 检查当前时间是否在两个时间段之一内
-//        boolean isInFirstRange = (now.isAfter(startTime1) || now.equals(startTime1)) && (now.isBefore(endTime1) || now.equals(endTime1));
-//        boolean isInSecondRange = (now.isAfter(startTime2) || now.equals(startTime2)) && (now.isBefore(endTime2) || now.equals(endTime2));
-//        if (isInFirstRange || isInSecondRange) {
-//            apsScheduleRestart(null);
-//        }
+        //调度排程
+        //判断是否是 18:00:00-24:00:00/00:00:00-5:00:00
+        // 获取当前时间
+        LocalTime now = LocalTime.now();
+        // 定义时间段
+        LocalTime startTime1 = LocalTime.of(17, 0); // 17:00:00
+        LocalTime endTime1 = LocalTime.of(23, 59, 59); // 23:59:59 (24:00:00 - 1 second)
+        LocalTime startTime2 = LocalTime.MIDNIGHT; // 00:00:00
+        LocalTime endTime2 = LocalTime.of(5, 0); // 05:00:00
+        // 检查当前时间是否在两个时间段之一内
+        boolean isInFirstRange = (now.isAfter(startTime1) || now.equals(startTime1)) && (now.isBefore(endTime1) || now.equals(endTime1));
+        boolean isInSecondRange = (now.isAfter(startTime2) || now.equals(startTime2)) && (now.isBefore(endTime2) || now.equals(endTime2));
+        if (isInFirstRange || isInSecondRange) {
+            apsScheduleRestart(null, null, null, null);
+        }
     }
 
     /**
@@ -4173,8 +4182,11 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
     }
 
     @Override
-    public void apsScheduleRestart(Integer hour, String chongpaiStartDateStr, String chongpaiEndDateStr) {
-        ApsUtils.checkScheduling(null);
+    public void apsScheduleRestart(Integer hour, String chongpaiStartDateStr, String chongpaiEndDateStr, SysUserVo currentUser) {
+        if (currentUser == null) {
+            currentUser = CXCommonUtils.getCurrentUser();
+        }
+        ApsUtils.checkScheduling(currentUser);
         String needScheduleDate = "";
         DateTime chongpaiStartDate = null;
         DateTime chongpaiEndDate = null;
@@ -4206,7 +4218,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         if (ObjectUtil.isNotEmpty(needScheduleDate)) {
 
             //将实际完工时间大于明天的作业挪到实际完工时间
-            this.baseMapper.updateFinishDateAboutProcessEqu(needScheduleDate, CXCommonUtils.getCurrentUserFactoryId(null), chongpaiStartDate, chongpaiEndDate);
+            this.baseMapper.updateFinishDateAboutProcessEqu(needScheduleDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), chongpaiStartDate, chongpaiEndDate);
             //锁定所有 未锁定的 作业和作业明细
             apsProcessOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>()
                     .set(ApsProcessOperationProcessEquDo::getLockmarkdetail, "y")
@@ -4214,15 +4226,13 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             apsProcessOperationService.update(new LambdaUpdateWrapper<ApsProcessOperationDo>()
                     .set(ApsProcessOperationDo::getLockmark, "y")
                     .eq(ApsProcessOperationDo::getLockmark, "n"));
-//            //查询在重排时间前一天之后的所有作业明细信息,不包括:铸轧、成退、中退、小卷成退
-//            List<ApsProcessOperationProcessEquChongpaiVo> list = this.baseMapper.selectNeedRescheduleEqu(needScheduleDate, CXCommonUtils.getCurrentUserFactoryId(null));
             //排程设置
             ApsScheduleConfigDo apsScheduleConfigDo = apsScheduleConfigService.getById("1");
             try {
                 //冷轧重排
-                lenzhaChongpai(chongpaiStartDate, chongpaiEndDate, apsScheduleConfigDo);
+                lenzhaChongpai(chongpaiStartDate, chongpaiEndDate, apsScheduleConfigDo, currentUser);
                 //退火重排
-                tuihuoChongpai(chongpaiStartDate, chongpaiEndDate, apsScheduleConfigDo);
+                tuihuoChongpai(chongpaiStartDate, chongpaiEndDate, apsScheduleConfigDo, currentUser);
             } finally {
                 //锁定所有 未锁定的 作业和作业明细
                 apsProcessOperationProcessEquService.update(new LambdaUpdateWrapper<ApsProcessOperationProcessEquDo>()
@@ -4337,6 +4347,63 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         }
     }
 
+    @Override
+    public void apsScheduleRestart2() {
+        String bancaiTenantId = "0001S31000000000J0TR";
+        String bocaiTenantId = "0001651000000015EFDD";
+
+        Thread thread = new Thread(() -> {
+            doRestartSchedule(bancaiTenantId);
+        });
+        thread.start();
+
+        Thread thread1 = new Thread(() -> {
+            doRestartSchedule(bocaiTenantId);
+        });
+        thread1.start();
+    }
+
+    private void doRestartSchedule(String tenantId) {
+        //即将排程日期
+        DateTime nowDate = DateUtil.date();
+        String time1 = DateUtil.format(nowDate, "yyyy-MM-dd 00:00:00");
+        String time2 = DateUtil.format(nowDate, "yyyy-MM-dd 12:00:00");
+        String time3 = DateUtil.format(nowDate, "yyyy-MM-dd 23:59:59");
+        String now = DateUtil.format(nowDate, "yyyy-MM-dd HH:mm:ss");
+        //如果当前时间在0-12点,重排明天的
+        //如果当前时间在12-24点,重排后天的
+        String needScheduleDate = "";
+        if (now.compareTo(time1) >= 0 && now.compareTo(time2) < 0) {
+            needScheduleDate = DateUtil.format(DateUtil.offsetDay(nowDate, 1), "yyyy-MM-dd 12:00:00");
+        }
+        if (now.compareTo(time2) >= 0 && now.compareTo(time3) <= 0) {
+            needScheduleDate = DateUtil.format(DateUtil.offsetDay(nowDate, 2), "yyyy-MM-dd 12:00:00");
+        }
+        //查询日志判断是否已调度排程成功
+        int count = apsScheduleLogService.count(new LambdaQueryWrapper<ApsScheduleLogDo>()
+                .eq(ApsScheduleLogDo::getTenantid, tenantId)
+                .eq(ApsScheduleLogDo::getScheduletype, "调度排程")
+                .eq(ApsScheduleLogDo::getSucess,"是")
+                .le(ApsScheduleLogDo::getSchedulestarttime, needScheduleDate)
+                .ge(ApsScheduleLogDo::getScheduleendtime, needScheduleDate));
+        if (count > 0) {
+            log.info("{}已调度排程,无需排程", tenantId);
+            return;
+        }
+
+        SysUserVo currentUser = new SysUserVo();
+        currentUser.setId("8672bf72ab274bec83052868ae336b38");
+        currentUser.setName("管理员");
+        List<SysOrganizationVo> organizationVoList = new LinkedList<>();
+        SysOrganizationDo org = sysOrganizationService.getById(tenantId);
+        SysOrganizationVo sysOrganizationVo = BeanUtil.toBean(org, SysOrganizationVo.class);
+        organizationVoList.add(sysOrganizationVo);
+        currentUser.setOrganizationDoList(organizationVoList);
+        CXCommonUtils.getCurrentUserFactoryId(currentUser);
+
+        apsScheduleRestart(null, null, null, currentUser);
+    }
+
     //去除后续的冲突
     @Override
     public void sortLenZha(DateTime chongpaiEndDate) {
@@ -4393,10 +4460,10 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         }
     }
 
-    private void tuihuoChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo) {
+    private void tuihuoChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo, SysUserVo currentUser) {
         //退火重排
         //查询在重排时间段的所有作业明细信息,只包括:成退、中退、小卷成退
-        List<ApsProcessOperationProcessEquDo> needScheduleList = this.baseMapper.selectNeedRescheduleEqu2(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(null), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross());
+        List<ApsProcessOperationProcessEquDo> needScheduleList = this.baseMapper.selectNeedRescheduleEqu2(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross());
         if (needScheduleList.isEmpty()) {
             log.info("未查询到退火作业明细,结束排程");
             return;
@@ -4479,9 +4546,6 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         .in(ApsProcessOperationDo::getId, needUnLockProcessIdList)
         );
 
-//        //将调度时间范围内还未解锁的退火作业全部往后推一天
-//        this.baseMapper.setTuiHuoNextDay(CXCommonUtils.getCurrentUserFactoryId(null),chongpaiStartDate,chongpaiEndDate);
-
         //重新排程
         String scheduletype = apsScheduleConfigDo.getScheduletype();
         ApsTypeVo apsTypeVo = BeanUtil.toBean(scheduletype, ApsTypeVo.class);
@@ -4492,13 +4556,13 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         needUnLockProcessIdList.addAll(notNeedUnLockProcessIdList);
         needUnLockProcessIdList = needUnLockProcessIdList.stream().distinct().collect(Collectors.toList());
         log.info("所有传入退火排程的作业ID:{}", needUnLockProcessIdList);
-        apsService.apsSchedule(new ArrayList<>(), apsTypeVo, null, needUnLockProcessIdList, chongpaiStartDate);
+        apsService.apsSchedule(new ArrayList<>(), apsTypeVo, currentUser, needUnLockProcessIdList, chongpaiStartDate);
 
     }
 
-    private void lenzhaChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo) {
+    private void lenzhaChongpai(DateTime chongpaiStartDate, DateTime chongpaiEndDate, ApsScheduleConfigDo apsScheduleConfigDo, SysUserVo currentUser) {
         //查询需要重排的所有明细信息
-        List<ApsProcessOperationProcessEquDo> needScheduleList = this.baseMapper.selectNeedRescheduleEqu3(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(null), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross());
+        List<ApsProcessOperationProcessEquDo> needScheduleList = this.baseMapper.selectNeedRescheduleEqu3(chongpaiStartDate, chongpaiEndDate, CXCommonUtils.getCurrentUserFactoryId(currentUser), apsScheduleConfigDo.getWorkshopin(), apsScheduleConfigDo.getWorkshopcross());
         if (needScheduleList.isEmpty()) {
             log.info("未查询到冷轧作业明细,结束排程");
             return;
@@ -4653,9 +4717,6 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         .in(ApsProcessOperationDo::getId, needUnLockProcessIdList)
         );
 
-//        //将调度时间范围内还未解锁的冷轧作业全部往后推一天
-//        this.baseMapper.setLenZhaNextDay(CXCommonUtils.getCurrentUserFactoryId(null),chongpaiStartDate,chongpaiEndDate);
-
         String scheduletype = apsScheduleConfigDo.getScheduletype();
         ApsTypeVo apsTypeVo = BeanUtil.toBean(scheduletype, ApsTypeVo.class);
         apsTypeVo.setMixIf("default");
@@ -4667,7 +4728,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
         needUnLockProcessIdList.addAll(notNeedUnLockProcessIdList);
         needUnLockProcessIdList = needUnLockProcessIdList.stream().distinct().collect(Collectors.toList());
         log.info("所有传入冷轧排程的作业ID:{}", needUnLockProcessIdList);
-        apsService.apsSchedule(new ArrayList<>(), apsTypeVo, null, needUnLockProcessIdList, chongpaiStartDate);
+        apsService.apsSchedule(new ArrayList<>(), apsTypeVo, currentUser, needUnLockProcessIdList, chongpaiStartDate);
 
     }
 

+ 20 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsScheduleLogServiceImpl.java

@@ -0,0 +1,20 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.ApsScheduleLogDao;
+import com.rongwei.bscommon.sys.service.ApsScheduleLogService;
+import com.rongwei.bsentity.domain.ApsScheduleLogDo;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ */
+@Service
+public class ApsScheduleLogServiceImpl extends ServiceImpl<ApsScheduleLogDao, ApsScheduleLogDo>
+    implements ApsScheduleLogService {
+
+}
+
+
+
+

+ 32 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsServiceImpl.java

@@ -88,6 +88,8 @@ public class ApsServiceImpl implements ApsService {
     private ApsProcessOperationProcessEquService apsProcessOperationProcessEquService;
     @Autowired
     private ApsProcessOperationProcessEquDao apsProcessOperationProcessEquDao;
+    @Autowired
+    private ApsScheduleLogService apsScheduleLogService;
 
     /**
      * Aps排程
@@ -774,6 +776,8 @@ public class ApsServiceImpl implements ApsService {
             DateTime endTime = DateUtil.date();
             //日志写入文件
             logWriter(JSONUtil.toJsonStr(apsProductionSchedule, jsonConfig), JSONUtil.toJsonStr(productionScheduleRetVo, jsonConfig), apsType.getScheduleType());
+            //排程日志存入数据库
+            logSave(currentUser, startTime, endTime, apsType, apsPlanStartDate, productionScheduleRetVo);
             if (!"200".equals(productionScheduleRetVo.getCode())) {
                 logger.info("排程异常,坯料计划ID:" + blankOrderIds);
                 // 排程异常后恢复历史排程结果为锁定状态
@@ -838,6 +842,34 @@ public class ApsServiceImpl implements ApsService {
         }
     }
 
+    private void logSave(SysUserVo currentUser, DateTime startTime, DateTime endTime, ApsTypeVo apsType, Date apsPlanStartDate, ProductionScheduleRetVo productionScheduleRetVo) {
+        try {
+            ApsScheduleLogDo apsScheduleLogDo = new ApsScheduleLogDo();
+            apsScheduleLogDo.setId(SecurityUtil.getUUID());
+            apsScheduleLogDo.setScheduleuserid(currentUser.getId());
+            apsScheduleLogDo.setScheduleusername(currentUser.getName());
+            apsScheduleLogDo.setStarttime(startTime);
+            apsScheduleLogDo.setEndtime(endTime);
+            apsScheduleLogDo.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser));
+            if ("dd".equals(apsType.getScheduleType())) {
+                apsScheduleLogDo.setScheduletype("调度排程");
+                apsScheduleLogDo.setSchedulestarttime(apsPlanStartDate);
+                apsScheduleLogDo.setScheduleendtime(DateUtil.endOfDay(apsPlanStartDate));
+            } else {
+                apsScheduleLogDo.setScheduletype("预排程");
+            }
+            if (!"200".equals(productionScheduleRetVo.getCode())) {
+                apsScheduleLogDo.setSucess("否");
+                apsScheduleLogDo.setError(productionScheduleRetVo.getMsg());
+            } else {
+                apsScheduleLogDo.setSucess("是");
+            }
+            apsScheduleLogService.save(apsScheduleLogDo);
+        } catch (Exception e) {
+            logger.error("保存排程日志失败:", e);
+        }
+    }
+
     private static void logWriter(String req, String res, String scheduleType) {
         String fileName = "";
         if (scheduleType.equals("dd")) {

+ 94 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/domain/ApsScheduleLogDo.java

@@ -0,0 +1,94 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.rongwei.rwcommon.base.BaseDo;
+import lombok.Data;
+
+/**
+ * 生产订单_坯料计划
+ * @TableName aps_schedule_log
+ */
+@TableName(value ="aps_schedule_log")
+@Data
+public class ApsScheduleLogDo extends BaseDo implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(value = "ID")
+    private String id;
+
+    /**
+     * 所属租户ID
+     */
+    @TableField(value = "TENANTID")
+    private String tenantid;
+
+    /**
+     * 扩展json格式配置
+     */
+    @TableField(value = "ROPTION")
+    private String roption;
+
+    /**
+     * 调度用户ID
+     */
+    @TableField(value = "SCHEDULEUSERID")
+    private String scheduleuserid;
+
+    /**
+     * 调度用户名称
+     */
+    @TableField(value = "SCHEDULEUSERNAME")
+    private String scheduleusername;
+
+    /**
+     * 排程开始时间
+     */
+    @TableField(value = "STARTTIME")
+    private Date starttime;
+
+    /**
+     * 排程结束时间
+     */
+    @TableField(value = "ENDTIME")
+    private Date endtime;
+
+    /**
+     * 排程类型
+     */
+    @TableField(value = "SCHEDULETYPE")
+    private String scheduletype;
+
+    /**
+     * 调度日期-起
+     */
+    @TableField(value = "SCHEDULESTARTTIME")
+    private Date schedulestarttime;
+
+    /**
+     * 调度日期-止
+     */
+    @TableField(value = "SCHEDULEENDTIME")
+    private Date scheduleendtime;
+
+    /**
+     * 是否成功
+     */
+    @TableField(value = "SUCESS")
+    private String sucess;
+
+    /**
+     * 异常信息
+     */
+    @TableField(value = "ERROR")
+    private String error;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 12 - 1
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsBlankOrderController.java

@@ -13,6 +13,7 @@ import com.rongwei.rwcommon.vo.CriteriaQuery;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.format.annotation.DateTimeFormat;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.web.bind.annotation.*;
 
 import java.sql.Date;
@@ -68,9 +69,19 @@ public class ApsBlankOrderController {
     public R apsScheduleRestart(@RequestParam(required = false) Integer hour,
                                 @RequestParam(required = false) String chongpaiStartDate,
                                 @RequestParam(required = false) String chongpaiEndDate) {
-        apsBlankOrderService.apsScheduleRestart(hour,chongpaiStartDate,chongpaiEndDate);
+        apsBlankOrderService.apsScheduleRestart(hour,chongpaiStartDate,chongpaiEndDate,null);
         return R.ok();
     }
+    /**
+     * 定时任务自动调度,每天1点和22点执行
+     */
+    @Scheduled(cron = "0 0 1,22 * * *")
+    @GetMapping("/apsScheduleRestart2")
+    public R apsScheduleRestart2() {
+        apsBlankOrderService.apsScheduleRestart2();
+        return R.ok();
+    }
+
 
     /**
      * 坯料计划锁定解锁