| | |
| | | if (item == null) { |
| | | continue; |
| | | } |
| | | // 如果物料开启批次管理,检查行上的批次号是否为空 |
| | | if (Boolean.TRUE.equals(item.getIsBatchManaged()) && line.getBatchId() == null) { |
| | | // 如果物料开启批次管理,行或其上架明细必须携带批次号,否则无法生成库存事务 |
| | | if (Boolean.TRUE.equals(item.getIsBatchManaged())) { |
| | | boolean hasBatch = line.getBatchId() != null |
| | | || hasDetailBatch(itemReceiptDetailService.getItemReceiptDetailListByLineId(line.getId())); |
| | | if (!hasBatch) { |
| | | throw exception(WM_ITEM_RECEIPT_BATCH_REQUIRED, item.getCode(), item.getName()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | private boolean hasDetailBatch(List<MesWmItemReceiptDetailDO> details) { |
| | | return details.stream().anyMatch(detail -> detail.getBatchId() != null); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |