admin
2025-11-13 1a585367f0486866a376ce65c43ff3283ad32014
Wms/WMS.BLL/BllPdaServer/PdaCrServer.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Reflection.Metadata;
using System.Security.Cryptography.X509Certificates;
@@ -412,23 +413,54 @@
        #endregion
        #region 库存查询
        /// <summary>
        /// pda库存查询
        /// </summary>
        /// <param name="locatNo">储位编号</param>
        /// <param name="palletNo">托盘号</param> 
        /// <param name="boxNo">箱码</param>
        /// <returns></returns>
        //public async Task<List<DataStockDetail>> GetStockQueryList(string locatNo, string palletNo)
        //{
        //    return await Db.Queryable<DataStockDetail>()
        //             .Where(s => s.IsDel == "0" && s.LocatNo.Contains(locatNo) || s.PalletNo.Contains(palletNo))
        //             .OrderBy(s => new { s.LotNo, s.LocatNo, s.PalletNo })
        //             .ToListAsync();
        //}
        public async Task<List<StockDetailWithQtyDto>> GetStockQueryList(string locatNo, string palletNo, string boxNo)
        {
            string dataSql = "";
            if (string.IsNullOrWhiteSpace(boxNo))
            {
                dataSql = $@"select SkuName,SkuNo,LotNo,sum(isnull(Qty,0)) as Qty,sum(isnull(LockQty,0)) as LockQty,sum(isnull(LockQty,0)) as FrozenQty
   from DataStockDetail
   where IsDel='0' and (PalletNo='{palletNo}' or LocatNo='{locatNo}')
   group by SkuName,SkuNo,LotNo
   order by SkuNo,LotNo";
            }
            else
            {
                dataSql = $@"select SkuName,SkuNo,LotNo,sum(isnull(Qty,0)) as Qty,0 as LockQty,0 as FrozenQty
   from DataBoxInfo
   where IsDel='0' and BoxNo='{boxNo}' and PalletNo='{palletNo}'
   group by SkuName,SkuNo,LotNo
   order by SkuNo,LotNo";
            }
            DataTable dataDt = await Db.Ado.GetDataTableAsync(dataSql);
            var result = dataDt.Rows.Cast<DataRow>().Select(e => new StockDetailWithQtyDto
            {
                SkuNo = e["SkuNo"] + "",
                SkuName = e["SkuName"] + "",
                LotNo = e["LotNo"] + "",
                Qty = Convert.ToDecimal(e["Qty"]),
                LockQty = Convert.ToDecimal(e["LockQty"]),
                FrozenQty = Convert.ToDecimal(e["FrozenQty"])
            });
            return result.ToList();
        }
        #region 注释代码
        /*
        public async Task<List<StockDetailWithQtyDto>> GetStockQueryList(string locatNo, string palletNo, string boxNo)
        {
            return await Db.Queryable<DataStockDetail>("a")
                .InnerJoin<DataBoxInfo>((a, b) => a.LotNo == b.LotNo)
                .Where((a, b) => a.IsDel == "0")
@@ -529,8 +561,10 @@
                })
                .ToListAsync();
        }
        */
        #endregion
        #region 托盘变更(托盘解绑绑定)
        //根据托盘号获取箱码和箱内数量