| | |
| | | if (!bindList.isEmpty()) { |
| | | List<Integer> processIds = bindList.stream().map(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId).collect(Collectors.toList()); |
| | | Map<Integer, Integer> processQuantityMap = bindList.stream().collect(Collectors.toMap(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId, SalesLedgerProductProcessBind::getQuantity, (a, b) -> a)); |
| | | Map<Integer, BigDecimal> processAmountMap = bindList.stream().collect(Collectors.toMap(SalesLedgerProductProcessBind::getSalesLedgerProductProcessId, SalesLedgerProductProcessBind::getAmount, (a, b) -> a)); |
| | | List<SalesLedgerProductProcess> processList = salesLedgerProductProcessService.listByIds(processIds); |
| | | processList.forEach(p -> p.setQuantity(processQuantityMap.get(p.getId()))); |
| | | processList.forEach(p -> { |
| | | p.setQuantity(processQuantityMap.get(p.getId())); |
| | | if (processAmountMap.get(p.getId()) != null) p.setUnitPrice(processAmountMap.get(p.getId())); |
| | | }); |
| | | product.setSalesProductProcessList(processList); |
| | | } |
| | | ProductModel productModel = productModelMap.get(product.getProductModelId()); |
| | |
| | | SalesLedgerProductProcess p = new SalesLedgerProductProcess(); |
| | | p.setId(process.getId()); |
| | | p.setQuantity(processQty.intValue()); |
| | | p.setUnitPrice(process.getUnitPrice()); |
| | | processList.add(p); |
| | | extraProcessAmountPerPiece = extraProcessAmountPerPiece.add(defaultDecimal(process.getUnitPrice()).multiply(processQty)); |
| | | } |
| | |
| | | BigDecimal stockedQty = item.getStockedQuantity() == null ? BigDecimal.ZERO : item.getStockedQuantity(); |
| | | return orderQty.compareTo(BigDecimal.ZERO) <= 0 || stockedQty.compareTo(orderQty) >= 0; |
| | | }); |
| | | int newStockStatus = allStocked ? 2 : (hasStocked ? 1 : 0); |
| | | if (newStockStatus > 0 && ledger.getDeliveryDate() == null) { |
| | | ledger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | ledger.setStockStatus(newStockStatus); |
| | | ledger.setStockStatus(allStocked ? 2 : (hasStocked ? 1 : 0)); |
| | | baseMapper.updateById(ledger); |
| | | } |
| | | |
| | |
| | | return sq != null && sq.compareTo(BigDecimal.ZERO) > 0; |
| | | }); |
| | | boolean allLinesFull = ledgerAllProducts.stream().allMatch(p -> Objects.equals(p.getProductStockStatus(), 2)); |
| | | int newStockStatus = allLinesFull ? 2 : (anyInbound ? 1 : 0); |
| | | if (newStockStatus > 0 && salesLedger.getDeliveryDate() == null) { |
| | | salesLedger.setDeliveryDate(LocalDate.now().plusDays(7)); |
| | | } |
| | | salesLedger.setStockStatus(newStockStatus); |
| | | salesLedger.setStockStatus(allLinesFull ? 2 : (anyInbound ? 1 : 0)); |
| | | baseMapper.updateById(salesLedger); |
| | | } |
| | | |
| | |
| | | SalesLedgerProductProcess bind = new SalesLedgerProductProcess(); |
| | | bind.setId(process.getId()); |
| | | bind.setQuantity(entry.getValue()); |
| | | bind.setUnitPrice(process.getUnitPrice()); |
| | | result.add(bind); |
| | | } |
| | | return result; |
| | |
| | | } |
| | | |
| | | } |
| | | |