| | |
| | | private StockItemService stockItemService; |
| | | @Autowired |
| | | private DeviceSiteService deviceSiteService; |
| | | |
| | | @Autowired |
| | | private OrderService orderService; |
| | | |
| | | @Autowired |
| | | private OrderItemService orderItemService; |
| | | |
| | | @Autowired |
| | | private LocItemService locItemService; |
| | | |
| | | @Autowired |
| | | private DeviceBindService deviceBindService; |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | @Autowired |
| | | private WarehouseAreasItemService warehouseAreasItemService; |
| | | |
| | | |
| | | /** |
| | |
| | | throw new CoolException("未找到所属库区信息"); |
| | | } |
| | | |
| | | /**获取库位*/ |
| | | String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId()); |
| | | if (Cools.isEmpty(targetLoc)) { |
| | | throw new CoolException("该站点对应库区未找到库位"); |
| | | } |
| | | /**获取组拖*/ |
| | | List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList()); |
| | | List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() |
| | |
| | | throw new CoolException("请检查组拖状态是否完成!!"); |
| | | } |
| | | waitPakins.forEach(pakin -> { |
| | | /**获取库位*/ |
| | | String targetLoc = LocManageUtil.getTargetLoc(warehouseArea.getId()); |
| | | if (Cools.isEmpty(targetLoc)) { |
| | | throw new CoolException("该站点对应库区未找到库位"); |
| | | } |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | |
| | | if (!taskItemService.saveBatch(taskItems)) { |
| | | throw new CoolException("任务明细保存失败!!"); |
| | | } |
| | | waitPakinItems.forEach(item -> { |
| | | if (! waitPakinItemService.update(new LambdaUpdateWrapper<WaitPakinItem>() |
| | | .set(WaitPakinItem::getWorkQty, item.getAnfme()) |
| | | .eq(WaitPakinItem::getId, item.getId()))) { |
| | | throw new CoolException("组托明细修执行数量修改失败!!"); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | |
| | | //保存库存明细 |
| | | try { |
| | | saveStockItems(items, pakinItem); |
| | | //移出收货区库存 |
| | | removeReceiptStock(pakinItem); |
| | | } catch (Exception e) { |
| | | throw new CoolException("库存管理保存更新失败!!"); |
| | | } |
| | |
| | | } |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().in(Task::getId, list).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 移除收货区库存 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/30 16:32 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void removeReceiptStock(WaitPakinItem pakinItem) { |
| | | WarehouseAreasItem itemServiceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | .eq(WarehouseAreasItem::getTrackCode, pakinItem.getTrackCode()) |
| | | .eq(WarehouseAreasItem::getSplrBatch, pakinItem.getBatch())); |
| | | if (Objects.isNull(itemServiceOne)) { |
| | | throw new CoolException("数据错误,请查看请货区库存是否存在!!"); |
| | | } |
| | | Double workQty = itemServiceOne.getWorkQty() - pakinItem.getAnfme(); |
| | | Double qty = itemServiceOne.getQty() + pakinItem.getAnfme(); |
| | | itemServiceOne.setWorkQty(workQty).setQty(qty); |
| | | |
| | | if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() |
| | | .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) |
| | | .eq(WaitPakin::getId, pakinItem.getPakinId()))) { |
| | | throw new CoolException("组拖状态修改失败!!"); |
| | | } |
| | | |
| | | if (qty.compareTo(itemServiceOne.getAnfme()) == 0.00) { |
| | | if (!warehouseAreasItemService.removeById(itemServiceOne.getId())) { |
| | | throw new CoolException("收货区物料删除失败!!"); |
| | | } |
| | | } else { |
| | | if (!warehouseAreasItemService.updateById(itemServiceOne)) { |
| | | throw new CoolException("收货区库完成数量修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()), false); |
| | | LocItem item = new LocItem(); |
| | | BeanUtils.copyProperties(taskItem, item); |
| | | item.setLocCode(loc.getCode()).setId(null).setLocId(loc.getId()).setType(taskItem.getOrderType()); |
| | | item.setLocCode(loc.getCode()).setId(null) |
| | | .setLocId(loc.getId()) |
| | | .setWkType(taskItem.getWkType()) |
| | | .setType(taskItem.getOrderType()); |
| | | locItems.add(item); |
| | | }); |
| | | if (!locItemService.saveBatch(locItems)) { |