From 00a72fff219241eb5b0405a066cc859d07cf7735 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期三, 17 九月 2025 10:23:44 +0800
Subject: [PATCH] 1111

---
 service/Warehouse/KwbgManager.cs |  117 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 56 insertions(+), 61 deletions(-)

diff --git a/service/Warehouse/KwbgManager.cs b/service/Warehouse/KwbgManager.cs
index 5e9dbb8..93f22ef 100644
--- a/service/Warehouse/KwbgManager.cs
+++ b/service/Warehouse/KwbgManager.cs
@@ -1,27 +1,30 @@
 锘縰sing System.Data;
 using System.Data.SqlClient;
+using Masuit.Tools;
+using Masuit.Tools.Hardware;
 using NewPdaSqlServer.DB;
+using NewPdaSqlServer.Dto.service;
 using NewPdaSqlServer.entity;
-using NewPdaSqlServer.util;
 using SqlSugar;
+using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
 
 namespace NewPdaSqlServer.service.Warehouse;
 
 /// <summary>
-///     搴撲綅鍙樻洿绠$悊绫伙紝缁ф壙鑷�氱敤浠撳偍绫籖epository锛屾搷浣滈噰璐��璐х敵璇疯〃锛圡esCgthSq锛�
+/// 搴撲綅鍙樻洿绠$悊绫伙紝缁ф壙鑷�氱敤浠撳偍绫籖epository锛屾搷浣滈噰璐��璐х敵璇疯〃锛圡esCgthSq锛�
 /// </summary>
 public class KwbgManager : Repository<MesCgthSq>
 {
     /// <summary>
-    ///     鏍规嵁浼犲叆鐨刉arehouseQuery瀵硅薄锛堝寘鍚潯鐮佷俊鎭級锛屾煡璇㈢墿鏂欏簱瀛樿〃MES_INV_ITEM_STOCKS锛岃幏鍙栧搴旂殑搴撳瓨淇℃伅
+    /// 鏍规嵁浼犲叆鐨刉arehouseQuery瀵硅薄锛堝寘鍚潯鐮佷俊鎭級锛屾煡璇㈢墿鏂欏簱瀛樿〃MES_INV_ITEM_STOCKS锛岃幏鍙栧搴旂殑搴撳瓨淇℃伅
     /// </summary>
     /// <param name="unity">WarehouseQuery瀵硅薄锛屽寘鍚潯鐮佺紪鍙风瓑鏌ヨ鏉′欢</param>
     /// <returns>
-    ///     杩斿洖MES_INV_ITEM_STOCKS琛ㄤ腑涓庢潯鐮佸尮閰嶇殑绗竴鏉″簱瀛樹俊鎭紙MesInvItemStocks绫诲瀷锛夈��
-    ///     濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜搴撳瓨涓嶅瓨鍦紒鈥�
-    ///     resultInfos.tbBillList = m.GetBarInfo(unity);
+    /// 杩斿洖MES_INV_ITEM_STOCKS琛ㄤ腑涓庢潯鐮佸尮閰嶇殑绗竴鏉″簱瀛樹俊鎭紙MesInvItemStocks绫诲瀷锛夈��
+    /// 濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜搴撳瓨涓嶅瓨鍦紒鈥�
+    /// resultInfos.tbBillList = m.GetBarInfo(unity);
     /// </returns>
-    /// public MesInvItemStocks GetBarInfo(WarehouseQuery unity)
+    ///public MesInvItemStocks GetBarInfo(WarehouseQuery unity)
     public dynamic GetBarInfo(dynamic query)
     {
         if (query == null)
@@ -31,19 +34,18 @@
             throw new ArgumentException("鐗╂枡鏉$爜涓嶈兘涓虹┖", nameof(query.barcode));
 
         var parameters = new[]
-        {
-            new SugarParameter("@pi_barcode", query.barcode),
-            new SugarParameter("@inP1", null),
-            new SugarParameter("@inP2", null),
-            new SugarParameter("@inP3", null),
-            new SugarParameter("@inP4", null)
-        };
+    {
+        new SugarParameter("@pi_barcode", query.barcode),
+        new SugarParameter("@inP1", null),
+        new SugarParameter("@inP2", null),
+        new SugarParameter("@inP3", null),
+        new SugarParameter("@inP4", null)
+    };
 
         try
         {
-            var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(
-                "EXEC prc_pda_kwbg_selKwInfoByBarcode @pi_barcode,@inP1,@inP2,@inP3,@inP4",
-                parameters);
+            List<dynamic>? ZsBarInfo = Db.Ado.SqlQuery<dynamic>(
+                "EXEC prc_pda_kwbg_selKwInfoByBarcode @pi_barcode,@inP1,@inP2,@inP3,@inP4", parameters);
 
             return ZsBarInfo;
         }
@@ -55,13 +57,13 @@
     }
 
     /// <summary>
-    ///     鏍规嵁鐗╂枡ID鏌ヨ鐗╂枡琛∕ES_ITEMS锛岃幏鍙栫墿鏂欒缁嗕俊鎭�
+    /// 鏍规嵁鐗╂枡ID鏌ヨ鐗╂枡琛∕ES_ITEMS锛岃幏鍙栫墿鏂欒缁嗕俊鎭�
     /// </summary>
     /// <param name="strItemId">鐗╂枡ID锛坉ecimal绫诲瀷锛�</param>
     /// <returns>
-    ///     杩斿洖MES_ITEMS琛ㄤ腑涓嶪D鍖归厤涓旀湭绂佺敤锛團forbidstatus涓�"A"锛夌殑绗竴鏉$墿鏂欎俊鎭紙MesItems绫诲瀷锛夈��
-    ///     濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜瀵瑰簲鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢紒鈥�
-    ///     resultInfos.tbMesItems = m.GetItemNo(resultInfos.tbBillList.ItemId);
+    /// 杩斿洖MES_ITEMS琛ㄤ腑涓嶪D鍖归厤涓旀湭绂佺敤锛團forbidstatus涓�"A"锛夌殑绗竴鏉$墿鏂欎俊鎭紙MesItems绫诲瀷锛夈��
+    /// 濡傛灉鏈壘鍒帮紝鍒欐姏鍑哄紓甯告彁绀衡�滆鏉$爜瀵瑰簲鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢紒鈥�
+    /// resultInfos.tbMesItems = m.GetItemNo(resultInfos.tbBillList.ItemId);
     /// </returns>
     public MesItems GetItemNo(decimal strItemId)
     {
@@ -77,15 +79,14 @@
         // 杩斿洖鏌ヨ鍒扮殑鐗╂枡淇℃伅瀵硅薄
         return itemInfo;
     }
-
     /// <summary>
-    ///     浠撳簱淇℃伅琛�
+    /// 浠撳簱淇℃伅琛�
     /// </summary>
     /// <param name="depot_id"></param>
     /// <returns></returns>
     public MesDepots GetDepot(decimal depot_id)
     {
-        var depotInfo = Db.Queryable<MesDepots>()
+        var depotInfo = Db.Queryable< MesDepots >()
             .Where(s => s.DepotId == depot_id)
             .First(); // 鑾峰彇绗竴鏉″尮閰嶈褰�
         // 濡傛灉鏈煡璇㈠埌缁撴灉锛坕temInfo涓簄ull锛夛紝鍒欐姏鍑哄紓甯革紝鎻愮ず鐗╂枡淇℃伅涓嶅瓨鍦ㄦ垨宸茬鐢�
@@ -94,8 +95,9 @@
     }
 
 
+
     /// <summary>
-    ///     鍙樻洿搴撲綅
+    /// 鍙樻洿搴撲綅
     /// </summary>
     /// <param name="unity"></param>
     /// <returns></returns>
@@ -114,15 +116,13 @@
         {
             //if (string.IsNullOrEmpty(query.barcode?.ToString()))
             //throw new ArgumentException("鐗╂枡鏉$爜涓嶈兘涓虹┖", nameof(query.barcode));
-
+ 
             if (string.IsNullOrEmpty(unity.userName?.ToString()))
                 throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(unity.userName));
             if (string.IsNullOrEmpty(unity.OldDepotSectionCode?.ToString()))
-                throw new ArgumentException("鍘熷簱浣嶄笉鍏佽涓虹┖",
-                    nameof(unity.OldDepotSectionCode));
+                throw new ArgumentException("鍘熷簱浣嶄笉鍏佽涓虹┖", nameof(unity.OldDepotSectionCode));
             if (string.IsNullOrEmpty(unity.NewDepotSectionCode?.ToString()))
-                throw new ArgumentException("鏂板簱浣嶄笉鍏佽涓虹┖",
-                    nameof(unity.NewDepotSectionCode));
+                throw new ArgumentException("鏂板簱浣嶄笉鍏佽涓虹┖", nameof(unity.NewDepotSectionCode));
             if (string.IsNullOrEmpty(unity.barcode?.ToString()))
                 throw new ArgumentException("鐗╂枡鏉$爜涓嶅厑璁镐负绌�", nameof(unity.barcode));
 
@@ -144,31 +144,25 @@
                     // 鏋勯�犲瓨鍌ㄨ繃绋嬪弬鏁版暟缁�
                     SqlParameter[] parameters =
                     {
-                        // 杈撳嚭鍙傛暟锛氳繑鍥炰俊鎭�
-                        new("@outMsg", SqlDbType.NVarChar, 2000),
-                        // 杈撳嚭鍙傛暟锛氳繑鍥炴暟閲�
-                        new("@outSum", SqlDbType.Int),
-                        // 杈撳嚭鍙傛暟锛氳繑鍥炴柊搴撲綅浠g爜
-                        new("@new_depotSectionsCode", SqlDbType.NVarChar, 300),
-                        // 杈撳叆鍙傛暟锛氭搷浣滅敤鎴�
-                        new SqlParameter("@c_user",
-                            unity.userName?.ToString() ?? ""),
-                        // 杈撳叆鍙傛暟锛氬師鏉$爜
-                        new SqlParameter("@p_barcode",
-                            unity.barcode?.ToString() ?? ""),
-                        // 杈撳叆鍙傛暟锛氬師搴撲綅浠g爜
-                        new("@old_depotSectionsCode",
-                            unity.OldDepotSectionCode?.ToString() ?? ""),
-                        // 杈撳叆鍙傛暟锛氭柊搴撲綅浠g爜
-                        new("@new_depotSectionsCode_input",
-                            unity.NewDepotSectionCode?.ToString() ?? ""),
-                        // 杈撳叆鍙傛暟锛氫粨搴撲唬鐮�
-                        new("@DepotCode", unity.DepotCode)
-                            { Value = unity.DepotCode ?? "" },
-                        // 杈撳叆鍙傛暟锛氫粨搴搃d
-                        new("@DepotId",
-                            (int?)unity.DepotId ?? (object)DBNull.Value)
-                    };
+                    // 杈撳嚭鍙傛暟锛氳繑鍥炰俊鎭�
+                    new("@outMsg", SqlDbType.NVarChar, 2000),
+                    // 杈撳嚭鍙傛暟锛氳繑鍥炴暟閲�
+                    new("@outSum", SqlDbType.Int),
+                    // 杈撳嚭鍙傛暟锛氳繑鍥炴柊搴撲綅浠g爜
+                    new("@new_depotSectionsCode", SqlDbType.NVarChar, 300),
+                    // 杈撳叆鍙傛暟锛氭搷浣滅敤鎴�
+                    new SqlParameter("@c_user", unity.userName?.ToString() ?? ""),
+                    // 杈撳叆鍙傛暟锛氬師鏉$爜
+                    new SqlParameter("@p_barcode", unity.barcode?.ToString() ?? ""),
+                    // 杈撳叆鍙傛暟锛氬師搴撲綅浠g爜
+                    new("@old_depotSectionsCode", unity.OldDepotSectionCode?.ToString() ??""),
+                    // 杈撳叆鍙傛暟锛氭柊搴撲綅浠g爜
+                    new("@new_depotSectionsCode_input", unity.NewDepotSectionCode?.ToString() ??""),
+                    // 杈撳叆鍙傛暟锛氫粨搴撲唬鐮�
+                    new("@DepotCode", unity.DepotCode) { Value = unity.DepotCode ?? "" },
+                    // 杈撳叆鍙傛暟锛氫粨搴搃d
+                    new SqlParameter("@DepotId", (int?)unity.DepotId ?? (object)DBNull.Value)
+                };
                     // 璁剧疆杈撳嚭鍙傛暟鏂瑰悜
                     parameters[0].Direction = ParameterDirection.Output;
                     parameters[1].Direction = ParameterDirection.Output;
@@ -182,10 +176,9 @@
                     cmd.ExecuteNonQuery();
 
                     // 鑾峰彇瀛樺偍杩囩▼杈撳嚭鍙傛暟鐨勫��
-                    _strMsg = parameters[0].Value.ToString(); // 杩斿洖淇℃伅
-                    _intSum = parameters[1].Value.ToString(); // 杩斿洖鏁伴噺
-                    _NewDepotSectionCode =
-                        parameters[2].Value.ToString(); // 鏂板簱浣嶄唬鐮�
+                    _strMsg = parameters[0].Value.ToString();    // 杩斿洖淇℃伅
+                    _intSum = parameters[1].Value.ToString();    // 杩斿洖鏁伴噺
+                    _NewDepotSectionCode = parameters[2].Value.ToString();     // 鏂板簱浣嶄唬鐮�
 
                     // 鍒ゆ柇鍙樻洿缁撴灉锛屽鏋滄暟閲忓皬浜庣瓑浜�0锛屽垯琛ㄧず鍙樻洿澶辫触锛屾姏鍑哄紓甯稿苟杩斿洖閿欒淇℃伅
                     var result = Convert.ToInt32(_intSum);
@@ -194,8 +187,8 @@
                     // 浣跨敤鍖垮悕瀵硅薄鑰屼笉鏄� dynamic? 鏇村悎閫�
                     var dto = new
                     {
-                        unity.barcode,
-                        unity.OldDepotSectionCode,
+                        barcode = unity.barcode,
+                        OldDepotSectionCode = unity.OldDepotSectionCode,
                         NewDepotSectionCode = _NewDepotSectionCode
                     };
 
@@ -221,4 +214,6 @@
     ProductionPickDto鏈夎繃娣诲姞
     public int? DepotId { get; set; }    //浠撳簱id
      */
+
+
 }
\ No newline at end of file

--
Gitblit v1.9.3