| | |
| | | if (assignedVolume.add(remainingVolume).compareTo(productionPlanDto.getTotalAssignedQuantity()) >= 0) { |
| | | // æåä¸ä¸ªè®¡åï¼åé
å©ä½æ¹æ° |
| | | BigDecimal lastRemainingVolume = productionPlanDto.getTotalAssignedQuantity().subtract(assignedVolume); |
| | | plan.setStatus(1); |
| | | plan.setAssignedQuantity(plan.getAssignedQuantity().add(lastRemainingVolume)); |
| | | productOrderPlan.setAssignedQuantity(lastRemainingVolume); |
| | | productionPlanMapper.updateById(plan); |
| | |
| | | } |
| | | |
| | | // åé
å½åè®¡åæ¹æ° |
| | | plan.setStatus(1); |
| | | plan.setAssignedQuantity(plan.getAssignedQuantity().add(remainingVolume)); |
| | | productOrderPlan.setAssignedQuantity(remainingVolume); |
| | | // æ´æ°ç产计å |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean update(ProductionPlanDto productionPlanDto) { |
| | | // å·²ä¸åç¶æï¼ä¸è½ç¼è¾ |
| | | if (productionPlanDto.getStatus() == 1) { |
| | | throw new BaseException("å·²ä¸åç¶æï¼ä¸è½ç¼è¾"); |
| | | } |
| | | // æ¥è¯¢æ¯å¦æå
³è订å |
| | | boolean hasProductOrderPlan = productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().eq(ProductOrderPlan::getProductionPlanId, productionPlanDto.getId())).stream().anyMatch(p -> p.getProductOrderId() != null); |
| | | if (hasProductOrderPlan) { |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean delete(List<Long> ids) { |
| | | // 妿åå¨å·²ä¸åç计åï¼åä¸è½å é¤ |
| | | if (productionPlanMapper.selectList(Wrappers.<ProductionPlan>lambdaQuery().in(ProductionPlan::getId, ids).eq(ProductionPlan::getStatus, 1)).stream().anyMatch(p -> p.getStatus() == 1)) { |
| | | throw new BaseException("å é¤å¤±è´¥ï¼åå¨å·²ä¸åç计å"); |
| | | } |
| | | // 妿æå
³è订åï¼åä¸è½å é¤ |
| | | if (productOrderPlanMapper.selectList(Wrappers.<ProductOrderPlan>lambdaQuery().in(ProductOrderPlan::getProductionPlanId, ids)).stream().anyMatch(p -> p.getProductOrderId() != null)) { |
| | | throw new BaseException("å é¤å¤±è´¥ï¼åå¨å
³è订å"); |