From 2dd922eb3ab68c0314f5828fcae1ed7db0e17d9e Mon Sep 17 00:00:00 2001
From: hwh <332078369@qq.com>
Date: 星期四, 04 七月 2024 08:06:26 +0800
Subject: [PATCH] 客户、物流、单位

---
 Wms/Wms/Controllers/BasisController.cs |  892 +++++++++++++++--------------------------------------------
 1 files changed, 229 insertions(+), 663 deletions(-)

diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index fb0997a..1c2411a 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -422,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>
@@ -439,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>
@@ -457,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>
@@ -516,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>
@@ -565,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
@@ -617,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>
@@ -634,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>
@@ -651,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>
         /// 鏂板鍔熻兘淇℃伅
@@ -671,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>
@@ -754,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>
@@ -803,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
 
@@ -894,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>
@@ -911,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>
@@ -927,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>
@@ -961,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>
@@ -1009,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 鍖呰 鍗曚綅
@@ -1055,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>
@@ -1071,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
@@ -1267,11 +926,12 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetCustomerList(GetCustomerVm model)
+        public async Task<IActionResult> GetCustomerList(GetCustomerVm model)
         {
             try
             {
-                var bolls = _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, out int count);
+                RefAsync<int> count = new RefAsync<int>();
+                var bolls = await _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, count);
 
                 return Ok(new { code = 0, count, msg = "瀹㈡埛淇℃伅", data = bolls });
             }
@@ -1286,11 +946,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetCustomer(IdVm model)
+        public async Task<IActionResult> GetCustomer(IdVm model)
         {
             try
             {
-                var bolls = _customerSvc.GetCustomer(model.Id);
+                var bolls = await _customerSvc.GetCustomer(model.Id);
 
                 return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
             }
@@ -1304,11 +964,11 @@
         /// </summary> 
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetCustomerSelect()
+        public async Task<IActionResult> GetCustomerSelect()
         {
             try
             {
-                var bolls = _customerSvc.GetCustomerSelect();
+                var bolls = await _customerSvc.GetCustomerSelect();
 
                 return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
             }
@@ -1323,7 +983,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddCustomer(AddCustomerVm model)
+        public async Task<IActionResult> AddCustomer(AddCustomerVm model)
         {
             try
             {
@@ -1339,11 +999,11 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
+                var bolls = await _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
 
                 if (bolls)
                 {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
                 }
                 else
@@ -1362,7 +1022,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditCustomer(EditCustomerVm model)
+        public async Task<IActionResult> EditCustomer(EditCustomerVm model)
         {
             try
             {
@@ -1378,11 +1038,11 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
+                var bolls = await _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId));
 
                 if (bolls)
                 {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
                 }
                 else
@@ -1401,11 +1061,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelCustomer(IdVm model)
+        public async Task<IActionResult> DelCustomer(IdVm model)
         {
             try
             {
-                SysCustomer customer = _customerSvc.GetCustomer(model.Id);
+                SysCustomer customer = await _customerSvc.GetCustomer(model.Id);
                 //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
                 var claimsIdentity = this.User.Identity as ClaimsIdentity;
                 if (claimsIdentity == null)
@@ -1418,10 +1078,10 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _customerSvc.DelCustomer(model.Id, int.Parse(userId));
+                var bolls = await _customerSvc.DelCustomer(model.Id, int.Parse(userId));
                 if (bolls)
                 {
-                    _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
                 }
                 else
@@ -1440,7 +1100,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsCustomer(IdVm model)
+        public async Task<IActionResult> DelsCustomer(IdVm model)
         {
             try
             {
@@ -1456,7 +1116,7 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
+                var bolls = await _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
                 if (bolls)
                 {
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1480,11 +1140,12 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetLogisticsInfoList(GetLogisticsInfoVm model)
+        public async Task<IActionResult> GetLogisticsInfoList(GetLogisticsInfoVm model)
         {
             try
             {
-                var bolls = _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, out int count);
+                RefAsync<int> count = new RefAsync<int>();
+                var bolls = await _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, count);
 
                 return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = bolls });
             }
@@ -1499,11 +1160,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetLogisticsInfo(IdVm model)
+        public async Task<IActionResult> GetLogisticsInfo(IdVm model)
         {
             try
             {
-                var bolls = _logisticsSvc.GetLogisticsInfo(model.Id);
+                var bolls = await _logisticsSvc.GetLogisticsInfo(model.Id);
 
                 return Ok(new { code = 0, data = bolls });
             }
@@ -1517,11 +1178,11 @@
         /// </summary> 
         /// <returns></returns>
         [HttpGet]
-        public IActionResult GetLogisticsInfoSelect()
+        public async Task<IActionResult> GetLogisticsInfoSelect()
         {
             try
             {
-                var bolls = _logisticsSvc.GetLogisticsInfoSelect();
+                var bolls = await _logisticsSvc.GetLogisticsInfoSelect();
 
                 return Ok(new { code = 0, data = bolls });
             }
@@ -1537,7 +1198,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model)
+        public async Task<IActionResult> AddLogisticsInfo(AddLogisticsInfoVm model)
         {
             try
             {
@@ -1553,11 +1214,11 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
+                var bolls = await _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
 
                 if (bolls)
                 {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
                 }
                 else
@@ -1576,7 +1237,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model)
+        public async Task<IActionResult> EditLogisticsInfo(EditLogisticsInfoVm model)
         {
             try
             {
@@ -1592,11 +1253,11 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
+                var bolls = await _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
 
                 if (bolls)
                 {
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
                 }
                 else
@@ -1615,11 +1276,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelLogisticsInfo(IdVm model)
+        public async Task<IActionResult> DelLogisticsInfo(IdVm model)
         {
             try
             {
-                SysLogisticsInfo logisit = _logisticsSvc.GetLogisticsInfo(model.Id);
+                SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsInfo(model.Id);
                 //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D
                 var claimsIdentity = this.User.Identity as ClaimsIdentity;
                 if (claimsIdentity == null)
@@ -1632,11 +1293,11 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
+                var bolls = await _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
                 if (bolls)
                 {
 
-                    _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
+                    await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
                 }
                 else
@@ -1655,7 +1316,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsLogisticsInfo(IdVm model)
+        public async Task<IActionResult> DelsLogisticsInfo(IdVm model)
         {
             try
             {
@@ -1671,7 +1332,7 @@
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
 
-                var bolls = _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
+                var bolls = await _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
                 if (bolls)
                 {
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1696,11 +1357,12 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetUnitList(GetUnitVm model)
+        public async Task<IActionResult> GetUnitList(GetUnitVm model)
         {
             try
             {
-                var list = _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, out int count);
+                RefAsync<int> count = new RefAsync<int>();
+                var list = await _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, count);
 
                 return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
             }
@@ -1715,11 +1377,11 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetUnit(IdVm model)
+        public async Task<IActionResult> GetUnit(IdVm model)
         {
             try
             {
-                var data = _unitSvc.GetUnit(model.Id);
+                var data = await _unitSvc.GetUnit(model.Id);
                 if (data != null)
                 {
                     return Ok(new { code = 0, data });
@@ -1740,7 +1402,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddUnit(AddEditUnitVm model)
+        public async Task<IActionResult> AddUnit(AddEditUnitVm model)
         {
             if (ModelState.IsValid)
             {
@@ -1758,7 +1420,7 @@
                         return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                     }
 
-                    var bolls = _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
+                    var bolls = await _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
 
                     if (bolls)
                     {
@@ -1786,7 +1448,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditUnit(AddEditUnitVm model)
+        public async Task<IActionResult> EditUnit(AddEditUnitVm model)
         {
             if (ModelState.IsValid)
             {
@@ -1804,12 +1466,12 @@
                         return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                     }
 
-                    var bolls = _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId));
+                    var bolls = await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId));
 
                     if (bolls)
                     {
-                        SysUnit unit = _unitSvc.GetUnit(model.Id);
-                        _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, Convert.ToInt32(userId));
+                        SysUnit unit = await _unitSvc.GetUnit(model.Id);
+                        await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, Convert.ToInt32(userId));
                         return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
                     }
                     else
@@ -1834,7 +1496,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelUnit(IdVm model)
+        public async Task<IActionResult> DelUnit(IdVm model)
         {
             try
             {
@@ -1849,7 +1511,7 @@
                 {
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
-                var bolls = _unitSvc.DelUnit(model.Id, int.Parse(userId));
+                var bolls = await _unitSvc.DelUnit(model.Id, int.Parse(userId));
                 if (bolls)
                 {
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -1870,7 +1532,7 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelsUnit(IdVm model)
+        public async Task<IActionResult> DelsUnit(IdVm model)
         {
             try
             {
@@ -1885,7 +1547,7 @@
                 {
                     return Ok(new { code = 1, msg = "涓鸿幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
                 }
-                var bolls = _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
+                var bolls = await _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
                 if (bolls)
                 {
                     return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
@@ -2122,18 +1784,10 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetInterfaceList(InterfaceVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model)
         {
-            try
-            {
-                var models = _interface.GetInterfaceList(model, out int count);
-
-                return Ok(new { code = 0, count, msg = "鎺ュ彛鍒楄〃", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _interface.GetInterfaceList(model);
         }
 
         /// <summary>
@@ -2142,18 +1796,10 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult GetInterfaceDetailList(InterfaceDetailVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        public async Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model)
         {
-            try
-            {
-                var models = _interface.GetInterfaceDetailList(model, out int count);
-
-                return Ok(new { code = 0, count, msg = "鎺ュ彛鏄庣粏鍒楄〃", data = models });
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+            return await _interface.GetInterfaceDetailList(model);
         }
 
         /// <summary>
@@ -2162,41 +1808,19 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult AddInterface(InterfaceVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task AddInterface(InterfaceVm model)
         {
-            try
+            await _interface.AddInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.AddInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
-                }
-                if (strMesage.Contains("-1"))
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-                else
-                {
-                    return Ok(new { code = 0, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "娣诲姞",
+                Msg = $"娣诲姞浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2205,41 +1829,19 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult EditInterface(InterfaceVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task EditInterface(InterfaceVm model)
         {
-            try
+            await _interface.EditInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.EditInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
-                }
-                if (strMesage.Contains("-1"))
-                {
-                    return Ok(new { code = 0, msg = "閮ㄥ垎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"缂栬緫浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2248,37 +1850,19 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelInterface(InterfaceVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task DelInterface(InterfaceVm model)
         {
-            try
+            await _interface.DelInterface(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.DelInterface(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"鍒犻櫎浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭�"
+            });
         }
 
         /// <summary>
@@ -2287,37 +1871,19 @@
         /// <param name="model"></param>
         /// <returns></returns>
         [HttpPost]
-        public IActionResult DelInterfaceDetail(InterfaceDetailVm model)
+        [ServiceFilter(typeof(ApiResponseActionFilter))]
+        [UnitOfWork]
+        public async Task DelInterfaceDetail(InterfaceDetailVm model)
         {
-            try
+            await _interface.DelInterfaceDetail(model);
+            await _operation.InsertOperation(new OperationInputVm()
             {
-                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("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
-                }
-
-                model.CreateUser = int.Parse(UserId);
-                string strMesage = _interface.DelInterfaceDetail(model);
-
-                if (strMesage == "")
-                {
-                    return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
-                }
-                else
-                {
-                    return Ok(new { code = 1, msg = strMesage });
-                }
-            }
-            catch (Exception e)
-            {
-                return Ok(new { code = 1, msg = e.Message });
-            }
+                ParentName = "绯荤粺璁剧疆",
+                MenuName = "鎺ュ彛绠$悊",
+                FkNo = model.InterfaceNo,
+                TypeName = "缂栬緫",
+                Msg = $"鍒犻櫎浜嗘帴鍙g紪鍙蜂负{model.InterfaceNo}鐨勬帴鍙d俊鎭紝鏈郴缁熷瓧娈典负{model.Field}鐨勬帴鍙d俊鎭�"
+            });
         }
         #endregion
     }

--
Gitblit v1.8.0