| | |
| | | import com.vincent.rsf.server.manager.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.utils.WarehouseLocationRetrievalUtil; |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | | import com.vincent.rsf.server.system.service.ConfigService; |
| | |
| | | * 自动生成库位明细 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Scheduled(cron = "0/25 * * * * ?") |
| | | // @Scheduled(cron = "0/25 * * * * ?") |
| | | public void insertRandomMats() { |
| | | List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)); |
| | | for (Loc loc : list) { |
| | |
| | | //获取任务列表中,为盘点出库的任务 |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, |
| | | TaskType.TASK_TYPE_PICK_IN.type, |
| | | TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, |
| | | TaskType.TASK_TYPE_CHECK_IN.type))); |
| | | // TaskType.TASK_TYPE_PICK_IN.type, |
| | | TaskType.TASK_TYPE_PICK_AGAIN_OUT.type |
| | | // , |
| | | // TaskType.TASK_TYPE_CHECK_IN.type |
| | | ) |
| | | ) |
| | | ); |
| | | |
| | | if (!tasks.isEmpty()) { |
| | | tasks.forEach(task -> { |
| | |
| | | }); |
| | | List<BasStation> stations = stationService.list(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStatus, 1) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)); |
| | | ); |
| | | // .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | List<String> stationNames = stations.stream().map(BasStation::getStationName).collect(Collectors.toList()); |
| | | if (Cools.isEmpty(stations)) { |
| | | throw new CoolException("无可用站点!!"); |
| | | } |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .in(DeviceSite::getSite, stationNames) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type).last("limit 1")); |
| | | if (Cools.isEmpty(deviceSite)) { |
| | | throw new CoolException("无可用路径!!"); |
| | | } |
| | | //生成盘点任务参数 |
| | | LocToTaskParams locToTaskParams = new LocToTaskParams(); |
| | | locToTaskParams.setType(Constants.TASK_TYPE_OUT_CHECK) |
| | | .setItems(locItems) |
| | | .setSiteNo(deviceSite.getSite()) |
| | | .setOrgLoc(loc.getCode()); |
| | | for (String stationName : stationNames) { |
| | | boolean isItAvailable = new WarehouseLocationRetrievalUtil().queryPathIsItAvailableOutArea(loc.getAreaId(), stationName, loc.getBarcode(), TaskType.TASK_TYPE_CHECK_OUT.type); |
| | | if (!isItAvailable) { |
| | | continue; |
| | | } |
| | | //生成盘点任务参数 |
| | | LocToTaskParams locToTaskParams = new LocToTaskParams(); |
| | | locToTaskParams.setType(Constants.TASK_TYPE_OUT_CHECK) |
| | | .setItems(locItems) |
| | | .setSiteNo(stationName) |
| | | .setOrgLoc(loc.getCode()); |
| | | |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTargSite, deviceSite.getSite())); |
| | | if (!tasks.isEmpty()) { |
| | | continue; |
| | | } |
| | | try { |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, locToTaskParams, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTargSite, stationName)); |
| | | if (!tasks.isEmpty()) { |
| | | continue; |
| | | } |
| | | try { |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, locToTaskParams, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |