From 3b434cdc16b71dbc981b364d41a7337fa3f4d43c Mon Sep 17 00:00:00 2001
From: zhaowc <526854230@qq.com>
Date: 星期六, 23 八月 2025 13:10:41 +0800
Subject: [PATCH] 新增页面用户名显示

---
 Wms/Wms/Controllers/BasisController.cs |  118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 116 insertions(+), 2 deletions(-)

diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index eac6a92..823b2a9 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -20,6 +20,7 @@
 using System.Security.Cryptography;
 using System.Data;
 using Model.ModelDto.LogDto;
+using WMS.IDAL.ISysInterface;
 
 namespace Wms.Controllers
 {
@@ -44,6 +45,9 @@
         private readonly IFunSettingServer _setting; //鍔熻兘璁惧畾
         private readonly IInterfaceServer _interface;//鎺ュ彛绠$悊
         private readonly IOperationSysServer _operation; //鎿嶄綔鏃ュ織
+        private readonly IRoleWareHouseServer _roleWareSvs; //鎿嶄綔鏃ュ織
+
+        private readonly IUserInforRepository _userInforRepository;
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
@@ -58,11 +62,12 @@
         /// <param name="department">閮ㄩ棬</param>
         /// <param name="setting">鍔熻兘璁惧畾</param>
         /// <param name="operation">鎿嶄綔鏃ュ織</param>
-        public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation)
+        public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IUserInforRepository userInfor, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation, IRoleWareHouseServer roleWareSvs)
         {
             _customerSvc = customerSvc;//瀹㈡埛Svc
             _logisticsSvc = logisticsSvc;//鐗╂祦Svc
             _userInforServer = userInforServer;//鐢ㄦ埛
+            _userInforRepository = userInfor;
             _rolesServer = rolesServer;//瑙掕壊
             _roleRightServer = roleRightServer;//瑙掕壊鏉冮檺
             _rBACServer = rBACServer;//RBAC
@@ -73,6 +78,7 @@
             _setting = setting; //鍔熻兘璁惧畾
             _interface = interfaceS;//鎺ュ彛绠$悊
             _operation = operation; //鎿嶄綔鏃ュ織
+            _roleWareSvs = roleWareSvs;
         }
         //鍩烘湰淇℃伅绠$悊
 
@@ -116,7 +122,22 @@
                 msg = "鎴愬姛"
             });
         }
-
+        /// <summary>
+        /// 鑾峰彇鐢ㄦ埛濮撳悕鍒楄〃
+        /// </summary>
+        /// <param name="id">鐢ㄦ埛id</param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetUserrealname(string username)
+        {
+            string userinfo = _userInforRepository.GetUserRealname(username);
+            return Ok(new
+            {
+                data = userinfo,
+                code = 0,
+                msg = "鎴愬姛"
+            });
+        }
 
         /// <summary>
         /// 鏂板鐢ㄦ埛淇℃伅
@@ -754,6 +775,99 @@
 
         #endregion
 
+        #region 瑙掕壊浠撳簱鏉冮檺
+
+        /// <summary>
+        /// 鑾峰彇瑙掕壊鏉冮檺淇℃伅鍒楄〃(鍗曡〃)
+        /// </summary>
+        /// <param name="id">瑙掕壊鏉冮檺id</param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetRoleWareHouseOneListById(int id)
+        {
+            try
+            {
+                List<SysRoleWareHouse> roleRights = _roleWareSvs.GetRoleWareHouseOneListById(id);
+                return Ok(new { data = roleRights, msg = "鎴愬姛", core = 0 });
+            }
+            catch (Exception e) 
+            {
+                return Ok(new { data = "", msg = e.Message, core = 1 });
+            }
+        }
+        /// <summary>
+        /// 鏍规嵁瑙掕壊id鑾峰彇褰撳墠鎵�鎷ユ湁鏉冮檺
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetHouseList()
+        {
+            try
+            {
+                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                if (claimsIdentity == null)
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+                if (string.IsNullOrWhiteSpace(UserId))
+                {
+                    throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
+                }
+
+                var housedto = _roleWareSvs.GetHouseList(UserId);
+                return Ok(new { data = housedto, code = 0, msg = "鎴愬姛" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", msg = e.Message, core = 1 });
+            }
+            
+        }
+
+        /// <summary>
+        /// 鍒嗛厤瑙掕壊鏉冮檺淇℃伅
+        /// </summary>
+        /// <param name="WareHouseNo">鑿滃崟鍙�</param>
+        /// <param name="id">瑙掕壊id</param>
+        /// <returns></returns>
+        /// <exception cref="Exception">鎹曡幏寮傚父</exception>
+        [HttpPost]
+        public async Task<IActionResult> InsertRoleWareHouse(string WareHouseNo, int id)
+        {
+            //鎹曡幏寮傚父
+            try
+            {
+                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
+                var claimsIdentity = this.User.Identity as ClaimsIdentity;
+                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
+
+                //鏍规嵁Id鑾峰彇瑙掕壊鍙�
+                SysRoles roles = _rolesServer.GetRoleInfoById(id);
+
+                //淇濆瓨瑙掕壊鏉冮檺淇℃伅
+                int i = await _roleWareSvs.InsertRoleWareHouse(WareHouseNo, roles.RoleNo, userId);
+                //鍒ゆ柇鏄惁鏂板鎴愬姛
+                if (i == 0)
+                {
+                    return Ok(new { data = i, msg = "鍒嗛厤澶辫触", code = 1 });
+                }
+                else
+                {
+                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", roles.RoleNo, "淇敼", "鍒嗛厤浠撳簱鏉冮檺 瑙掕壊鍙凤細" + roles.RoleNo, Convert.ToInt32(userId));
+                    return Ok(new { data = i, msg = "鍒嗛厤鎴愬姛", code = 0 });
+                }
+            }
+            catch (Exception ex)
+            {
+                return Ok(new { data = "", msg = "鏂板瑙掕壊鏉冮檺淇℃伅寮傚父"+ ex.Message, code = 1 });
+            }
+        }
+
+
+        #endregion
+
         #region 閮ㄩ棬绠$悊
 
         /// <summary>

--
Gitblit v1.8.0