| | |
| | | package com.zy.asrs.task; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.task.core.ReturnT; |
| | | import com.zy.asrs.task.handler.AutoEmptyOutHandler; |
| | | import com.zy.system.entity.Config; |
| | |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private AutoEmptyOutHandler autoEmptyOutHandler; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | |
| | | //定时空库位预留,空轴出库 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/30 * * * * ? ") |
| | | public void autoLocMove() { |
| | | Config config = configService.selectConfigByCode("AutoLocMove"); |
| | | if (Cools.isEmpty(config) || config.getValue().equals("false")) { |
| | | return; |
| | | } |
| | | try { |
| | | Integer existCount = wrkMastService.selectCount(new EntityWrapper<WrkMast>() |
| | | .eq("io_type", 101) |
| | | .eq("log_mk", "Y") |
| | | .eq("ove_mk", "N")); |
| | | int allow = 2 - (existCount == null ? 0 : existCount); |
| | | if (allow <= 0) { |
| | | return; |
| | | } |
| | | int created = 0; |
| | | for (int crnNo = 1; crnNo < 5 && created < allow; crnNo++) { |
| | | String result = autoEmptyOutHandler.moveMostMatnrInventoryInner(crnNo, 1L); |
| | | if (!Cools.isEmpty(result)) { |
| | | created++; |
| | | log.info("自动移库生成任务: {}", result); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("自动移库失败", e); |
| | | } |
| | | } |
| | | |
| | | } |