| | |
| | | private LocItemWorkingService locItemWorkingService; |
| | | @Autowired |
| | | private WcsService wcsService; |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private OutStockItemService outStockItemService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | |
| | | /** |
| | | * 任务完成后,判断深库位是否为空,如果为空生成移库任务 |
| | | * |
| | | * @param loginUserId |
| | | * @param curLoc |
| | | */ |
| | |
| | | if (!taskItems.isEmpty()) { |
| | | for (TaskItem item : taskItems) { |
| | | if (item.getOrderType().equals(OrderType.ORDER_OUT.type)) { |
| | | |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getId, item.getSourceId())); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("数据错误:库位信息不存在!!"); |
| | | } |
| | | |
| | | loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode()).setUpdateBy(loginUserId).setUpdateTime(new Date()); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | } |
| | | |
| | | //出库 |
| | | if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) { |
| | | //库存出库 |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getId, item.getSourceId())); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("数据错误:库位信息不存在!!"); |
| | | } else if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type))) { |
| | | //其它出库 |
| | | } else { |
| | | //出库单出库 |
| | | AsnOrder asnOrder = outStockService.getById(item.getSourceId()); |
| | | if (Objects.isNull(asnOrder)) { |
| | | throw new CoolException("数据错误:单据已不存在!!"); |
| | | } |
| | | Double workQty = Math.round((asnOrder.getWorkQty() - item.getAnfme()) * 10000) / 10000.0; |
| | | |
| | | asnOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val) |
| | | .setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00 ) |
| | | .setUpdateBy(loginUserId) |
| | | .setUpdateTime(new Date()); |
| | | if (!outStockService.updateById(asnOrder)) { |
| | | throw new CoolException("原单据状态修改失败!!"); |
| | | } |
| | | |
| | | loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode()).setUpdateBy(loginUserId).setUpdateTime(new Date()); |
| | | if (!locService.updateById(loc)) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | AsnOrderItem orderItem = outStockItemService.getById(item.getSource()); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("数据错误:单据明细已不存在!!"); |
| | | } |
| | | |
| | | Double workItmQty = Math.round((orderItem.getWorkQty() - item.getAnfme()) * 10000) / 10000.0; |
| | | orderItem.setWorkQty(workItmQty); |
| | | |
| | | if (!outStockItemService.updateById(orderItem)) { |
| | | throw new CoolException("原单据明细修改失败!!"); |
| | | } |
| | | } |
| | | } else { |