| | |
| | | private final StockInRecordService stockInRecordService; |
| | | |
| | | // 获取商品入库数量,出库数量,剩余库存 |
| | | public Map<String, BigDecimal> getStockQuantity(Long productModelId) { |
| | | // 入库数量 |
| | | BigDecimal sumQuantity = procurementRecordMapper.getSumQuantity(productModelId); |
| | | // 出库数量 |
| | | BigDecimal outQuantity = procurementRecordOutMapper.getSumQuantity(productModelId); |
| | | // 剩余库存 |
| | | BigDecimal stockQuantity = outQuantity.compareTo(sumQuantity) > 0 ? BigDecimal.ZERO : sumQuantity.subtract(outQuantity); |
| | | Map<String, BigDecimal> stockMap = new HashMap<>(); |
| | | stockMap.put("inboundNum", sumQuantity); |
| | | stockMap.put("outboundNum", outQuantity); |
| | | stockMap.put("stockQuantity", stockQuantity); |
| | | return stockMap; |
| | | } |
| | | // public Map<String, BigDecimal> getStockQuantity(Long productModelId) { |
| | | // // 入库数量 |
| | | // BigDecimal sumQuantity = procurementRecordMapper.getSumQuantity(productModelId); |
| | | // // 出库数量 |
| | | // BigDecimal outQuantity = procurementRecordOutMapper.getSumQuantity(productModelId); |
| | | // // 剩余库存 |
| | | // BigDecimal stockQuantity = outQuantity.compareTo(sumQuantity) > 0 ? BigDecimal.ZERO : sumQuantity.subtract(outQuantity); |
| | | // Map<String, BigDecimal> stockMap = new HashMap<>(); |
| | | // stockMap.put("inboundNum", sumQuantity); |
| | | // stockMap.put("outboundNum", outQuantity); |
| | | // stockMap.put("stockQuantity", stockQuantity); |
| | | // return stockMap; |
| | | // } |
| | | |
| | | /** |
| | | * 不合格入库 |