| | |
| | | |
| | | import com.zy.asrs.entity.BasLiftOpt; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Delete; |
| | | import org.apache.ibatis.annotations.Insert; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | |
| | | |
| | | List<Map<String, Object>> selectRunStatistic();//获取提升机每天运行数据 |
| | | |
| | | @Insert("insert into asr_bas_lift_opt_storage select * from asr_bas_lift_opt where id in (select id from asr_bas_lift_opt where DATEDIFF(day, send_time, GETDATE()) > #{day})") |
| | | int saveToStorage(Integer day); |
| | | |
| | | @Delete("delete from asr_bas_lift_opt where id in (select id from asr_bas_lift_opt where DATEDIFF(day, send_time, GETDATE()) > #{day})") |
| | | int deleteByDay(Integer day); |
| | | |
| | | } |
| | |
| | | |
| | | BasLiftOpt selectByDeviceWrk(String deviceWrk, Integer liftNo); |
| | | |
| | | int saveToStorage(Integer day); |
| | | |
| | | int deleteByDay(Integer day); |
| | | |
| | | } |
| | |
| | | public BasLiftOpt selectByDeviceWrk(String deviceWrk, Integer liftNo) { |
| | | return this.baseMapper.selectByDeviceWrk(deviceWrk, liftNo); |
| | | } |
| | | |
| | | @Override |
| | | public int saveToStorage(Integer day) { |
| | | return this.baseMapper.saveToStorage(day); |
| | | } |
| | | |
| | | @Override |
| | | public int deleteByDay(Integer day) { |
| | | return this.baseMapper.deleteByDay(day); |
| | | } |
| | | } |
| | |
| | | if (wrkMast.getIoType() == 53 || wrkMast.getIoType() == 57) { |
| | | //拣料再回库,重新分配设备工作号 |
| | | int deviceWrk = commonService.getWorkNo(8);//生成提升机设备工作号 |
| | | BasLiftOpt basLiftOpt = basLiftOptService.selectByDeviceWrk(String.valueOf(deviceWrk), liftThread.getSlave().getId()); |
| | | if (basLiftOpt != null) { |
| | | News.info("{}任务,{}号提升机,设备工作号出现重复情况,请联系技术人员支持。", wrkMast.getWrkNo(), liftProtocol.getLiftNo()); |
| | | return false; |
| | | } |
| | | liftCommand.setTaskNo((short) deviceWrk); |
| | | } |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), sourceLiftSta.getStaNo(), wrkMast.getWrkNo()); |
| | | |
| | | int deviceWrk = commonService.getWorkNo(8);//生成提升机设备工作号 |
| | | BasLiftOpt basLiftOpt = basLiftOptService.selectByDeviceWrk(String.valueOf(deviceWrk), liftThread.getSlave().getId()); |
| | | if (basLiftOpt != null) { |
| | | News.info("{}任务,{}号提升机,设备工作号出现重复情况,请联系技术人员支持。", wrkMast.getWrkNo(), liftProtocol.getLiftNo()); |
| | | return false; |
| | | } |
| | | liftCommand.setTaskNo((short) deviceWrk);//更换随机任务号 |
| | | |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
New file |
| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.zy.asrs.service.BasLiftOptService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * 定时清理提升机命令 |
| | | * 每天晚上23点执行 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class ClearLiftOptScheduler { |
| | | |
| | | @Autowired |
| | | private BasLiftOptService basLiftOptService; |
| | | |
| | | @Scheduled(cron = "0 0 23 * * ? ") |
| | | @Transactional |
| | | public void clear() { |
| | | int count = basLiftOptService.saveToStorage(15); |
| | | int count2 = basLiftOptService.deleteByDay(15); |
| | | } |
| | | |
| | | } |
| | |
| | | * 生成工作号 |
| | | * @return workNo(工作号) |
| | | */ |
| | | public int getWorkNo(Integer wrkMk) { |
| | | public synchronized int getWorkNo(Integer wrkMk) { |
| | | WrkLastno wrkLastno = wrkLastnoService.selectById(wrkMk); |
| | | if (Cools.isEmpty(wrkLastno)) { |
| | | throw new CoolException("数据异常,请联系管理员"); |