| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.BasContainer; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreas; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.service.impl.BasContainerServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.impl.WarehouseAreasServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | |
| | | private LocService locService; |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | @Autowired |
| | | private BasContainerServiceImpl basContainerService; |
| | | |
| | | /** |
| | | * @author Munch D. Luffy |
| | |
| | | @Scheduled(cron = "0/15 * * * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void startCacheInLocStock() throws Exception { |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.AUTO_RUN_CHECK_ORDERS_YZ)); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.AUTO_RUN_CHECK_IN_YZ)); |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | return; |
| | | } |
| | | |
| | | String autoRunAreaStartYz = configService.getVal("AUTO_RUN_AREA_START_YZ", String.class); |
| | | String autoRunAreaStartYz = configService.getVal("AUTO_RUN_IN_START_YZ", String.class); |
| | | if (Cools.isEmpty(autoRunAreaStartYz)) { |
| | | return; |
| | | } |
| | | |
| | | String autoRunAreaEndYz = configService.getVal("AUTO_RUN_AREA_END_YZ", String.class); |
| | | String autoRunAreaEndYz = configService.getVal("AUTO_RUN_IN_END_YZ", String.class); |
| | | if (Cools.isEmpty(autoRunAreaEndYz)) { |
| | | return; |
| | | } |
| | |
| | | for (String c : split) { |
| | | WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c)); |
| | | if (!Cools.isEmpty(byId)) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, byId.getWarehouseId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type),false); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getAreaId, byId.getId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type),false); |
| | | if (!Objects.isNull(loc)) { |
| | | curLoc = loc.getCode(); |
| | | break; |
| | |
| | | for (String c : split) { |
| | | WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c)); |
| | | if (!Cools.isEmpty(byId)) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, byId.getWarehouseId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type),false); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getAreaId, byId.getId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type),false); |
| | | if (!Objects.isNull(loc)) { |
| | | deepLoc = loc.getCode(); |
| | | break; |
| | |
| | | */ |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void complateOutStock() throws Exception { |
| | | System.out.println("缓存区域自动生成空货架出库任务"); |
| | | public void startCacheOutLocStock() throws Exception { |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.AUTO_RUN_CHECK_OUT_YZ)); |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | return; |
| | | } |
| | | |
| | | String autoRunAreaStartYz = configService.getVal("AUTO_RUN_OUT_START_YZ", String.class); |
| | | if (Cools.isEmpty(autoRunAreaStartYz)) { |
| | | return; |
| | | } |
| | | |
| | | String autoRunAreaEndYz = configService.getVal("AUTO_RUN_OUT_END_YZ", String.class); |
| | | if (Cools.isEmpty(autoRunAreaEndYz)) { |
| | | return; |
| | | } |
| | | |
| | | String autoRunContainerEndYz = configService.getVal("AUTO_RUN_OUT_CONTAINER_YZ", String.class); |
| | | if (Cools.isEmpty(autoRunContainerEndYz)) { |
| | | return; |
| | | } |
| | | String curLoc = null; |
| | | String deepLoc = null; |
| | | try{ |
| | | String[] split = autoRunAreaStartYz.split(";"); |
| | | for (String c : split) { |
| | | WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c)); |
| | | if (!Cools.isEmpty(byId)) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getAreaId, byId.getId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type),false); |
| | | if (!Objects.isNull(loc)) { |
| | | curLoc = loc.getCode(); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("配置参数AUTO_RUN_AREA_START_YZ解析失败,请检查!!!"); |
| | | } |
| | | //容器集合 |
| | | //每个容器对应的容器码类型 |
| | | // |
| | | |
| | | try{ |
| | | // String[] containerList = autoRunContainerEndYz.split(";"); |
| | | // ArrayList<Long> CONTAINER_IDS = new ArrayList<>(); |
| | | // for (String c : containerList) { |
| | | // CONTAINER_IDS.add(Long.parseLong(c)); |
| | | // } |
| | | BasContainer basContainer = basContainerService.getOne(new LambdaQueryWrapper<BasContainer>() |
| | | .in(BasContainer::getContainerType, 1, false)); |
| | | // if (Cools.isEmpty(basContainer)){ |
| | | // throw new CoolException("未查询到相关容器规则"); |
| | | // } |
| | | // |
| | | // |
| | | List<Long> areaList = new ArrayList<>();//所有库区 |
| | | // List<Long> areaList1 = new ArrayList<>();//所有容器类型 |
| | | // List<Long> areaList2 = new ArrayList<>();//所有库区 |
| | | // List<Long> areaList3 = new ArrayList<>();//所有库区 |
| | | |
| | | boolean sign = true; |
| | | // //容器类型查询 起点 |
| | | String[] split = autoRunAreaEndYz.split(";"); |
| | | for (String c : split) { |
| | | WarehouseAreas byId = warehouseAreasService.getById(Integer.parseInt(c)); |
| | | if (!Cools.isEmpty(byId)) { |
| | | if (sign){ |
| | | areaList.add(byId.getId()); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getAreaId, byId.getId()).eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type),false); |
| | | if (!Objects.isNull(loc)) { |
| | | deepLoc = loc.getCode(); |
| | | sign = false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | String barcodeType = "barcode REGEXP '"+basContainer.getCodeType()+"'"; |
| | | List<Loc> loc1 = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .apply(barcodeType) |
| | | .eq(Loc::getDeleted, 0) |
| | | .eq(Loc::getStatus, 1) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type) |
| | | .in(Loc::getAreaId, areaList) |
| | | .orderByDesc(Loc::getId)); |
| | | |
| | | |
| | | } catch (Exception e){ |
| | | log.error("配置参数AUTO_RUN_AREA_START_YZ解析失败,请检查!!!"); |
| | | } |
| | | |
| | | if (curLoc == null || deepLoc == null) { |
| | | return; |
| | | } |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(curLoc).setTarLoc(deepLoc); |
| | | //生成移库位任务 |
| | | locItemService.genMoveTask(params, 9999L); |
| | | } |
| | | } |