From 34bfa7df61921f7d1798fc08db0b8d81828da96b Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期二, 02 七月 2024 08:07:57 +0800
Subject: [PATCH] 物料、部门、功能设定

---
 Wms/Wms/Controllers/BasisController.cs | 1020 +++++++++++++----------------------------------------------
 1 files changed, 235 insertions(+), 785 deletions(-)

diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index 7980ce4..90ab56b 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -21,6 +21,7 @@
 using System.Data;
 using Model.ModelDto.LogDto;
 using Utility;
+using Model.ModelVm.LogVm;
 
 namespace Wms.Controllers
 {
@@ -119,12 +120,18 @@
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
         [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
         public async Task InsertUserinfo(UserInfoDto UserInfoDto)
         {
-            UserInfoDto.CreateUser = _userManager.UserId;
             await _userInforServer.InsertUserInfo(UserInfoDto);
-            await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", UserInfoDto.UserNo, "娣诲姞", "娣诲姞鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + UserInfoDto.UserNo, _userManager.UserId);
-
+            await _operation.InsertOperation(new OperationInputVm()
+            {
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = UserInfoDto.UserNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + UserInfoDto.UserNo
+            });
         }
 
 
@@ -136,12 +143,20 @@
         /// <exception cref="System.Exception">寮傚父</exception>
         [HttpGet]
         [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
         public async Task DeleteUserInfo(int userids)
         {
             //鑾峰彇鐢ㄦ埛淇℃伅
             SysUserInfor user = await _userInforServer.GetUserInfoById(userids);
             await _userInforServer.DeleteUserinfo(user);
-            await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", user.UserNo, "鍒犻櫎", "鍒犻櫎鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + user.UserNo, _userManager.UserId);
+            await _operation.InsertOperation(new OperationInputVm()
+            {
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = user.UserNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + user.UserNo
+            });
         }
 
 
@@ -153,39 +168,24 @@
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
         [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
         public async Task UpdateUserinfo(UserInfoDto userdto)
         {
-            userdto.UpdateUser = _userManager.UserId;
             await _userInforServer.UpdateUserinfo(userdto);
-            await _operation.InsertOperation("绯荤粺璁剧疆", "鐢ㄦ埛绠$悊", userdto.UserNo, "淇敼", "淇敼鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + userdto.UserNo, _userManager.UserId);
-
+            await _operation.InsertOperation(new OperationInputVm()
+            {
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鐢ㄦ埛绠$悊",
+                FkNo = userdto.UserNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼鐢ㄦ埛淇℃伅 鐢ㄦ埛鍙凤細" + userdto.UserNo
+            });
         }
 
 
         #endregion
 
         #region 淇敼瀵嗙爜
-
-        /// <summary>
-        /// 淇敼瀵嗙爜 鏍规嵁id鑾峰彇鐢ㄦ埛鍘熷瘑鐮�
-        /// </summary>
-        /// <param name="PassWord">鐢ㄦ埛鍘熷瘑鐮�</param>
-        /// <returns></returns>
-        //[HttpGet]
-        //public async int GetUserUptPassById(string PassWord, int userId)
-        //{
-        //    //鏍规嵁鐢ㄦ埛id鑾峰彇鐢ㄦ埛瀵嗙爜
-        //    SysUserInfor user = await _userInforServer.GetUserInfoById(userId);
-        //    //鍒ゆ柇鍘熷瘑鐮佹槸鍚︽纭�
-        //    if (user.PassWord == PassWord)
-        //    {
-        //        return 1;
-        //    }
-        //    else
-        //    {
-        //        return 0;
-        //    }
-        //}
 
         ///// <param name="userId">鐢ㄦ埛id</param>
         /// <summary>
@@ -206,20 +206,13 @@
             //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
             SysUserInfor user = await _userInforServer.GetUserInfoById(_userManager.UserId);
             if (user == null)
-            {
                 throw Oops.Bah("鎵句笉鍒扮敤鎴蜂俊鎭�");
-            }
             if (user.PassWord != pwdOld)
-            {
                 throw Oops.Bah("鍘熷瘑鐮佷笉姝g‘");
-            }
-            else
-            {
-                //淇敼瀵嗙爜
-                int i = await _userInforServer.UptUserPassWord(pwdNew, _userManager.UserId);
-                if (i <= 0)
-                    throw Oops.Bah("淇敼瀵嗙爜澶辫触");
-            }
+            //淇敼瀵嗙爜
+            int i = await _userInforServer.UptUserPassWord(pwdNew, _userManager.UserId);
+            if (i <= 0)
+                throw Oops.Bah("淇敼瀵嗙爜澶辫触");
         }
         /// <summary>
         /// x澶╁悗鎻愰啋鐢ㄦ埛淇敼瀵嗙爜
@@ -244,29 +237,10 @@
         /// <param name="RoleName">瑙掕壊鍚嶇О</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRolesList(string RoleNo, string RoleName)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<RoleDto>> GetRolesList(string RoleNo, string RoleName)
         {
-            //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-
-            //鏌ヨ
-            List<RoleDto> roles = _rolesServer.GetRoleList(RoleNo, RoleName, UserId);
-            //杩斿洖鏁版嵁
-            return Ok(new
-            {
-                data = roles,
-                code = 0,
-                msg = "鑾峰彇鎴愬姛"
-            });
+            return await _rolesServer.GetRoleList(RoleNo, RoleName);
         }
 
         /// <summary>
@@ -275,15 +249,10 @@
         /// <param name="roleid">瑙掕壊id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRolesListById(int roleid)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SysRoles> GetRolesListById(int roleid)
         {
-            SysRoles role = _rolesServer.GetRoleInfoById(roleid);
-            return Ok(new
-            {
-                data = role,
-                code = 0,
-                msg = "鑾峰彇鎴愬姛"
-            });
+            return await _rolesServer.GetRoleInfoById(roleid);
         }
 
         /// <summary>
@@ -293,52 +262,19 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> InsertRoleInfo(RoleDto roledto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task InsertRoleInfo(RoleDto roledto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _rolesServer.InsertRoleInfo(roledto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                roledto.CreateUser = uid;
-                int i = await _rolesServer.InsertRoleInfo(roledto);
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鏂板澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "瑙掕壊鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", roledto.RoleNo, "娣诲姞", "娣诲姞瑙掕壊淇℃伅 瑙掕壊鍙凤細" + roledto.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鏂板鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("瑙掕壊鏂板寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = roledto.RoleNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞瑙掕壊淇℃伅 瑙掕壊鍙凤細" + roledto.RoleNo
+            });
         }
 
         /// <summary>
@@ -348,45 +284,21 @@
         /// <returns></returns>
         /// <exception cref="System.Exception"></exception>
         [HttpGet]
-        public async Task<IActionResult> DeleteRoleInfo(int roleids)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task DeleteRoleInfo(int roleids)
         {
-            //鎹曡幏寮傚父
-            try
+            //鏍规嵁瑙掕壊id鑾峰彇瑙掕壊淇℃伅
+            SysRoles role = await _rolesServer.GetRoleInfoById(roleids);
+            await _rolesServer.DeleteRoleInfo(role);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鏍规嵁瑙掕壊id鑾峰彇瑙掕壊淇℃伅
-                SysRoles role = _rolesServer.GetRoleInfoById(roleids);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                role.UpdateUser = uid;
-                int i = await _rolesServer.DeleteRoleInfo(role);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鍒犻櫎澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", role.RoleNo, "鍒犻櫎", "鍒犻櫎瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鍒犻櫎鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("瑙掕壊鍒犻櫎寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = role.RoleNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo
+            });
         }
 
         /// <summary>
@@ -396,45 +308,19 @@
         /// <returns></returns>
         /// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> UpdateRolesInfo(SysRoles role)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task UpdateRolesInfo(SysRoles role)
         {
-            //鎹曡幏寮傚父
-            try
+            await _rolesServer.UpdateRoleInfo(role);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                role.UpdateUser = uid;
-
-                int i = await _rolesServer.UpdateRoleInfo(role);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "缂栬緫澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "瑙掕壊鏉冮檺", role.RoleNo, "淇敼", "淇敼瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "缂栬緫鎴愬姛"
-                    });
-                }
-            }
-            catch (System.Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new System.Exception("缂栬緫瑙掕壊寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = role.RoleNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼瑙掕壊淇℃伅 瑙掕壊鍙凤細" + role.RoleNo
+            });
         }
 
         #endregion
@@ -446,16 +332,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRBACLists(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<FunctionMenuDto>> GetRBACLists(int id)
         {
-            //List<RoleRightDto> roleright = 
-            var obj = _rBACServer.GetMenuByroleIdNew(id);
-            return Ok(new
-            {
-                data = obj,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetMenuByroleIdNew(id);
         }
 
 
@@ -464,27 +344,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightRBAC(int id, string MenuNo)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<FunctionMenuDto>> GetRoleRightRBAC(int id, string MenuNo)
         {
-            //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-            }
-
-            List<FunctionMenuDto> menudto = _rBACServer.GetRoleRightRBAC(MenuNo, UserId);
-            return Ok(new
-            {
-                data = menudto,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetRoleRightRBAC(MenuNo, UserId);
         }
 
         /// <summary>
@@ -492,15 +355,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightLists(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<RoleRightDto>> GetRoleRightLists(int id)
         {
-            List<RoleRightDto> roleRightDtos = _rBACServer.GetRoleRightList(id);
-            return Ok(new
-            {
-                data = roleRightDtos,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _rBACServer.GetRoleRightList(id);
         }
 
         /// <summary>
@@ -509,33 +367,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightList()
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<RoleRightDto>> GetRoleRightList()
         {
-            try
-            {
-                //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                if (claimsIdentity == null)
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                if (string.IsNullOrWhiteSpace(userId))
-                {
-                    return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
-                }
-                var roleRightDtos = _roleRightServer.GetRoleMenuList(int.Parse(userId));
-                return Ok(new
-                {
-                    data = roleRightDtos,
-                    msg = "鎴愬姛",
-                    code = 0
-                });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { msg = e.Message, code = 0 });
-            }
+            return await _roleRightServer.GetRoleMenuList();
         }
 
         /// <summary>
@@ -544,15 +379,10 @@
         /// <param name="id">瑙掕壊鏉冮檺id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetRoleRightOneListById(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<SysRoleRight>> GetRoleRightOneListById(int id)
         {
-            List<SysRoleRight> roleRights = _roleRightServer.GetRoleRightOneListById(id);
-            return Ok(new
-            {
-                data = roleRights,
-                msg = "鎴愬姛",
-                core = 0
-            });
+            return await _roleRightServer.GetRoleRightOneListById(id);
         }
 
         /// <summary>
@@ -563,46 +393,22 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> InsertRoleRight(string MenuNo, int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task InsertRoleRight(string MenuNo, int id)
         {
-            //鎹曡幏寮傚父
-            try
+            //鏍规嵁Id鑾峰彇瑙掕壊鍙�
+            SysRoles roles = await _rolesServer.GetRoleInfoById(id);
+            //淇濆瓨瑙掕壊鏉冮檺淇℃伅
+            await _roleRightServer.InsertRoleRight(MenuNo, roles.RoleNo);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-
-                //鏍规嵁Id鑾峰彇瑙掕壊鍙�
-                SysRoles roles = _rolesServer.GetRoleInfoById(id);
-
-                //淇濆瓨瑙掕壊鏉冮檺淇℃伅
-                int i = await _roleRightServer.InsertRoleRight(MenuNo, 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)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鏂板瑙掕壊鏉冮檺淇℃伅寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "瑙掕壊鏉冮檺",
+                FkNo = roles.RoleNo,
+                TypeName = "缂栬緫",
+                Msg = "鍒嗛厤瑙掕壊鏉冮檺 瑙掕壊鍙凤細" + roles.RoleNo
+            });
         }
 
         #endregion
@@ -616,15 +422,10 @@
         /// <param name="DepartmentNo">閮ㄩ棬鍙�</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDepartmentList(string DepartmentName, string DepartmentNo)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo)
         {
-            List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo);
-            return Ok(new
-            {
-                data = departmentlist,
-                code = 0,
-                msg = "鑾峰彇閮ㄩ棬淇℃伅鍒楄〃鎴愬姛"
-            });
+            return await _department.GetDepartmentList(DepartmentName, DepartmentNo);
         }
 
         /// <summary>
@@ -633,15 +434,10 @@
         /// <param name="id">閮ㄩ棬id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDepartmentById(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SysDepartment> GetDepartmentById(int id)
         {
-            SysDepartment department = _department.GetDepartmentById(id);
-            return Ok(new
-            {
-                data = department,
-                msg = "鎴愬姛",
-                code = 0
-            });
+            return await _department.GetDepartmentById(id);
         }
 
         /// <summary>
@@ -651,56 +447,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddDepartment(DepartmentDto departmentdto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task AddDepartment(DepartmentDto departmentdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _department.AddDepartment(departmentdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                departmentdto.CreateUser = uid;
-
-                int i = await _department.AddDepartment(departmentdto);
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鏂板澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "閮ㄩ棬鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", departmentdto.DepartmentNo, "娣诲姞", "娣诲姞閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鏂板鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鏂板閮ㄩ棬寮傚父", ex);
-            }
-
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = departmentdto.DepartmentNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo
+            });
         }
 
         /// <summary>
@@ -710,46 +469,20 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelDepartment(int Id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task DelDepartment(int Id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysDepartment department = await _department.GetDepartmentById(Id);
+            await _department.DelDepartment(department);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysDepartment department = _department.GetDepartmentById(Id);
-
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                department.UpdateUser = uid;
-                int i = await _department.DelDepartment(department);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "鍒犻櫎澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", department.DepartmentNo, "鍒犻櫎", "鍒犻櫎閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + department.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鍒犻櫎鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎閮ㄩ棬寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = department.DepartmentNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + department.DepartmentNo
+            });
         }
 
         /// <summary>
@@ -759,44 +492,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitDepartment(DepartmentDto departmentdto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task ExitDepartment(DepartmentDto departmentdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _department.ExitDepartment(departmentdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                departmentdto.UpdateUser = uid;
-                int i = await _department.ExitDepartment(departmentdto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "缂栬緫澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "閮ㄩ棬绠$悊", departmentdto.DepartmentNo, "淇敼", "缂栬緫閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "缂栬緫鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("缂栬緫閮ㄩ棬寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "閮ㄩ棬绠$悊",
+                FkNo = departmentdto.DepartmentNo,
+                TypeName = "缂栬緫",
+                Msg = "缂栬緫閮ㄩ棬淇℃伅 閮ㄩ棬鍙凤細" + departmentdto.DepartmentNo
+            });
         }
 
         #endregion
@@ -811,15 +519,10 @@
         /// <param name="GroupNo">缁勫彿</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingList(string FunSetName, string IsEnable, string GroupNo)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo)
         {
-            List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo);
-            return Ok(new
-            {
-                data = settinglist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo);
         }
 
         /// <summary>
@@ -828,15 +531,10 @@
         /// <param name="id">鍔熻兘id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingById(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SysFunSetting> GetFunSettingById(int id)
         {
-            SysFunSetting settinglist = _setting.GetFunSettingById(id);
-            return Ok(new
-            {
-                data = settinglist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _setting.GetFunSettingById(id);
         }
 
         /// <summary>
@@ -845,18 +543,10 @@
         /// <param name="funSetNo">鍔熻兘缂栧彿</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetFunSettingByNo(string funSetNo)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo)
         {
-            try
-            {
-                var models = _setting.GetFunSettingByNo(funSetNo);
-
-                return Ok(new { code = 0, msg = "鍔熻兘璁惧畾淇℃伅", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _setting.GetFunSettingByNo(funSetNo);
         }
         /// <summary>
         /// 鏂板鍔熻兘淇℃伅
@@ -865,80 +555,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddFunSettings(FunSettingDto settingdto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task AddFunSettings(FunSettingDto settingdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _setting.AddFunSettings(settingdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                settingdto.CreateUser = uid;
-                //鏂板
-                int i = await _setting.AddFunSettings(settingdto);
-                //鍒ゆ柇鏄惁鏂板鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else if (i == 3)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 3,
-                        msg = "鍔熻兘鍙峰繀椤诲敮涓�"
-                    });
-                }
-                else if (i == 4)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 4,
-                        msg = "鏄剧ず椤哄簭鑼冨洿涓�1---5"
-                    });
-                }
-                else if (i == 5)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 5,
-                        msg = "璇疯緭鍏ユ纭粍鍙�"
-                    });
-                }
-                else if (i == 6)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 6,
-                        msg = "姣忎竴缁勫彧鑳藉紑鍚竴涓姛鑳�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", settingdto.FunSetNo, "娣诲姞", "娣诲姞鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                return Ok(new { data = "", code = 1, msg = "鏂板鍔熻兘寮傚父锛�" + ex.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = settingdto.FunSetNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo
+            });
         }
 
         /// <summary>
@@ -948,46 +577,20 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelFunSettings(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task DelFunSettings(int id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysFunSetting funSetting = await _setting.GetFunSettingById(id);
+            await _setting.DelFunSettings(funSetting);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysFunSetting funSetting = _setting.GetFunSettingById(id);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                funSetting.UpdateUser = uid;
-                //鍒犻櫎
-                int i = await _setting.DelFunSettings(funSetting);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", funSetting.FunSetNo, "鍒犻櫎", "鍒犻櫎鍔熻兘璁惧畾 鍔熻兘鍙凤細" + funSetting.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎鍔熻兘寮傚父", ex);
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = funSetting.FunSetNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鍔熻兘璁惧畾 鍔熻兘鍙凤細" + funSetting.FunSetNo
+            });
         }
 
         /// <summary>
@@ -997,79 +600,24 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitFunSettings(FunSettingDto settingdto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task ExitFunSettings(FunSettingDto settingdto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _setting.ExitFunSettings(settingdto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存敼浜�
-                settingdto.UpdateUser = uid;
-                //缂栬緫
-                int i = await _setting.ExitFunSettings(settingdto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else if (i == 6)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 6,
-                        msg = "姣忎竴缁勫彧鑳藉紑鍚竴涓姛鑳�"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("绯荤粺璁剧疆", "鍔熻兘璁惧畾", settingdto.FunSetNo, "淇敼", "淇敼鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                return Ok(new { data = "", code = 1, msg = "缂栬緫鍔熻兘寮傚父锛�" + ex.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鍔熻兘璁惧畾",
+                FkNo = settingdto.FunSetNo,
+                TypeName = "缂栬緫",
+                Msg = "淇敼鍔熻兘璁惧畾 鍔熻兘鍙凤細" + settingdto.FunSetNo
+            });
         }
 
         #endregion
 
         #region 鐗╂枡绠$悊
-
-        ///// <summary>
-        ///// 鏌ヨ鐗╂枡淇℃伅
-        ///// </summary>
-        ///// <param name="matevm">鐗╂枡缂栫爜瑙嗗浘妯″瀷</param>
-        ///// <returns></returns>
-        //[HttpPost]
-        //public IActionResult GetMaterialsList(GetMaterialsVm matevm)
-        //{
-        //    try
-        //    {
-        //        var bolls = _mate.GetMaterialsList(matevm.SkuNo, matevm.SkuName, matevm.Type, matevm.IsInspect, matevm.Page, matevm.Limit, out int count);
-
-        //        return Ok(new { code = 0, count, msg = "鐗╂枡淇℃伅", data = bolls });
-        //    }
-        //    catch (Exception e)
-        //    {
-        //        return Ok(new { code = 1, msg = e.Message });
-        //    }
-        //}
-
 
         #region yyk
 
@@ -1088,15 +636,10 @@
         /// <param name="categoryNo">绫诲埆缂栫爜</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo)
         {
-            List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
-            return Ok(new
-            {
-                data = matedto,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
         }
 
         /// <summary>
@@ -1105,15 +648,10 @@
         /// <param name="id">鐗╂枡id</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetMateById(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SysMaterials> GetMateById(int id)
         {
-            SysMaterials mate = _mate.GetMateById(id);
-            return Ok(new
-            {
-                data = mate,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetMateById(id);
         }
 
         /// <summary>
@@ -1121,31 +659,19 @@
         /// </summary>
         /// <param name="matedto">鐗╂枡dto</param>
         /// <returns></returns>
-        /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> AddMate(MaterialsDto matedto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task AddMate(MaterialsDto matedto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _mate.AddMate(matedto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鍒涘缓浜�
-                matedto.CreateUser = uid;
-                //鏂板
-                int i = await _mate.AddMate(matedto);
-
-                await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", matedto.SkuNo, "娣诲姞", "娣诲姞鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo, uid);
-                return Ok(new { data = i, code = 0, msg = "鎴愬姛" });
-
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父 
-                return Ok(new { code = 1, msg = "鏂板鐗╂枡寮傚父" + ex.Message });
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = matedto.SkuNo,
+                TypeName = "娣诲姞",
+                Msg = "娣诲姞鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo
+            });
         }
 
         /// <summary>
@@ -1155,45 +681,19 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpGet]
-        public async Task<IActionResult> DelMate(int id)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task DelMate(int id)
         {
-            //鎹曡幏寮傚父
-            try
+            SysMaterials mate = await _mate.GetMateById(id);
+            await _mate.DelMate(mate);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                SysMaterials mate = _mate.GetMateById(id);
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                mate.UpdateUser = uid;
-                //鍒犻櫎
-                int i = await _mate.DelMate(mate);
-                //鍒ゆ柇鏄惁鍒犻櫎鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 1,
-                        msg = "澶辫触"
-                    });
-                }
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", mate.SkuNo, "鍒犻櫎", "鍒犻櫎鐗╂枡淇℃伅 鐗╂枡鍙凤細" + mate.SkuNo, uid);
-                    return Ok(new
-                    {
-                        data = i,
-                        code = 0,
-                        msg = "鎴愬姛"
-                    });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮傚父
-                throw new Exception("鍒犻櫎鐗╂枡寮傚父", ex);
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = mate.SkuNo,
+                TypeName = "鍒犻櫎",
+                Msg = "鍒犻櫎鐗╂枡淇℃伅 鐗╂枡鍙凤細" + mate.SkuNo
+            });
         }
 
         /// <summary>
@@ -1203,43 +703,18 @@
         /// <returns></returns>
         /// <exception cref="Exception">鎹曡幏寮傚父</exception>
         [HttpPost]
-        public async Task<IActionResult> ExitMate(MaterialsDto matedto)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task ExitMate(MaterialsDto matedto)
         {
-            //鎹曡幏寮傚父
-            try
+            await _mate.ExitMate(matedto);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                //鑾峰彇褰撳墠鎿嶄綔鐢ㄦ埛id
-                var claimsIdentity = this.User.Identity as ClaimsIdentity;
-                var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
-                int uid = Convert.ToInt32(userId);
-                //鏇存柊浜�
-                matedto.UpdateUser = uid;
-                //缂栬緫
-                int i = await _mate.ExitMate(matedto);
-                //鍒ゆ柇鏄惁缂栬緫鎴愬姛
-                if (i == 0)
-                {
-                    return Ok(new { data = i, code = 1, msg = "淇敼澶辫触" });
-                }
-                else if (i == 2)
-                {
-                    return Ok(new { data = i, code = 2, msg = "涓存湡澶╂暟涓嶅彲澶т簬365鍙婂皬浜�30" });
-                }
-                //else if (i == 4)
-                //{
-                //    return Ok(new { data = i, code = 4, msg = "浣庡簱瀛樹笉鍙珮浜�1000" });
-                //}
-                else
-                {
-                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂枡绠$悊", matedto.SkuNo, "淇敼", "缂栬緫鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo, uid);
-                    return Ok(new { data = i, code = 0, msg = "淇敼鎴愬姛" });
-                }
-            }
-            catch (Exception ex)
-            {
-                //鎶涘嚭寮�
-                return Ok(new { code = 1, msg = "缂栬緫鐗╂枡寮傚父" + ex.Message });
-            }
+                ParentName = "鍩虹淇℃伅",
+                MenuName = "鐗╂枡绠$悊",
+                FkNo = matedto.SkuNo,
+                TypeName = "缂栬緫",
+                Msg = "缂栬緫鐗╂枡淇℃伅 鐗╂枡鍙凤細" + matedto.SkuNo
+            });
         }
 
         #region 鍖呰 鍗曚綅
@@ -1249,15 +724,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetUnitList()
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<SysUnit>> GetUnitList()
         {
-            List<SysUnit> unitlist = _mate.GetUnitList();
-            return Ok(new
-            {
-                data = unitlist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetUnitList();
         }
 
         /// <summary>
@@ -1265,15 +735,10 @@
         /// </summary>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetPackagList()
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<SysPackag>> GetPackagList()
         {
-            List<SysPackag> packlist = _mate.GetPackagList();
-            return Ok(new
-            {
-                data = packlist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _mate.GetPackagList();
         }
 
         #endregion
@@ -2287,22 +1752,12 @@
         /// <summary>
         /// 鑾峰彇鎿嶄綔鏃ュ織淇℃伅鍒楄〃
         /// </summary>
-        /// <param name="menuName">鑿滃崟鍚嶇О</param>
-        /// <param name="type">鎿嶄綔绫诲瀷</param>
-        /// <param name="msg">鎿嶄綔鍐呭</param>
-        /// <param name="menuNo">鑿滃崟鍙�</param>
-        /// <param name="parentNo">妯″潡鍙�</param>
         /// <returns></returns>
-        [HttpGet]
-        public IActionResult GetSysOperationList(string menuName, string type, string msg, string menuNo, string parentNo)
+        [HttpPost]
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SqlSugarPagedList<OperationDto>> GetSysOperationList(GetOperationVm model)
         {
-            List<OperationDto> operation = _operation.GetSysOperationList(menuName, type, msg, menuNo, parentNo);
-            return Ok(new
-            {
-                data = operation,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _operation.GetSysOperationList(model);
         }
 
         /// <summary>
@@ -2311,15 +1766,10 @@
         /// <param name="dicName">瀛楀吀鍚嶇О</param>
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetDicTypeList(string dicName)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<List<SysDictionary>> GetDicTypeList(string dicName)
         {
-            List<SysDictionary> diclist = _operation.GetDicTypeList(dicName);
-            return Ok(new
-            {
-                data = diclist,
-                code = 0,
-                msg = "鎴愬姛"
-            });
+            return await _operation.GetDicTypeList(dicName);
         }
 
         #endregion

--
Gitblit v1.8.0