From ea79dd023ae2785d301e88b8133c0d5f553674cb Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期日, 31 八月 2025 21:59:02 +0800
Subject: [PATCH] 1.库位查询组织权限区分 2.PDA多组织切换

---
 service/Warehouse/MesKwcxManager.cs |    2 +-
 Controllers/LoginController.cs      |   28 ++++++++++++++++++++++++++++
 service/base/LoginService.cs        |   30 ++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs
index 19ca7d3..4e76314 100644
--- a/Controllers/LoginController.cs
+++ b/Controllers/LoginController.cs
@@ -134,4 +134,32 @@
             return ResponseResult.ResponseError(ex);
         }
     }
+
+
+    /// <summary>
+    ///     鍒囨崲缁勭粐
+    /// </summary>
+    /// <param name="model"></param>
+    /// <returns></returns>
+    [HttpPost("changeOrg")]
+    public ResponseResult changeOrg([FromBody] dynamic model)
+    {
+        //鐧诲綍
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new LoginService().changeOrg(model);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
 }
\ No newline at end of file
diff --git a/service/Warehouse/MesKwcxManager.cs b/service/Warehouse/MesKwcxManager.cs
index bca6448..74b7559 100644
--- a/service/Warehouse/MesKwcxManager.cs
+++ b/service/Warehouse/MesKwcxManager.cs
@@ -85,7 +85,7 @@
         var sql2 = new StringBuilder(@"exec prc_pda_kwcx_itemInfo @barCode,@itemNo,@orgId");
         sqlParams.Add(new("@barCode", unity.barCode));
         sqlParams.Add(new("@itemNo", unity.itemNo));
-        sqlParams.Add(new("@orgId", unity.orgId));
+        sqlParams.Add(new("@orgId", orgId));
 
         var list = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams);
 
diff --git a/service/base/LoginService.cs b/service/base/LoginService.cs
index e3e9081..5314f17 100644
--- a/service/base/LoginService.cs
+++ b/service/base/LoginService.cs
@@ -148,4 +148,34 @@
         //return sysUser;
         return null;
     }
+
+    public dynamic changeOrg(dynamic query)
+    {
+        if (query == null) throw new ArgumentNullException(nameof(query), "鍙傛暟瀵硅薄涓嶈兘涓� null");
+
+        if (string.IsNullOrEmpty(query.userName?.ToString()))
+            throw new ArgumentException("鐢ㄦ埛鍚嶄笉鍏佽涓虹┖", nameof(query.userName));
+
+        var parameters = new[]
+        {
+        new SugarParameter("@pi_account", query.userName),
+        new SugarParameter("@inP1", null),
+        new SugarParameter("@inP2", null),
+        new SugarParameter("@inP3", null)
+        };
+
+        try
+        {
+            var orgInfo = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_my_selOrgInfo @pi_account,@inP1,@inP2,@inP3", parameters);
+
+            //if (sysUser.Count < 1) throw new Exception("鐢ㄦ埛涓嶅瓨鍦ㄥ叧鑱旂粍缁�");
+            return orgInfo;
+        }
+        catch (Exception ex)
+        {
+            // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫
+            throw new Exception($"{ex.Message}");
+        }
+
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3