Explorar el Código

fix: 库存状态判断改用standard_stock替代warning_threshold

- 低库存判断从 stock<=warning_threshold 改为 stock<standard_stock
- 补货员设备列表同步修正
- 避免库存已对齐标准但仍显示低库存的问题

Co-Authored-By: Claude <noreply@anthropic.com>
skyline hace 1 día
padre
commit
2537630637

+ 1 - 2
haha-admin/src/main/java/com/haha/admin/controller/ReplenisherOperationController.java

@@ -170,13 +170,12 @@ public class ReplenisherOperationController {
             int zeroStockCount = 0;
             for (Map<String, Object> inv : inventoryList) {
                 Integer stock = inv.get("stock") != null ? ((Number) inv.get("stock")).intValue() : 0;
-                Integer warningThreshold = inv.get("warning_threshold") != null ? ((Number) inv.get("warning_threshold")).intValue() : 0;
                 Integer invStandardStock = inv.get("standard_stock") != null ? ((Number) inv.get("standard_stock")).intValue() : 0;
                 totalStock += stock;
                 standardStock += invStandardStock;
                 if (stock == 0) {
                     zeroStockCount++;
-                } else if (stock <= warningThreshold) {
+                } else if (invStandardStock > 0 && stock < invStandardStock) {
                     lowStockCount++;
                 }
             }

+ 1 - 1
haha-mapper/src/main/java/com/haha/mapper/DeviceInventoryMapper.java

@@ -61,7 +61,7 @@ public interface DeviceInventoryMapper extends BaseMapper<DeviceInventory> {
             "  COUNT(di.id) as product_count, " +
             "  MAX(di.last_restock_time) as last_restock_time, " +
             "  SUM(CASE WHEN di.stock = 0 THEN 1 ELSE 0 END) as zero_stock_count, " +
-            "  SUM(CASE WHEN di.stock &lt;= di.warning_threshold AND di.stock > 0 THEN 1 ELSE 0 END) as low_stock_count, " +
+            "  SUM(CASE WHEN di.stock &lt; di.standard_stock AND di.standard_stock > 0 THEN 1 ELSE 0 END) as low_stock_count, " +
             "  SUM(CASE WHEN di.product_id IS NULL OR di.product_id = 0 THEN 1 ELSE 0 END) as unknown_product_count " +
             "FROM t_device d " +
             "LEFT JOIN t_shop s ON d.shop_id = s.id " +