| | |
| | | BigDecimal stockedQty = item.getStockedQuantity() == null ? BigDecimal.ZERO : item.getStockedQuantity(); |
| | | return orderQty.compareTo(BigDecimal.ZERO) <= 0 || stockedQty.compareTo(orderQty) >= 0; |
| | | }); |
| | | ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0)); |
| | | int newStockStatus = allStocked ? 2 : (hasStocked ? 1 : 0); |
| | | if (newStockStatus > 0 && ledger.getDeliveryDate() == null) { |
| | | ledger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | ledger.setStockStatus(newStockStatus); |
| | | baseMapper.updateById(ledger); |
| | | } |
| | | |
| | |
| | | return sq != null && sq.compareTo(BigDecimal.ZERO) > 0; |
| | | }); |
| | | boolean allLinesFull = ledgerAllProducts.stream().allMatch(p -> Objects.equals(p.getProductStockStatus(), 2)); |
| | | salesLedger.setStockStatus(allLinesFull ? 2 : (anyInbound ? 1 : 0)); |
| | | int newStockStatus = allLinesFull ? 2 : (anyInbound ? 1 : 0); |
| | | if (newStockStatus > 0 && salesLedger.getDeliveryDate() == null) { |
| | | salesLedger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | salesLedger.setStockStatus(newStockStatus); |
| | | baseMapper.updateById(salesLedger); |
| | | } |
| | | |