| | |
| | | items.add(locItem); |
| | | } |
| | | |
| | | TaskItem taskItem = taskItems.stream().findFirst().get(); |
| | | |
| | | saveStockItems(taskItems, null, null, taskItem.getWkType(), taskItem.getOrderType()); |
| | | |
| | | if (!locItemService.saveBatch(items)) { |
| | | throw new CoolException("作业库存回写失败!!"); |
| | | } |
| | |
| | | List<TaskItem> items = orderMap.get(key); |
| | | try { |
| | | //保存库存明细 |
| | | saveStockItems(items, pakinItem); |
| | | saveStockItems(items, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType()); |
| | | //移出收货区库存, 修改组托状态 |
| | | removeReceiptStock(pakinItem); |
| | | } catch (Exception e) { |
| | |
| | | * @return |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveStockItems(List<TaskItem> items, WaitPakinItem order) throws Exception { |
| | | public void saveStockItems(List<TaskItem> items, Long id, String code, Short wkType, String type) throws Exception { |
| | | Stock stock = new Stock(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | | throw new CoolException("当前业务:" + SerialRuleCode.SYS_STOCK_CODE + ",编码规则不存在!!"); |
| | | } |
| | | double sum = items.stream().mapToDouble(TaskItem::getAnfme).sum(); |
| | | stock.setSourceId(order.getId()) |
| | | stock.setSourceId(id) |
| | | .setCode(ruleCode) |
| | | .setSourceCode(order.getAsnCode()) |
| | | .setSourceCode(code) |
| | | .setAnfme(sum) |
| | | .setWkType(order.getWkType()) |
| | | .setType(order.getType()); |
| | | .setWkType(wkType) |
| | | .setType(type); |
| | | if (!stockService.save(stock)) { |
| | | throw new CoolException("库存保存失败!!"); |
| | | } |