schangxiang@126.com
2025-09-17 ff43ddf18764629ff875478e4e47a7281cbd230a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//using iWareSql.MyDbContext;
//using System;
//using System.Linq;
 
//namespace iWareCC.Common.Helper
//{
//    /// <summary>
//    /// 库存帮助类
//    /// </summary>
//    public class InventoryHelper
//    {
//        ///// <summary>
//        ///// 获取当前可用于出库的库存(已经减去锁定数量)
//        ///// </summary>
//        ///// <param name="materialCode"></param>
//        ///// <param name="_v_ware_inventory_for_out"></param>
//        ///// <param name=""></param>
//        ///// <returns></returns>
//        //public static int GetInventoryQtyForOutByMaterialCode(string materialCode,
//        //   MyDbContext dbContext)
//        //{
//        //    //计算可用于出库的库存 【Editby shaocx,2023-01-04】
//        //    var inventoryQty = GetInventoryQtyForOutByMaterialCodeWithNoLockData(materialCode, dbContext);
//        //    var lockedQty = GetInventoryQtyByMaterialCodeWithLock(materialCode, dbContext);
//        //    //var lockObj = dbContext.ware_material_locked.Where(x => x.MaterialCode == materialCode && x.IsDeleted == false).FirstOrDefault();
//        //    //if (lockObj != null)
//        //    //{
//        //    //    inventoryQty = inventoryQty - lockObj.LockedQty;
//        //    //}
//        //    inventoryQty = inventoryQty - lockedQty;
//        //    return inventoryQty;
//        //}
//        ///// <summary>
//        ///// 获取当前物料锁定库存(动态查询的)
//        ///// </summary>
//        ///// <param name="materialCode"></param>
//        ///// <param name="_v_ware_inventory_for_out"></param>
//        ///// <param name=""></param>
//        ///// <returns></returns>
//        //public static int GetInventoryQtyByMaterialCodeWithLock(string materialCode, MyDbContext dbContext)
//        //{
//        //    //计算可用于出库的库存 【Editby shaocx,2023-01-04】
//        //    var LockedQty = dbContext.v_ware_inventory_for_out.Where(x => x.WareMaterialCode == materialCode).Sum(x => x.LockedQty);
//        //    return LockedQty.HasValue ? LockedQty.Value : 0;
//        //}
 
//        /// <summary>
//        /// 获取当前可用于出库的库存(没有减去锁定数量)
//        /// </summary>
//        /// <param name="materialCode"></param>
//        /// <param name="_v_ware_inventory_for_out"></param>
//        /// <param name=""></param>
//        /// <returns></returns>
//        public static int GetInventoryQtyForOutByMaterialCodeWithNoLockData(string materialCode, MyDbContext dbContext)
//        {
//            //计算可用于出库的库存 【Editby shaocx,2023-01-04】
//            var inventoryQty = dbContext.v_ware_inventory_for_out.Where(x => x.WareMaterialCode == materialCode).Sum(x => x.Qty);
//            return inventoryQty == null ? 0 : Convert.ToInt32(inventoryQty);
//        }
//    }
//}