| doc/河南鹤壁天沐钢化玻璃厂.sql | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
doc/ºÓÄϺױÚÌìãå¸Ö»¯²£Á§³§.sql
@@ -128,4 +128,14 @@ ADD COLUMN `stocked_quantity` decimal(18, 2) DEFAULT 0.00 COMMENT 'å·²å ¥åºæ°é' AFTER `product_stock_status`; ALTER TABLE `sales_ledger_product` ADD COLUMN `remaining_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'å©ä½å¾ å ¥åºæ°é' AFTER `stocked_quantity` ADD COLUMN `remaining_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'å©ä½å¾ å ¥åºæ°é' AFTER `stocked_quantity`; ALTER TABLE `sales_ledger_product` ADD COLUMN `shipped_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'å·²åºåºæ°é' AFTER `stocked_quantity`; ALTER TABLE `sales_ledger_product` ADD COLUMN `remaining_shipped_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'å©ä½å¾ åºåºæ°é' AFTER `shipped_quantity`; ALTER TABLE `sales_ledger_product` ADD COLUMN `unqualified_stocked_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'ä¸åæ ¼å ¥åºæ°é' AFTER `stocked_quantity`, ADD COLUMN `unqualified_shipped_quantity` decimal(18, 2) DEFAULT '0.00' COMMENT 'ä¸åæ ¼åºåºæ°é' AFTER `shipped_quantity`; src/main/java/com/ruoyi/approve/service/impl/ApproveNodeServiceImpl.java
@@ -214,7 +214,8 @@ purchaseLedgerServiceImpl.addQualityInspect(purchaseLedger, salesLedgerProduct); }else { //ç´æ¥å ¥åº stockUtils.addStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), purchaseLedger.getId()); stockUtils.addStock(null, salesLedgerProduct.getId(), salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockInQualifiedRecordTypeEnum.PURCHASE_STOCK_IN.getCode(), salesLedgerProduct.getId()); } } } else if (status.equals(3)) { src/main/java/com/ruoyi/purchase/service/impl/PurchaseLedgerServiceImpl.java
@@ -51,7 +51,13 @@ import com.ruoyi.sales.pojo.SalesLedgerProduct; import com.ruoyi.sales.service.impl.CommonFileServiceImpl; import com.ruoyi.stock.dto.StockInventoryDto; import com.ruoyi.stock.mapper.StockInRecordMapper; import com.ruoyi.stock.mapper.StockOutRecordMapper; import com.ruoyi.stock.pojo.StockInRecord; import com.ruoyi.stock.pojo.StockOutRecord; import com.ruoyi.stock.service.StockInRecordService; import com.ruoyi.stock.service.StockInventoryService; import com.ruoyi.stock.service.StockOutRecordService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; import org.springframework.beans.BeanUtils; @@ -154,6 +160,14 @@ private SalesLedgerProductTemplateMapper salesLedgerProductTemplateMapper; @Autowired private StockInventoryService stockInventoryService; @Autowired private StockInRecordMapper stockInRecordMapper; @Autowired private StockOutRecordMapper stockOutRecordMapper; @Autowired private StockInRecordService stockInRecordService; @Autowired private StockOutRecordService stockOutRecordService; @Autowired private StockUtils stockUtils; @Value("${file.upload-dir}") @@ -447,6 +461,34 @@ .eq(SalesLedgerProduct::getType, 2); List<SalesLedgerProduct> salesLedgerProducts = salesLedgerProductMapper.selectList(salesLedgerProductQueryWrapper); if (CollectionUtils.isNotEmpty(salesLedgerProducts)) { List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getId).filter(Objects::nonNull).collect(Collectors.toList()); // å é¤å°è´¦åå åéåºåè®°å½ï¼å å åºåºåå å ¥åºï¼ï¼é¿å åºååéæ ¡éªè¢«è¯¯æ¦ if (CollectionUtils.isNotEmpty(productIds)) { List<Long> stockOutRecordIds = stockOutRecordMapper.selectList(new LambdaQueryWrapper<StockOutRecord>() .and(w -> w .in(StockOutRecord::getSalesLedgerProductId, productIds) .or(q -> q.in(StockOutRecord::getRecordId, productIds) .in(StockOutRecord::getRecordType, Arrays.asList( StockOutUnQualifiedRecordTypeEnum.PURCHASE_SCAN_UNSTOCK_OUT.getCode() )))) .select(StockOutRecord::getId)) .stream().map(StockOutRecord::getId).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(stockOutRecordIds)) { stockOutRecordService.batchDelete(stockOutRecordIds); } List<Long> stockInRecordIds = stockInRecordMapper.selectList(new LambdaQueryWrapper<StockInRecord>() .and(w -> w .in(StockInRecord::getSalesLedgerProductId, productIds) .or(q -> q.in(StockInRecord::getRecordId, productIds) .in(StockInRecord::getRecordType, Arrays.asList( StockInUnQualifiedRecordTypeEnum.PURCHASE_SCAN_UNSTOCK_IN.getCode() )))) .select(StockInRecord::getId)) .stream().map(StockInRecord::getId).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(stockInRecordIds)) { stockInRecordService.batchDelete(stockInRecordIds); } } salesLedgerProducts.stream().forEach(salesLedgerProduct -> { // æ¹éå é¤å ³èçéè´å°è´¦äº§å LambdaQueryWrapper<ProcurementRecordStorage> queryWrapper = new LambdaQueryWrapper<>(); @@ -828,6 +870,9 @@ if (purchaseLedger == null) { throw new ServiceException("å ¥åºå¤±è´¥,éè´å°è´¦ä¸åå¨"); } if (!Objects.equals(purchaseLedger.getApprovalStatus(), 3)) { throw new ServiceException("å ¥åºå¤±è´¥,éè´è®¢åæªå®¡æ¹éè¿,ä¸å 许æ«ç å ¥åº"); } if (CollectionUtils.isEmpty(dto.getSalesLedgerProductList())) { throw new ServiceException("éè´å ¥åºå¤±è´¥,å ¥åºäº§åä¸è½ä¸ºç©º"); } @@ -901,6 +946,9 @@ if (purchaseLedger == null) { throw new ServiceException("åºåºå¤±è´¥,éè´å°è´¦ä¸åå¨"); } if (!Objects.equals(purchaseLedger.getApprovalStatus(), 3)) { throw new ServiceException("åºåºå¤±è´¥,éè´è®¢åæªå®¡æ¹éè¿,ä¸å 许æ«ç åºåº"); } if (CollectionUtils.isEmpty(dto.getSalesLedgerProductList())) { throw new ServiceException("éè´åºåºå¤±è´¥,åºåºäº§åä¸è½ä¸ºç©º"); } @@ -938,12 +986,6 @@ } stockUtils.assertQualifiedAvailable(dbProduct.getProductModelId(), outboundThisLine); BigDecimal oldStocked = dbProduct.getStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getStockedQuantity(); BigDecimal newStocked = oldStocked.subtract(outboundThisLine); if (newStocked.compareTo(BigDecimal.ZERO) < 0) { newStocked = BigDecimal.ZERO; } StockInventoryDto stockInventoryDto = new StockInventoryDto(); stockInventoryDto.setRecordId(dbProduct.getId()); stockInventoryDto.setRecordType(StockOutQualifiedRecordTypeEnum.PURCHASE_SCAN_STOCK_OUT.getCode()); @@ -953,17 +995,8 @@ stockInventoryDto.setSalesLedgerProductId(dbProduct.getId()); stockInventoryService.subtractStockInventory(stockInventoryDto); BigDecimal orderQty = dbProduct.getQuantity() == null ? BigDecimal.ZERO : dbProduct.getQuantity(); int lineStockStatus; if (newStocked.compareTo(BigDecimal.ZERO) <= 0) { lineStockStatus = 0; } else if (orderQty.compareTo(BigDecimal.ZERO) > 0 && newStocked.compareTo(orderQty) < 0) { lineStockStatus = 1; } else { lineStockStatus = 2; } dbProduct.setStockedQuantity(newStocked); dbProduct.setProductStockStatus(lineStockStatus); BigDecimal oldShipped = dbProduct.getShippedQuantity() == null ? BigDecimal.ZERO : dbProduct.getShippedQuantity(); dbProduct.setShippedQuantity(oldShipped.add(outboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } @@ -978,6 +1011,9 @@ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(dto.getPurchaseLedgerId()); if (purchaseLedger == null) { throw new ServiceException("ä¸åæ ¼å ¥åºå¤±è´¥,éè´å°è´¦ä¸åå¨"); } if (!Objects.equals(purchaseLedger.getApprovalStatus(), 3)) { throw new ServiceException("ä¸åæ ¼å ¥åºå¤±è´¥,éè´è®¢åæªå®¡æ¹éè¿,ä¸å 许æ«ç å ¥åº"); } if (CollectionUtils.isEmpty(dto.getSalesLedgerProductList())) { throw new ServiceException("éè´ä¸åæ ¼å ¥åºå¤±è´¥,å ¥åºäº§åä¸è½ä¸ºç©º"); @@ -1016,6 +1052,11 @@ } stockUtils.addUnStock(null, null, dbProduct.getProductModelId(), inboundThisLine, StockInUnQualifiedRecordTypeEnum.PURCHASE_SCAN_UNSTOCK_IN.getCode(), dbProduct.getId()); BigDecimal oldUnStocked = dbProduct.getUnqualifiedStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedStockedQuantity(); dbProduct.setUnqualifiedStockedQuantity(oldUnStocked.add(inboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } } @@ -1028,6 +1069,9 @@ PurchaseLedger purchaseLedger = purchaseLedgerMapper.selectById(dto.getPurchaseLedgerId()); if (purchaseLedger == null) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,éè´å°è´¦ä¸åå¨"); } if (!Objects.equals(purchaseLedger.getApprovalStatus(), 3)) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,éè´è®¢åæªå®¡æ¹éè¿,ä¸å 许æ«ç åºåº"); } if (CollectionUtils.isEmpty(dto.getSalesLedgerProductList())) { throw new ServiceException("éè´ä¸åæ ¼åºåºå¤±è´¥,åºåºäº§åä¸è½ä¸ºç©º"); @@ -1064,9 +1108,19 @@ if (dbProduct.getProductModelId() == null) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,产åè§æ ¼æªç»´æ¤,æ æ³åºåº"); } BigDecimal unStocked = dbProduct.getUnqualifiedStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedStockedQuantity(); BigDecimal unShipped = dbProduct.getUnqualifiedShippedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedShippedQuantity(); BigDecimal canUnShip = unStocked.subtract(unShipped); if (outboundThisLine.compareTo(canUnShip) > 0) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,åºåºæ°éä¸è½å¤§äºä¸åæ ¼å ¥åºæ°é"); } stockUtils.assertUnqualifiedAvailable(dbProduct.getProductModelId(), outboundThisLine); stockUtils.subtractUnStock(null, null, dbProduct.getProductModelId(), outboundThisLine, StockOutUnQualifiedRecordTypeEnum.PURCHASE_SCAN_UNSTOCK_OUT.getCode(), dbProduct.getId()); dbProduct.setUnqualifiedShippedQuantity(unShipped.add(outboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } } src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
@@ -78,6 +78,11 @@ */ private BigDecimal stockedQuantity; /** * å·²åºåºæ°é */ private BigDecimal shippedQuantity; @Excel(name = "æä½åºåæ°é") private BigDecimal minStock; @@ -87,6 +92,22 @@ @Excel(name = "å©ä½æ°é") @ApiModelProperty("å©ä½å¾ å ¥åºæ°é(è®¢åæ°é-åæ ¼å·²å ¥åº)") private BigDecimal remainingQuantity; /** * å©ä½åºåºæ°é */ private BigDecimal remainingShippedQuantity; /** * ä¸åæ ¼å ¥åºæ°é */ private BigDecimal unqualifiedStockedQuantity; /** * ä¸åæ ¼åºåºæ°é */ private BigDecimal unqualifiedShippedQuantity; /** * ç¨ç @@ -330,8 +351,14 @@ public void fillRemainingQuantity() { BigDecimal q = this.quantity == null ? BigDecimal.ZERO : this.quantity; BigDecimal stocked = this.stockedQuantity == null ? BigDecimal.ZERO : this.stockedQuantity; BigDecimal rem = q.subtract(stocked); this.remainingQuantity = rem.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : rem; BigDecimal remIn = q.subtract(stocked); this.remainingQuantity = remIn.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : remIn; BigDecimal shipped = this.shippedQuantity == null ? BigDecimal.ZERO : this.shippedQuantity; // å©ä½åºåºæ°éï¼ä»¥âå·²å ¥åºæ°éâ为åºåï¼åºåºåªè½ä»å·²å ¥åºä¸æ£åï¼ BigDecimal remOut = stocked.subtract(shipped); this.remainingShippedQuantity = remOut.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : remOut; } } src/main/java/com/ruoyi/sales/service/impl/SalesLedgerProductServiceImpl.java
@@ -193,7 +193,19 @@ if (item.getFutureTicketsAmount() == null || item.getFutureTicketsAmount().compareTo(BigDecimal.ZERO) == 0) { item.setFutureTicketsAmount(BigDecimal.ZERO); } BigDecimal returnQuality = finalReturnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO); item.setReturnQuality(returnQuality); BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity(); BigDecimal shipped = item.getShippedQuantity() == null ? BigDecimal.ZERO : item.getShippedQuantity(); BigDecimal available = quantity.subtract(returnQuality).subtract(shipped); item.setAvailableQuality(available.compareTo(BigDecimal.ZERO) < 0 ? BigDecimal.ZERO : available); item.fillRemainingQuantity(); if (item.getApproveStatus() == null || item.getApproveStatus() != 2) { BigDecimal remainingShipped = item.getRemainingShippedQuantity() == null ? BigDecimal.ZERO : item.getRemainingShippedQuantity(); boolean hasOutbound = shipped.compareTo(BigDecimal.ZERO) > 0; if (hasOutbound && remainingShipped.compareTo(BigDecimal.ZERO) <= 0) { item.setApproveStatus(0); } else { Integer hasSufficientStock = item.getHasSufficientStock(); if (hasSufficientStock != null && hasSufficientStock == 0) { item.setApproveStatus(0); @@ -201,11 +213,7 @@ item.setApproveStatus(1); } } BigDecimal returnQuality = finalReturnOrderGroupDtoMap.getOrDefault(item.getId(), BigDecimal.ZERO); item.setReturnQuality(returnQuality); BigDecimal quantity = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity(); item.setAvailableQuality(quantity.subtract(returnQuality)); item.fillRemainingQuantity(); } ProductModel productModel = finalProductModelMap.get(item.getProductModelId()); if (productModel != null) { item.setThickness(productModel.getThickness()); src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -1690,22 +1690,55 @@ throw new ServiceException("å ¥åºå¤±è´¥,æªæ¥è¯¢å°è¯¥éå®è®¢åçéå®äº§å"); } for (SalesLedgerProduct product : salesLedgerProducts) { if (!Objects.equals(product.getSalesLedgerId(), ledger.getId())) { throw new ServiceException("å ¥åºå¤±è´¥,åå¨ä¸å±äºå½åéå®è®¢åç产å"); } if (product.getProductModelId() == null) { continue; } BigDecimal orderQty = product.getQuantity() == null ? BigDecimal.ZERO : product.getQuantity(); BigDecimal oldStocked = product.getStockedQuantity() == null ? BigDecimal.ZERO : product.getStockedQuantity(); BigDecimal inboundQty = orderQty.subtract(oldStocked); if (inboundQty.compareTo(BigDecimal.ZERO) < 0) { inboundQty = BigDecimal.ZERO; } if (inboundQty.compareTo(BigDecimal.ZERO) <= 0) { continue; } StockInventoryDto stockInventoryDto = new StockInventoryDto(); stockInventoryDto.setRecordId(product.getId()); stockInventoryDto.setRecordType(StockInQualifiedRecordTypeEnum.SALE_STOCK_IN.getCode()); stockInventoryDto.setQualitity(product.getQuantity()); stockInventoryDto.setQualitity(inboundQty); stockInventoryDto.setProductModelId(product.getProductModelId()); stockInventoryDto.setSalesLedgerId(ledger.getId()); stockInventoryDto.setSalesLedgerProductId(product.getId()); stockInventoryService.addstockInventory(stockInventoryDto); BigDecimal newStocked = oldStocked.add(inboundQty); int lineStockStatus; if (newStocked.compareTo(BigDecimal.ZERO) <= 0) { lineStockStatus = 0; } else if (orderQty.compareTo(BigDecimal.ZERO) > 0 && newStocked.compareTo(orderQty) < 0) { lineStockStatus = 1; } else { lineStockStatus = 2; } product.setStockedQuantity(newStocked); product.setProductStockStatus(lineStockStatus); product.fillRemainingQuantity(); salesLedgerProductMapper.updateById(product); } // æéå®è®¢å产åå ¥åºæ 嵿´æ°ä¸»åå ¥åºç¶æï¼1-é¨åå ¥åºï¼2-å·²å ¥åº List<SalesLedgerProduct> ledgerAllProducts = salesLedgerProductMapper.selectList(Wrappers.<SalesLedgerProduct>lambdaQuery().eq(SalesLedgerProduct::getSalesLedgerId, ledger.getId())); boolean hasStocked = CollectionUtils.isNotEmpty(ledgerAllProducts) && ledgerAllProducts.stream().anyMatch(item -> Objects.equals(item.getProductStockStatus(), 1)); boolean allStocked = CollectionUtils.isNotEmpty(ledgerAllProducts) && ledgerAllProducts.stream().allMatch(item -> Objects.equals(item.getProductStockStatus(), 1)); boolean hasStocked = CollectionUtils.isNotEmpty(ledgerAllProducts) && ledgerAllProducts.stream().anyMatch(item -> { BigDecimal sq = item.getStockedQuantity(); return sq != null && sq.compareTo(BigDecimal.ZERO) > 0; }); boolean allStocked = CollectionUtils.isNotEmpty(ledgerAllProducts) && ledgerAllProducts.stream().allMatch(item -> { BigDecimal orderQty = item.getQuantity() == null ? BigDecimal.ZERO : item.getQuantity(); 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)); baseMapper.updateById(ledger); } @@ -1874,6 +1907,11 @@ } stockUtils.addUnStock(ledgerId, dbProduct.getId(), dbProduct.getProductModelId(), inboundThisLine, StockInUnQualifiedRecordTypeEnum.SALES_SCAN_UNSTOCK_IN.getCode(), dbProduct.getId()); BigDecimal oldUnStocked = dbProduct.getUnqualifiedStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedStockedQuantity(); dbProduct.setUnqualifiedStockedQuantity(oldUnStocked.add(inboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } } @@ -1927,12 +1965,6 @@ } stockUtils.assertQualifiedAvailable(dbProduct.getProductModelId(), outboundThisLine); BigDecimal oldStocked = dbProduct.getStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getStockedQuantity(); BigDecimal newStocked = oldStocked.subtract(outboundThisLine); if (newStocked.compareTo(BigDecimal.ZERO) < 0) { newStocked = BigDecimal.ZERO; } StockInventoryDto stockInventoryDto = new StockInventoryDto(); stockInventoryDto.setRecordId(dbProduct.getId()); stockInventoryDto.setRecordType(StockOutQualifiedRecordTypeEnum.SALE_SCAN_STOCK_OUT.getCode()); @@ -1942,17 +1974,8 @@ stockInventoryDto.setSalesLedgerProductId(dbProduct.getId()); stockInventoryService.subtractStockInventory(stockInventoryDto); BigDecimal orderQty = dbProduct.getQuantity() == null ? BigDecimal.ZERO : dbProduct.getQuantity(); int lineStockStatus; if (newStocked.compareTo(BigDecimal.ZERO) <= 0) { lineStockStatus = 0; } else if (orderQty.compareTo(BigDecimal.ZERO) > 0 && newStocked.compareTo(orderQty) < 0) { lineStockStatus = 1; } else { lineStockStatus = 2; } dbProduct.setStockedQuantity(newStocked); dbProduct.setProductStockStatus(lineStockStatus); BigDecimal oldShipped = dbProduct.getShippedQuantity() == null ? BigDecimal.ZERO : dbProduct.getShippedQuantity(); dbProduct.setShippedQuantity(oldShipped.add(outboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } @@ -2015,9 +2038,19 @@ if (dbProduct.getProductModelId() == null) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,产åè§æ ¼æªç»´æ¤,æ æ³åºåº"); } BigDecimal unStocked = dbProduct.getUnqualifiedStockedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedStockedQuantity(); BigDecimal unShipped = dbProduct.getUnqualifiedShippedQuantity() == null ? BigDecimal.ZERO : dbProduct.getUnqualifiedShippedQuantity(); BigDecimal canUnShip = unStocked.subtract(unShipped); if (outboundThisLine.compareTo(canUnShip) > 0) { throw new ServiceException("ä¸åæ ¼åºåºå¤±è´¥,åºåºæ°éä¸è½å¤§äºä¸åæ ¼å ¥åºæ°é"); } stockUtils.assertUnqualifiedAvailable(dbProduct.getProductModelId(), outboundThisLine); stockUtils.subtractUnStock(ledgerId, dbProduct.getId(), dbProduct.getProductModelId(), outboundThisLine, StockOutUnQualifiedRecordTypeEnum.SALE_SCAN_UNSTOCK_OUT.getCode(), dbProduct.getId()); dbProduct.setUnqualifiedShippedQuantity(unShipped.add(outboundThisLine)); dbProduct.fillRemainingQuantity(); salesLedgerProductMapper.updateById(dbProduct); } } } src/main/java/com/ruoyi/sales/service/impl/ShippingInfoServiceImpl.java
@@ -88,6 +88,9 @@ SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); if (salesLedgerProduct != null) { stockUtils.substractStock(salesLedgerProduct.getSalesLedgerId(), salesLedgerProduct.getId(), salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockOutQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); BigDecimal shipped = salesLedgerProduct.getShippedQuantity() == null ? BigDecimal.ZERO : salesLedgerProduct.getShippedQuantity(); salesLedgerProduct.setShippedQuantity(shipped.add(salesLedgerProduct.getQuantity() == null ? BigDecimal.ZERO : salesLedgerProduct.getQuantity())); salesLedgerProductMapper.updateById(salesLedgerProduct); } } byId.setExpressNumber(req.getExpressNumber()); src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -58,13 +58,15 @@ @Transactional(rollbackFor = Exception.class) public Boolean addstockInventory(StockInventoryDto stockInventoryDto) { //æ°å¢å ¥åºè®°å½åæ·»å åºå // æ´æ°äº§åå ¥åºç¶æ // æ´æ°è®¢å产åå ¥åºç¶æï¼ä» å½ä¼ å ¥äºäº§åè¡IDæ¶ï¼ if (stockInventoryDto.getSalesLedgerProductId() != null) { SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(stockInventoryDto.getSalesLedgerProductId()); if (salesLedgerProduct == null) { throw new ServiceException("å ¥åºå¤±è´¥,éå®äº§åä¸åå¨"); } salesLedgerProduct.setProductStockStatus(1); salesLedgerProductMapper.updateById(salesLedgerProduct); } StockInRecordDto stockInRecordDto = new StockInRecordDto(); stockInRecordDto.setRecordId(stockInventoryDto.getRecordId());