| | |
| | | // 叠加剩余方数 |
| | | BigDecimal totalRemainingVolume = plans.stream() |
| | | .map(ProductionPlan::getRemainingVolume) |
| | | .filter(vull) |
| | | .filter(Objects::nonNull) |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 判断下发数量是否大于等于剩余方数 |
| | | if (productionPlanDto.getTotalAssignedQuantity().compareTo(totalRemainingVolume) > 0) { |
| | | throw new BaseException("操作失败,下发数量不能大于剩余方数"); |
| | | } -> v != n |
| | | } |
| | | |
| | | // 创建生产订单 |
| | | ProductOrder productOrder = new ProductOrder(); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean add(ProductionPlanDto productionPlanDto) { |
| | | productionPlanDto.setDataSourceType(DataSourceTypeEnum.MANUAL.getCode()) |
| | | productionPlanDto.setDataSourceType(DataSourceTypeEnum.MANUAL.getCode()); |
| | | productionPlanDto.setStatus(0); |
| | | productionPlanMapper.insert(productionPlanDto); |
| | | return true; |