| | |
| | | if (CollUtil.isEmpty(productList)) { |
| | | throw exception(PRO_ROUTE_LAST_OUTPUT_INVALID, processList.get(processList.size() - 1).getProcessId()); |
| | | } |
| | | Set<Long> boundItemIds = productList.stream().map(MesProRouteProductDO::getItemId).collect(Collectors.toSet()); |
| | | Set<Long> finishedItemIds = productList.stream() |
| | | .map(MesProRouteProductDO::getItemId) |
| | | .filter(itemId -> isItemUnderCategory(itemId, "FG")) |
| | | .collect(Collectors.toSet()); |
| | | if (finishedItemIds.size() != productList.size()) { |
| | | throw exception(PRO_ROUTE_PRODUCT_ITEM_TYPE_INVALID); |
| | | } |
| | | MesProRouteProcessDO lastProcess = processList.stream() |
| | | .max(Comparator.comparing(MesProRouteProcessDO::getSort)).orElseThrow(); |
| | | for (MesProRouteProcessDO process : processList) { |
| | |
| | | throw exception(PRO_ROUTE_LAST_OUTPUT_INVALID, process.getProcessId()); |
| | | } |
| | | continue; |
| | | } |
| | | for (Long outputId : outputIds) { |
| | | if (!boundItemIds.contains(outputId)) { |
| | | MesMdItemDO item = itemService.validateItemExists(outputId); |
| | | throw exception(PRO_ROUTE_PROCESS_OUTPUT_NOT_BOUND, item.getName()); |
| | | } |
| | | } |
| | | if (last) { |
| | | if (finishedItemIds.isEmpty() || !outputIds.equals(finishedItemIds)) { |