| | |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private BasStationService basStationService; |
| | | @Autowired |
| | | private LocItemWorkingService locItemWorkingService; |
| | | |
| | | |
| | | /** |
| | |
| | | @Override |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | public synchronized void generateTaskEmpty(Short resouce, LocToTaskParams map, Long loginUserId, String taskNo) throws Exception { |
| | | if (Objects.isNull(map.getSiteNo())) { |
| | | throw new CoolException("目标站点不能为空!"); |
| | | } |
| | |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位状态更新失败!!"); |
| | | } |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | String ruleCode = StringUtils.isBlank(taskNo) ? SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null) : taskNo; |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setResource(resouce) |
| | |
| | | //空容器出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type)); |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_EMPTY_OUT.type).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持空容器出库!!"); |
| | | } |
| | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(!Objects.isNull(loc.getChannel()),DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)); |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_PICK_AGAIN_OUT.type).last("limit 1"),false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持拣料出库!!"); |
| | | } |
| | |
| | | if (resouce.equals(TaskResouceType.TASK_RESOUCE_STOCK_UP.val)){ |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type)); |
| | | // .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_CROSS_DOCKING_OUT.type) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持越库!!"); |
| | | } |
| | |
| | | } else { |
| | | //全板出库 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type)); |
| | | // .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo).eq(DeviceSite::getType, TaskType.TASK_TYPE_OUT.type) |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点不支持全板出库!!"); |
| | | } |
| | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(!Objects.isNull(loc.getChannel()), DeviceSite::getChannel, loc.getChannel()) |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type)); |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type).last("limit 1")); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("当前站点不支持盘点出库!!"); |
| | | } |
| | |
| | | throw new CoolException("主任务关联失败!!"); |
| | | } |
| | | } |
| | | locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId())); |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | |
| | | if (!locItemService.updateById(item)) { |
| | | throw new CoolException("库存信息修改失败!!"); |
| | | } |
| | | |
| | | if (taskItem.getAnfme() > 0) { |
| | | LocItemWorking itemWorking = new LocItemWorking(); |
| | | BeanUtils.copyProperties(taskItem, itemWorking); |
| | | itemWorking.setTaskId(task.getId()) |
| | | .setQty(0.0) |
| | | .setLocId(loc.getId()) |
| | | .setLocItemId(locItem.getId()) |
| | | .setType("out") |
| | | .setLocCode(loc.getCode()); |
| | | |
| | | if (!locItemWorkingService.save(itemWorking)) { |
| | | throw new CoolException("临时库存更新失败!!"); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | if (!taskItemService.saveBatch(taskItems)) { |
| | |
| | | //目标库位为空,自动获取新库位 |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_LOC_MOVE.type) |
| | | .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()), false); |
| | | .eq(!Objects.isNull(orgLoc.getChannel()), DeviceSite::getChannel, orgLoc.getChannel()).last("limit 1"), false); |
| | | if (Objects.isNull(deviceSite)) { |
| | | throw new CoolException("站点信息不存在!!"); |
| | | } |