From 7e88876cd6c68e963ec0560f4e329e5dad483d9c Mon Sep 17 00:00:00 2001
From: admin <qiutairan163@163.com>
Date: 星期五, 28 十一月 2025 16:58:16 +0800
Subject: [PATCH] 增加casno等7个字段

---
 Wms/WMS.BLL/DataServer/StockDetailServer.cs |   91 +++++++++++++++++++++++++++++++++------------
 1 files changed, 67 insertions(+), 24 deletions(-)

diff --git a/Wms/WMS.BLL/DataServer/StockDetailServer.cs b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
index e8699c6..edaa9b0 100644
--- a/Wms/WMS.BLL/DataServer/StockDetailServer.cs
+++ b/Wms/WMS.BLL/DataServer/StockDetailServer.cs
@@ -6,6 +6,7 @@
 using SqlSugar;
 using WMS.BLL.LogServer;
 using WMS.DAL;
+using WMS.Entity.BllAsnEntity;
 using WMS.Entity.BllQualityEntity;
 using WMS.Entity.Context;
 using WMS.Entity.DataEntity;
@@ -13,11 +14,11 @@
 
 namespace WMS.BLL.DataServer
 {
-    public class StockDetailServer:DbHelper<DataStockDetail>,IStockDetailServer
+    public class StockDetailServer : DbHelper<DataStockDetail>, IStockDetailServer
     {
         private static readonly SqlSugarScope Db = DataContext.Db;
 
-        public StockDetailServer():base(Db)
+        public StockDetailServer() : base(Db)
         {
         }
 
@@ -37,16 +38,14 @@
         /// <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 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, string WareHouseNo, string AreaNo)
         {
-            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";
+            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))
             {
@@ -70,7 +69,7 @@
             //鍒ゆ柇闆舵墭鏍囪鏄惁涓虹┖
             if (!string.IsNullOrEmpty(bitPalletMark))
             {
-                str += " and detail.BitPalletMark = @bitpalletmark";
+                str += " and detail.BitPalletMark=@bitpalletmark";
             }
             //鍒ゆ柇璐т富缂栫爜鏄惁涓虹┖
             if (!string.IsNullOrEmpty(ownerNo))
@@ -84,17 +83,30 @@
             }
             if (!string.IsNullOrEmpty(startTime))
             {
-                str += $" and detail.CompleteTime >= '{startTime}'";
+                str += $" and detail.CompleteTime>='{startTime}'";
             }
             if (!string.IsNullOrEmpty(endTime))
             {
                 endTime = Convert.ToDateTime(endTime).AddDays(1).ToString();
-                str += $" and detail.CompleteTime < '{endTime}'";
+                str += $" and detail.CompleteTime<'{endTime}'";
+            }
+            //閲嶅鏉′欢
+            //if (!string.IsNullOrEmpty(WareHouseNo)) 
+            //{
+            //    str += $" and detail.WareHouseNo = '{WareHouseNo}'";
+            //}
+            if (!string.IsNullOrEmpty(WareHouseNo))
+            {
+                str += $" and detail.WareHouseNo='{WareHouseNo}'";
+            }
+            if (!string.IsNullOrEmpty(AreaNo))
+            {
+                str += $" and detail.AreaNo='{AreaNo}'";
             }
 
             int i = 0;
             //鍦ㄧ鐮佹槑缁嗕腑鑾峰彇鐩稿簲鏁版嵁
-            string boxstr = "select StockDetailId from DataBoxInfo Where IsDel = @isdel";
+            string boxstr = "select StockDetailId from DataBoxInfo Where IsDel=@isdel";
             //鍒ゆ柇绠辩爜鏄惁涓虹┖
             if (!string.IsNullOrEmpty(boxNo))
             {
@@ -104,27 +116,27 @@
             //鍒ゆ柇绠辨敮鐘舵�佹槸鍚︿负绌�
             if (!string.IsNullOrEmpty(status))
             {
-                boxstr += " and Status = @status";
+                boxstr += " and Status=@status";
                 i = 1;
             }
             //鍒ゆ柇妫�楠屾爣璁版槸鍚︿负绌�
             if (!string.IsNullOrEmpty(inspectMark))
             {
-                boxstr += " and InspectMark = @inspectmark";
-                str += " and detail.InspectMark = @inspectmark";
+                boxstr += " and InspectMark=@inspectmark";
+                str += " and detail.InspectMark=@inspectmark";
                 i = 1;
             }
             //鍒ゆ柇闆剁鏍囪鏄惁涓虹┖
             if (!string.IsNullOrEmpty(bitBoxMark))
             {
-                boxstr += " and BitBoxMark = @bitboxmark";
+                boxstr += " and BitBoxMark=@bitboxmark";
                 i = 1;
             }
             //鍒ゆ柇璐ㄩ噺鐘舵�佹槸鍚︿负绌�
             if (!string.IsNullOrEmpty(inspectStatus))
             {
-                boxstr += " and InspectStatus = @inspectstatus";
-                str += " and detail.InspectStatus = @inspectstatus";
+                boxstr += " and InspectStatus=@inspectstatus";
+                str += " and detail.InspectStatus=@inspectstatus";
                 i = 1;
             }
             //灏嗙鐮佹暟鎹繘琛屾帓搴�
@@ -160,11 +172,11 @@
                 }
                 if (!string.IsNullOrEmpty(arr))
                 {
-                    str += $" and Id in ({arr})";
+                    str += $" and detail.Id in ({arr})";
                 }
                 else
                 {
-                    str += " and Id = ''";
+                    str += " and detail.Id=''";
                 }
             }
 
@@ -187,7 +199,38 @@
 
             return boxInforList;
         }
+        /// <summary>
+        /// 鎵樼洏鏄庣粏澶囨敞
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="demo"></param>
+        /// <param name="userId"></param>
+        /// <exception cref="Exception"></exception>
+        public void EditStockDetailDemo(int id, string demo, int userId)
+        {
+            try
+            {
+                var detail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.Id == id);
+                if (detail == null)
+                {
+                    throw new Exception("鏈煡璇㈠埌搴撳瓨鏄庣粏淇℃伅");
+                }
+                detail.Demo = demo + "".Trim();
+                detail.UpdateUser = userId;
+                detail.UpdateTime = DateTime.Now;
 
+                int i = Db.Updateable(detail).ExecuteCommand();
+                if (i > 0)
+                {
+                    //娣诲姞鎿嶄綔鏃ュ織
+                    new OperationASNServer().AddLogOperationAsn("搴撳瓨缁熻", "鎵樼洏鏄庣粏", detail.PalletNo, "缂栬緫", $"缂栬緫浜嗘墭鐩樺彿涓簕detail.PalletNo}鐨勫娉ㄤ俊鎭�", userId);
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception(ex.Message);
+            }
+        }
 
         #endregion
 
@@ -206,7 +249,7 @@
         /// <param name="bitBoxMark">闆剁鏍囪</param>
         /// <param name="inspectStatus">璐ㄩ噺鐘舵��</param>
         /// <returns></returns>
-        public List<DataStockDetail> GetBindListDaoChu(string skuNo, string skuName, string palletNo, string lotNo, string boxNo, 
+        public List<DataStockDetail> GetBindListDaoChu(string skuNo, string skuName, string palletNo, string lotNo, string boxNo,
             string status, string inspectMark, string bitPalletMark, string bitBoxMark, string inspectStatus)
         {
             string str = "select Id,LotNo,LotText,SupplierLot,SkuNo,SkuName,Qty,LockQty,FrozenQty,AreaNo,LocatNo,PalletNo,PalletNo2," +

--
Gitblit v1.8.0