| src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/sales/SalesLedgerProductMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/resources/mapper/stock/StockInventoryMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/ruoyi/sales/pojo/SalesLedgerProduct.java
@@ -251,4 +251,6 @@ @TableField(fill = FieldFill.INSERT) private Long deptId; @TableField(exist = false) private Integer hasStockInventory; } src/main/java/com/ruoyi/stock/service/impl/StockInventoryServiceImpl.java
@@ -99,16 +99,9 @@ stockOutRecordService.add(stockOutRecordDto); StockInventory oldStockInventory = stockInventoryMapper.selectOne(new QueryWrapper<StockInventory>().lambda().eq(StockInventory::getProductModelId, stockInventoryDto.getProductModelId())); if (ObjectUtils.isEmpty(oldStockInventory)) { throw new RuntimeException("产品库存不存在"); throw new RuntimeException("该产品没有库存数量"); } BigDecimal lockedQty = oldStockInventory.getLockedQuantity(); if (lockedQty == null) { lockedQty = BigDecimal.ZERO; } if (stockInventoryDto.getQualitity().compareTo(oldStockInventory.getQualitity().subtract(lockedQty)) > 0) { throw new RuntimeException("库存不足无法出库"); } // 移除库存数量限制,允许库存不足时发货,库存可以为负数 stockInventoryMapper.updateSubtractStockInventory(stockInventoryDto); return true; } src/main/resources/mapper/sales/SalesLedgerProductMapper.xml
@@ -10,7 +10,11 @@ CASE WHEN (IFNULL(t2.qualitity, 0) - IFNULL(t2.locked_quantity, 0)) >= IFNULL(T1.quantity, 0) THEN 1 ELSE 0 END as has_sufficient_stock END as has_sufficient_stock, CASE WHEN t2.id IS NOT NULL THEN 1 ELSE 0 END as has_stock_inventory FROM sales_ledger_product T1 LEFT JOIN stock_inventory t2 ON T1.product_model_id = t2.product_model_id src/main/resources/mapper/stock/StockInventoryMapper.xml
@@ -61,7 +61,7 @@ </if> update_time = now() </set> where product_model_id = #{ew.productModelId} and qualitity >= #{ew.qualitity} where product_model_id = #{ew.productModelId} </update> <select id="pagestockInventory" resultType="com.ruoyi.stock.dto.StockInventoryDto"> WITH RECURSIVE cte AS (