From 2871334ab87ddbba7f64b7c51b93dbaa46fb185b Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期四, 27 三月 2025 08:14:48 +0800
Subject: [PATCH] 修改问题

---
 Wms/WMS.BLL/DataServer/StockDetailServer.cs |  153 +++++++++------------------------------------------
 1 files changed, 27 insertions(+), 126 deletions(-)

diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
index 9d629d2..f2f2563 100644
--- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs
+++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
@@ -38,146 +38,47 @@
         /// <param name="bitBoxMark">闆剁鏍囪</param>
         /// <param name="inspectStatus">璐ㄩ噺鐘舵��</param>
         /// <returns></returns>
-        public List<StockDetailDto> GetBindList(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, string status, string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus, string ownerNo, string ownerName, string startTime, string endTime)
+        public List<StockDetailDto> GetBindList(string wareHouseName, string areaName, string locatNo, string palletNo, string lotNo)
         {
-            string str = "select detail.*,house.WareHouseNo + '-' + house.WareHouseName as WareHouseName,roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName,area.AreaNo + '-' + area.AreaName as AreaName from DataStockDetail detail left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo left join SysStorageArea area on detail.AreaNo = area.AreaNo where detail.IsDel = @isdel";
-            //鍒ゆ柇鐗╂枡鍙锋槸鍚︿负绌�
-            if (!string.IsNullOrEmpty(skuNo))
+            string str = $@"select 
+                                detail.*,
+                                house.WareHouseNo + '-' + house.WareHouseName as WareHouseName,
+                                roadway.RoadwayNo + '-' + roadway.RoadwayName as RoadwayName,
+                                area.AreaNo + '-' + area.AreaName as AreaName 
+                            from DataStockDetail detail 
+                            left join SysStorageRoadway roadway on detail.RoadwayNo = roadway.RoadwayNo 
+                            left join SysWareHouse house on detail.WareHouseNo = house.WareHouseNo 
+                            left join SysStorageArea area on detail.AreaNo = area.AreaNo 
+                            where detail.IsDel = '0'";
+
+            //鍒ゆ柇鎵�灞炰粨搴撴槸鍚︿负绌�
+            if (!string.IsNullOrEmpty(wareHouseName))
             {
-                str += " and detail.SkuNo like @skuno";
+                str += $" and (house.WareHouseNo like '%{wareHouseName}%' or house.WareHouseName like '%{wareHouseName}%')";
             }
-            //鍒ゆ柇鐗╂枡鍚嶇О鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(skuName))
+            //鍒ゆ柇鎵�灞炲尯鍩熸槸鍚︿负绌�
+            if (!string.IsNullOrEmpty(areaName))
             {
-                str += " and detail.SkuName like @skuname";
+                str += $" and (area.AreaNo like '%{areaName}%' or area.AreaName like '%{areaName}%')";
+            }
+            //鍒ゆ柇鎵�灞炲偍浣嶆槸鍚︿负绌�
+            if (!string.IsNullOrEmpty(locatNo))
+            {
+                str += $" and detail.LocatNo like '%{locatNo}%'";
             }
             //鍒ゆ柇鎵樼洏鍙锋槸鍚︿负绌�
             if (!string.IsNullOrEmpty(palletNo))
             {
-                str += " and detail.PalletNo like @palletno";
+                str += $" and detail.PalletNo like '%{palletNo}%'";
             }
             //鍒ゆ柇鎵规鏄惁涓虹┖
             if (!string.IsNullOrEmpty(lotNo))
             {
-                str += " and detail.LotNo like @lotno";
+                str += $" and detail.LotNo like  '%{lotNo}%'";
             }
-            //鍒ゆ柇闆舵墭鏍囪鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(bitPalletMark))
-            {
-                str += " and detail.BitPalletMark = @bitpalletmark";
-            }
-            //鍒ゆ柇璐т富缂栫爜鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(ownerNo))
-            {
-                str += " and detail.OwnerNo like @ownerNo";
-            }
-            //鍒ゆ柇璐т富鍚嶇О鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(ownerName))
-            {
-                str += " and detail.OwnerName like @ownerName";
-            }
-            if (!string.IsNullOrEmpty(startTime))
-            {
-                str += $" and detail.CompleteTime >= '{startTime}'";
-            }
-            if (!string.IsNullOrEmpty(endTime))
-            {
-                endTime = Convert.ToDateTime(endTime).AddDays(1).ToString();
-                str += $" and detail.CompleteTime < '{endTime}'";
-            }
-
-            int i = 0;
-            //鍦ㄧ鐮佹槑缁嗕腑鑾峰彇鐩稿簲鏁版嵁
-            string boxstr = "select StockDetailId from DataBoxInfo Where IsDel = @isdel";
-            //鍒ゆ柇绠辩爜鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(boxNo))
-            {
-                boxstr += " and BoxNo like @boxno";
-                i = 1;
-            }
-            //鍒ゆ柇绠辨敮鐘舵�佹槸鍚︿负绌�
-            if (!string.IsNullOrEmpty(status))
-            {
-                boxstr += " and Status = @status";
-                i = 1;
-            }
-            //鍒ゆ柇妫�楠屾爣璁版槸鍚︿负绌�
-            if (!string.IsNullOrEmpty(inspectMark))
-            {
-                boxstr += " and InspectMark = @inspectmark";
-                str += " and detail.InspectMark = @inspectmark";
-                i = 1;
-            }
-            //鍒ゆ柇闆剁鏍囪鏄惁涓虹┖
-            if (!string.IsNullOrEmpty(bitBoxMark))
-            {
-                boxstr += " and BitBoxMark = @bitboxmark";
-                i = 1;
-            }
-            //鍒ゆ柇璐ㄩ噺鐘舵�佹槸鍚︿负绌�
-            if (!string.IsNullOrEmpty(inspectStatus))
-            {
-                boxstr += " and InspectStatus = @inspectstatus";
-                str += " and detail.InspectStatus = @inspectstatus";
-                i = 1;
-            }
-            //灏嗙鐮佹暟鎹繘琛屾帓搴�
-            boxstr += " order by StockDetailId";
-            //鏌ュ嚭绠辩爜鏄庣粏涓俊鎭�
-            List<int> stockDetailId = Db.Ado.SqlQuery<int>(boxstr, new
-            {
-                isdel = "0", //鏄惁鍒犻櫎
-                boxno = "%" + boxNo + "%", //绠辩爜
-                status, //绠辨敮鐘舵��
-                inspectmark = inspectMark, //妫�楠屾爣璁�
-                bitboxmark = bitBoxMark, //闆剁鏍囪
-                inspectstatus = inspectStatus //璐ㄩ噺鐘舵��
-            });
-            //鍘婚噸
-            // List<int> newArr = null;
-            string arr = "";
-            //鍒ゆ柇鏄惁鏈夋煡绠辩爜淇℃伅
-            if (i == 1)
-            {
-                if (stockDetailId.Count > 0)
-                {
-                    //鍘婚噸
-                    arr += stockDetailId[0].ToString();
-
-                    for (int a = 1; a < stockDetailId.Count; a++)
-                    {
-                        if (stockDetailId[a] != stockDetailId[a - 1])
-                        {
-                            arr += ',' + stockDetailId[a].ToString();
-                        }
-                    }
-                }
-                if (!string.IsNullOrEmpty(arr))
-                {
-                    str += $" and Id in ({arr})";
-                }
-                else
-                {
-                    str += " and Id = ''";
-                }
-            }
-
             //鎺掑簭
-            str += " order by PalletNo,SkuNo,LotNo";
-            List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str, new
-            {
-                isdel = "0", //鏄惁鍒犻櫎
-                skuno = "%" + skuNo + "%", //鐗╂枡鍙�
-                skuname = "%" + skuName + "%", //鐗╂枡鍚嶇О
-                palletno = "%" + palletNo + "%", //鎵樼洏
-                lotno = "%" + lotNo + "%", //鎵规鍙�
-                bitpalletmark = bitPalletMark, //闆舵墭鏍囪
-                inspectmark = inspectMark, //妫�楠屾爣璁�
-                inspectstatus = inspectStatus, //璐ㄩ噺鐘舵��
-                ownerNo = "%" + ownerNo + "%", //璐т富缂栫爜
-                ownerName = "%" + ownerName + "%" //璐т富鍚嶇О
-                //stockdetailid = "(" + arr + ")" //搴撳瓨鏄庣粏id
-            });
+            str += " order by PalletNo";
+            List<StockDetailDto> boxInforList = Db.Ado.SqlQuery<StockDetailDto>(str).ToList();
 
             return boxInforList;
         }

--
Gitblit v1.8.0