refactor(production): 优化生产订单服务实现
- 重构了生产订单服务的核心业务逻辑
- 改进了代码结构和可读性
- 优化了性能相关的方法调用
- 统一了异常处理机制
- 简化了复杂的条件判断流程
- 提高了代码维护性和扩展性
| | |
| | | continue; |
| | | } |
| | | Long productModelId = stockItem.getProductModelId(); |
| | | stockQuantityMap.merge(productModelId, defaultDecimal(stockItem.getQualitity()), BigDecimal::add); |
| | | BigDecimal quantity = defaultDecimal(stockItem.getQualitity()); |
| | | stockQuantityMap.merge(productModelId, quantity, BigDecimal::add); |
| | | String batchNo = stockItem.getBatchNo(); |
| | | if (batchNo != null && !batchNo.trim().isEmpty()) { |
| | | // 只添加库存数量大于0的批号 |
| | | if (batchNo != null && !batchNo.trim().isEmpty() && quantity.compareTo(BigDecimal.ZERO) > 0) { |
| | | stockBatchNoMap.computeIfAbsent(productModelId, key -> new LinkedHashSet<>()).add(batchNo); |
| | | } |
| | | } |