| | |
| | | throw new BaseException("合并失败,所选生产计划的产品型号不一致"); |
| | | } |
| | | |
| | | // 已下发或部分下发的计划不允许再次合并 |
| | | boolean hasIssuedPlan = planLists.stream() |
| | | // 仅“已下发”计划不允许再次参与合并下发; |
| | | // “待下发/部分下发”允许继续下发剩余数量。 |
| | | boolean hasFullyIssuedPlan = planLists.stream() |
| | | .anyMatch(item -> item.getStatus() != null |
| | | && (item.getStatus() == PLAN_STATUS_PARTIAL || item.getStatus() == PLAN_STATUS_ISSUED)); |
| | | if (hasIssuedPlan) { |
| | | throw new BaseException("合并失败,所选生产计划存在已下发或部分下发的数据"); |
| | | && item.getStatus() == PLAN_STATUS_ISSUED); |
| | | if (hasFullyIssuedPlan) { |
| | | throw new BaseException("合并失败,所选生产计划存在已下发的数据"); |
| | | } |
| | | |
| | | // 计算本次可下发的剩余需求总量 |
| | |
| | | BeanUtils.copyProperties(dto, entity); |
| | | entity.setProductModelId(resolveProductModelId(dto, i + 2, allModels, productNameById)); |
| | | entity.setStatus(PLAN_STATUS_WAIT); |
| | | entity.setSource(StringUtils.isNotEmpty(dto.getSource()) ? StringUtils.trim(dto.getSource()) : "内部"); |
| | | entity.setSource("内部"); |
| | | entity.setQuantityIssued(BigDecimal.ZERO); |
| | | entity.setCreateTime(now); |
| | | entity.setUpdateTime(now); |