| | |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("数据错误,拣料不在单据需求中!!"); |
| | | } |
| | | |
| | | //taskItems为拣货明细,作参数上报 |
| | | Double summed = items.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | //加上历史拣料数量 |
| | | Double pickQty = Math.round((orderItem.getQty() + summed) * 100) / 100.0; |
| | |
| | | TaskItem item = taskItemService.getById(taskItem.getId()); |
| | | //判断是否允许超收,不允许超收添加拒收判断 |
| | | if (!Objects.isNull(config)) { |
| | | LocItemWorking serviceOne = locItemWorkingService.getOne(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getFieldsIndex, item.getFieldsIndex())); |
| | | if (Objects.isNull(serviceOne)) { |
| | | throw new CoolException("缓存数据丢失!!"); |
| | | } |
| | | //不管是否允许超收,都需判断是否超出库存范围 |
| | | if (taskItem.getAnfme().compareTo(serviceOne.getAnfme()) > 0) { |
| | | throw new CoolException("拣货数量超出当前票号库存数量!!"); |
| | | } |
| | | if (!Boolean.parseBoolean(config.getVal())) { |
| | | if (item.getAnfme().compareTo(item.getQty() + taskItem.getAnfme()) < 0.0) { |
| | | throw new CoolException("前当物料已超出可拣范围,请核对后再操作!!"); |
| | |
| | | throw new CoolException("状态完成失败!!"); |
| | | } |
| | | StockItem stockItem = new StockItem(); |
| | | BeanUtils.copyProperties(taskItem, stockItem); |
| | | stockItem.setStockId(stock.getId()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId()); |
| | | BeanUtils.copyProperties(item, stockItem); |
| | | //taskItem为上报数据 |
| | | stockItem.setStockId(stock.getId()).setAnfme(taskItem.getAnfme()).setStockCode(stock.getCode()).setSourceItemId(orderItem.getId()); |
| | | stockItems.add(stockItem); |
| | | }); |
| | | if (!stockItemService.saveBatch(stockItems)) { |