From 638b471ad73bce1c701d9f9c8d02effe6a38c7ca Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期一, 22 七月 2024 16:57:20 +0800
Subject: [PATCH] 修改托盘绑定方法
---
Wms/Wms/Controllers/BasisController.cs | 929 +++++++++------------------------------------------------
1 files changed, 147 insertions(+), 782 deletions(-)
diff --git a/Wms/Wms/Controllers/BasisController.cs b/Wms/Wms/Controllers/BasisController.cs
index 90ab56b..de100a9 100644
--- a/Wms/Wms/Controllers/BasisController.cs
+++ b/Wms/Wms/Controllers/BasisController.cs
@@ -22,12 +22,14 @@
using Model.ModelDto.LogDto;
using Utility;
using Model.ModelVm.LogVm;
+using System.Diagnostics;
namespace Wms.Controllers
{
[Route("api/[controller]/[action]")]
[ApiController]
[Authorize]
+ [ServiceFilter(typeof(ApiResponseActionFilter))]
public class BasisController : ControllerBase
{
/// <summary>
@@ -61,7 +63,10 @@
/// <param name="department">閮ㄩ棬</param>
/// <param name="setting">鍔熻兘璁惧畾</param>
/// <param name="operation">鎿嶄綔鏃ュ織</param>
- public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer, IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc, IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting, IInterfaceServer interfaceS, IOperationSysServer operation, UserManager userManager)
+ public BasisController(ICustomerServer customerSvc, ILogisticsInfoServer logisticsSvc, IUserInforServer userInforServer,
+ IRolesServer rolesServer, IRoleRightServer roleRightServer, IRBACServer rBACServer, IUnitServer unitSvc,
+ IPackagServer packagServer, IMaterialsServer mate, IDepartmentServer department, IFunSettingServer setting,
+ IInterfaceServer interfaceS, IOperationSysServer operation, UserManager userManager)
{
_customerSvc = customerSvc;//瀹㈡埛Svc
_logisticsSvc = logisticsSvc;//鐗╂祦Svc
@@ -93,7 +98,6 @@
/// <param name="Status">鐘舵��</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<UserInfoDto>> GetUserRoleList(string UserName, string DepartmentNo, string RoleNo, string Status)
{
return await _userInforServer.GetUserRoleList(UserName, DepartmentNo, RoleNo, Status);
@@ -105,7 +109,6 @@
/// <param name="id">鐢ㄦ埛id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysUserInfor> GetUserinfoListById(int id)
{
return await _userInforServer.GetUserInfoById(id);
@@ -119,7 +122,6 @@
/// <returns></returns>
/// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task InsertUserinfo(UserInfoDto UserInfoDto)
{
@@ -142,7 +144,6 @@
/// <returns></returns>
/// <exception cref="System.Exception">寮傚父</exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task DeleteUserInfo(int userids)
{
@@ -167,7 +168,6 @@
/// <returns></returns>
/// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task UpdateUserinfo(UserInfoDto userdto)
{
@@ -197,7 +197,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task UptUserPassWord(string pwdOld, string pwdNew, string pwdNewTwo/*, int userId*/)
{
pwdOld = Md5Tools.CalcMd5(pwdOld);
@@ -219,7 +218,6 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<int> IsPassWordTime()
{
return await _userInforServer.IsPassWordTime(_userManager.UserId);
@@ -237,7 +235,6 @@
/// <param name="RoleName">瑙掕壊鍚嶇О</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<RoleDto>> GetRolesList(string RoleNo, string RoleName)
{
return await _rolesServer.GetRoleList(RoleNo, RoleName);
@@ -249,7 +246,6 @@
/// <param name="roleid">瑙掕壊id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysRoles> GetRolesListById(int roleid)
{
return await _rolesServer.GetRoleInfoById(roleid);
@@ -262,7 +258,6 @@
/// <returns></returns>
/// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task InsertRoleInfo(RoleDto roledto)
{
@@ -284,7 +279,6 @@
/// <returns></returns>
/// <exception cref="System.Exception"></exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task DeleteRoleInfo(int roleids)
{
@@ -308,7 +302,6 @@
/// <returns></returns>
/// <exception cref="System.Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task UpdateRolesInfo(SysRoles role)
{
@@ -344,10 +337,9 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<FunctionMenuDto>> GetRoleRightRBAC(int id, string MenuNo)
{
- return await _rBACServer.GetRoleRightRBAC(MenuNo, UserId);
+ return await _rBACServer.GetRoleRightRBAC(MenuNo, _userManager.UserId.ToString());
}
/// <summary>
@@ -355,7 +347,6 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<RoleRightDto>> GetRoleRightLists(int id)
{
return await _rBACServer.GetRoleRightList(id);
@@ -367,10 +358,15 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<RoleRightDto>> GetRoleRightList()
{
- return await _roleRightServer.GetRoleMenuList();
+ Stopwatch stopwatch = new Stopwatch();
+ stopwatch.Start();
+ var model = await _roleRightServer.GetRoleMenuList();
+ stopwatch.Stop();
+
+ var time = stopwatch.ElapsedMilliseconds;
+ return model;
}
/// <summary>
@@ -379,7 +375,6 @@
/// <param name="id">瑙掕壊鏉冮檺id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<SysRoleRight>> GetRoleRightOneListById(int id)
{
return await _roleRightServer.GetRoleRightOneListById(id);
@@ -393,7 +388,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task InsertRoleRight(string MenuNo, int id)
{
@@ -422,7 +416,6 @@
/// <param name="DepartmentNo">閮ㄩ棬鍙�</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo)
{
return await _department.GetDepartmentList(DepartmentName, DepartmentNo);
@@ -434,7 +427,6 @@
/// <param name="id">閮ㄩ棬id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysDepartment> GetDepartmentById(int id)
{
return await _department.GetDepartmentById(id);
@@ -447,7 +439,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task AddDepartment(DepartmentDto departmentdto)
{
@@ -469,7 +460,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task DelDepartment(int Id)
{
@@ -492,7 +482,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task ExitDepartment(DepartmentDto departmentdto)
{
@@ -519,7 +508,6 @@
/// <param name="GroupNo">缁勫彿</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo)
{
return await _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo);
@@ -531,7 +519,6 @@
/// <param name="id">鍔熻兘id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysFunSetting> GetFunSettingById(int id)
{
return await _setting.GetFunSettingById(id);
@@ -543,7 +530,6 @@
/// <param name="funSetNo">鍔熻兘缂栧彿</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo)
{
return await _setting.GetFunSettingByNo(funSetNo);
@@ -555,7 +541,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task AddFunSettings(FunSettingDto settingdto)
{
@@ -577,7 +562,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task DelFunSettings(int id)
{
@@ -600,7 +584,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
[UnitOfWork]
public async Task ExitFunSettings(FunSettingDto settingdto)
{
@@ -636,7 +619,6 @@
/// <param name="categoryNo">绫诲埆缂栫爜</param>
/// <returns></returns>
[HttpGet]
- [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)
{
return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo);
@@ -648,7 +630,6 @@
/// <param name="id">鐗╂枡id</param>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<SysMaterials> GetMateById(int id)
{
return await _mate.GetMateById(id);
@@ -660,7 +641,6 @@
/// <param name="matedto">鐗╂枡dto</param>
/// <returns></returns>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task AddMate(MaterialsDto matedto)
{
await _mate.AddMate(matedto);
@@ -681,7 +661,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task DelMate(int id)
{
SysMaterials mate = await _mate.GetMateById(id);
@@ -703,7 +682,6 @@
/// <returns></returns>
/// <exception cref="Exception">鎹曡幏寮傚父</exception>
[HttpPost]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task ExitMate(MaterialsDto matedto)
{
await _mate.ExitMate(matedto);
@@ -724,7 +702,6 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<SysUnit>> GetUnitList()
{
return await _mate.GetUnitList();
@@ -735,7 +712,6 @@
/// </summary>
/// <returns></returns>
[HttpGet]
- [ServiceFilter(typeof(ApiResponseActionFilter))]
public async Task<List<SysPackag>> GetPackagList()
{
return await _mate.GetPackagList();
@@ -926,18 +902,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetCustomerList(GetCustomerVm model)
+ public async Task<SqlSugarPagedList> 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);
-
- return Ok(new { code = 0, count, msg = "瀹㈡埛淇℃伅", data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ 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 new SqlSugarPagedList() { Items = bolls, Total = count };
}
/// <summary>
/// 鏌ヨ鍗曟潯瀹㈡埛淇℃伅
@@ -945,36 +914,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetCustomer(IdVm model)
+ public async Task<SysCustomer> GetCustomer(IdVm model)
{
- try
- {
- var bolls = _customerSvc.GetCustomer(model.Id);
-
- return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ return await _customerSvc.GetCustomer(model.Id);
}
/// <summary>
/// 鏌ヨ鍏ㄩ儴瀹㈡埛淇℃伅
/// </summary>
/// <returns></returns>
[HttpGet]
- public IActionResult GetCustomerSelect()
+ public async Task<List<SysCustomer>> GetCustomerSelect()
{
- try
- {
- var bolls = _customerSvc.GetCustomerSelect();
-
- return Ok(new { code = 0, count = 0, msg = "瀹㈡埛淇℃伅", data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ return await _customerSvc.GetCustomerSelect();
}
/// <summary>
/// 娣诲姞瀹㈡埛淇℃伅
@@ -982,38 +933,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddCustomer(AddCustomerVm model)
+ [UnitOfWork]
+ public async Task AddCustomer(AddCustomerVm model)
{
- 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 bolls = _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));
- return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "娣诲姞", "娣诲姞瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, _userManager.UserId);
}
/// <summary>
/// 缂栬緫瀹㈡埛淇℃伅
@@ -1021,38 +945,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditCustomer(EditCustomerVm model)
+ [UnitOfWork]
+ public async Task EditCustomer(EditCustomerVm model)
{
- 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 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));
-
- if (bolls)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, Convert.ToInt32(userId));
- return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", model.CustomerNo, "缂栬緫", "缂栬緫瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + model.CustomerNo, _userManager.UserId);
}
/// <summary>
/// 鍒犻櫎瀹㈡埛淇℃伅
@@ -1060,38 +957,12 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelCustomer(IdVm model)
+ [UnitOfWork]
+ public async Task DelCustomer(IdVm model)
{
- try
- {
- SysCustomer customer = _customerSvc.GetCustomer(model.Id);
- //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩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 bolls = _customerSvc.DelCustomer(model.Id, int.Parse(userId));
- if (bolls)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, Convert.ToInt32(userId));
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ SysCustomer customer = await _customerSvc.GetCustomer(model.Id);
+ var bolls = await _customerSvc.DelCustomer(model.Id, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "瀹㈡埛绠$悊", customer.CustomerNo, "鍒犻櫎", "鍒犻櫎瀹㈡埛淇℃伅 瀹㈡埛鍙凤細" + customer.CustomerNo, _userManager.UserId);
}
/// <summary>
/// 鍒犻櫎瀹㈡埛淇℃伅(澶氬垹闄�)
@@ -1099,36 +970,10 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsCustomer(IdVm model)
+ [UnitOfWork]
+ public async Task DelsCustomer(IdVm model)
{
- 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 bolls = _customerSvc.DelsCustomer(model.Ids, int.Parse(userId));
- if (bolls)
- {
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _customerSvc.DelsCustomer(model.Ids, _userManager.UserId);
}
#endregion
@@ -1139,18 +984,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetLogisticsInfoList(GetLogisticsInfoVm model)
+ public async Task<SqlSugarPagedList> 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);
-
- return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ RefAsync<int> count = new RefAsync<int>();
+ var list = await _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, count);
+ return new SqlSugarPagedList() { Items = list, Total = count };
}
/// <summary>
/// 鏌ヨ鍗曟潯鐗╂祦淇℃伅
@@ -1158,36 +996,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetLogisticsInfo(IdVm model)
+ public async Task<SysLogisticsInfo> GetLogisticsInfo(IdVm model)
{
- try
- {
- var bolls = _logisticsSvc.GetLogisticsInfo(model.Id);
-
- return Ok(new { code = 0, data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ return await _logisticsSvc.GetLogisticsInfo(model.Id);
}
/// <summary>
/// 鏌ヨ鍏ㄩ儴鐗╂祦淇℃伅
/// </summary>
/// <returns></returns>
[HttpGet]
- public IActionResult GetLogisticsInfoSelect()
+ public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect()
{
- try
- {
- var bolls = _logisticsSvc.GetLogisticsInfoSelect();
-
- return Ok(new { code = 0, data = bolls });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ return await _logisticsSvc.GetLogisticsInfoSelect();
}
/// <summary>
@@ -1196,38 +1016,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model)
+ [UnitOfWork]
+ public async Task AddLogisticsInfo(AddLogisticsInfoVm model)
{
- 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 bolls = _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId));
-
- if (bolls)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
- return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _logisticsSvc.AddLogisticsInfo(model, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "娣诲姞", "娣诲姞鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, _userManager.UserId);
}
/// <summary>
/// 缂栬緫鐗╂祦淇℃伅
@@ -1235,38 +1028,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model)
+ [UnitOfWork]
+ public async Task EditLogisticsInfo(EditLogisticsInfoVm model)
{
- 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 bolls = _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId));
-
- if (bolls)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, Convert.ToInt32(userId));
- return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _logisticsSvc.EditLogisticsInfo(model, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", model.CarrierName, "缂栬緫", "缂栬緫鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + model.CarrierName, _userManager.UserId);
}
/// <summary>
/// 鍒犻櫎鐗╂祦淇℃伅
@@ -1274,39 +1040,12 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelLogisticsInfo(IdVm model)
+ [UnitOfWork]
+ public async Task DelLogisticsInfo(IdVm model)
{
- try
- {
- SysLogisticsInfo logisit = _logisticsSvc.GetLogisticsInfo(model.Id);
- //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩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 bolls = _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId));
- if (bolls)
- {
-
- _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, Convert.ToInt32(userId));
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _logisticsSvc.DelLogisticsInfo(model.Id, _userManager.UserId);
+ SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsInfo(model.Id);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鐗╂祦绠$悊", logisit.CarrierName, "鍒犻櫎", "鍒犻櫎鐗╂祦淇℃伅 鍏徃鍚嶇О锛�" + logisit.CarrierName, _userManager.UserId);
}
/// <summary>
/// 鍒犻櫎鐗╂祦淇℃伅(澶氭潯淇℃伅)
@@ -1314,36 +1053,10 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsLogisticsInfo(IdVm model)
+ [UnitOfWork]
+ public async Task DelsLogisticsInfo(IdVm model)
{
- 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 bolls = _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId));
- if (bolls)
- {
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _logisticsSvc.DelsLogisticsInfo(model.Ids, _userManager.UserId);
}
#endregion
@@ -1355,18 +1068,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetUnitList(GetUnitVm model)
+ public async Task<SqlSugarPagedList> GetUnitList(GetUnitVm model)
{
- try
- {
- var list = _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, out int count);
-
- return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ RefAsync<int> count = new RefAsync<int>();
+ var list = await _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, count);
+ return new SqlSugarPagedList() { Items = list, Total = count };
}
/// <summary>
/// 鏌ヨ鍗曟潯鍗曚綅淇℃伅
@@ -1374,24 +1080,9 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetUnit(IdVm model)
+ public async Task<SysUnit> GetUnit(IdVm model)
{
- try
- {
- var data = _unitSvc.GetUnit(model.Id);
- if (data != null)
- {
- return Ok(new { code = 0, data });
- }
- else
- {
- return Ok(new { code = 1, data = "鏈煡璇㈠埌鐗╂祦淇℃伅" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ return await _unitSvc.GetUnit(model.Id);
}
/// <summary>
/// 娣诲姞璁¢噺淇℃伅
@@ -1399,43 +1090,16 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddUnit(AddEditUnitVm model)
+ [UnitOfWork]
+ public async Task AddUnit(AddEditUnitVm model)
{
if (ModelState.IsValid)
{
- 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 bolls = _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId));
-
- if (bolls)
- {
- return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _unitSvc.AddUnit(model.UnitName, model.Abbrev, _userManager.UserId);
}
else
{
- return Ok(new { code = 1, msg = "鏁版嵁鏍煎紡閿欒" });
+ throw Oops.Bah("鏁版嵁鏍煎紡閿欒");
}
}
@@ -1445,45 +1109,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditUnit(AddEditUnitVm model)
+ [UnitOfWork]
+ public async Task EditUnit(AddEditUnitVm model)
{
if (ModelState.IsValid)
{
- 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 bolls = _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));
- return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, _userManager.UserId);
+ SysUnit unit = await _unitSvc.GetUnit(model.Id);
+ await _operation.InsertOperation("鍩虹淇℃伅", "璁¢噺鍗曚綅", unit.UnitNo, "缂栬緫", "缂栬緫璁¢噺鍗曚綅 鍗曚綅鍚嶇О锛�" + unit.UnitNo, _userManager.UserId);
}
else
{
- return Ok(new { code = 1, msg = "鏁版嵁鏍煎紡閿欒" });
+ throw Oops.Bah("鏁版嵁鏍煎紡閿欒");
}
}
@@ -1493,35 +1130,10 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelUnit(IdVm model)
+ [UnitOfWork]
+ public async Task DelUnit(IdVm model)
{
- 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 bolls = _unitSvc.DelUnit(model.Id, int.Parse(userId));
- if (bolls)
- {
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _unitSvc.DelUnit(model.Id, _userManager.UserId);
}
/// <summary>
/// 鍒犻櫎璁¢噺鍗曚綅淇℃伅锛堝鍒犻櫎锛�
@@ -1529,53 +1141,14 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelsUnit(IdVm model)
+ [UnitOfWork]
+ public async Task DelsUnit(IdVm model)
{
- 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 bolls = _unitSvc.DelsUnit(model.Ids, int.Parse(userId));
- if (bolls)
- {
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ var bolls = await _unitSvc.DelsUnit(model.Ids, _userManager.UserId);
}
#endregion
#region 鍖呰绠$悊
- private string UserId;
- //public BasisController()
- //{
- // var claimsIdentity = this.User.Identity as ClaimsIdentity;
- // if (claimsIdentity == null)
- // {
- // throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- // }
- // UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
- // if (string.IsNullOrWhiteSpace(UserId))
- // {
- // throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- // }
- //}
/// <summary>
/// 鏌ヨ鍖呰淇℃伅
@@ -1583,18 +1156,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetPackagList(GetPackagVm model)
+ public async Task<SqlSugarPagedList> GetPackagList(GetPackagVm model)
{
- try
- {
- var list = _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, out int count);
-
- return Ok(new { code = 0, count, msg = "鐗╂祦淇℃伅", data = list });
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ RefAsync<int> count = new RefAsync<int>();
+ var list = await _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, count);
+ return new SqlSugarPagedList { Items = list, Total = count };
}
/// <summary>
@@ -1603,15 +1169,9 @@
/// <param name="id">鍖呰id</param>
/// <returns></returns>
[HttpGet]
- public IActionResult GetPackagById(int id)
+ public async Task<SysPackag> GetPackagById(int id)
{
- SysPackag packag = _packagSvc.GetPackagById(id);
- return Ok(new
- {
- data = packag,
- code = 0,
- msg = "鎴愬姛"
- });
+ return await _packagSvc.GetPackagById(id);
}
/// <summary>
@@ -1620,47 +1180,11 @@
/// <param name="model">鍖呰淇℃伅</param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddPackag(AddEditPackagVm model)
+ [UnitOfWork]
+ public async Task AddPackag(AddEditPackagVm model)
{
- try
- {
- var claimsIdentity = this.User.Identity as ClaimsIdentity;
- if (claimsIdentity == null)
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
- UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
- if (string.IsNullOrWhiteSpace(UserId))
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
-
- model.CreateUser = int.Parse(UserId);
- int i = _packagSvc.AddPackag(model);
-
- if (i == 1)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "娣诲姞", "娣诲姞鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
- return Ok(new { code = 0, msg = "娣诲姞鎴愬姛" });
- }
- else if (i > 1)
- {
- return Ok(new { code = i, msg = "鍖呰绛夌骇涓嶅彲瓒婄骇娣诲姞" });
- }
- else
- {
- return Ok(new { code = 1, msg = "娣诲姞澶辫触" });
- }
- }
-
- catch (Exception e)
- {
- return Ok(new
- {
- code = 1,
- msg = e.Message
- });
- }
+ await _packagSvc.AddPackag(model);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "娣诲姞", "娣诲姞鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
}
/// <summary>
@@ -1669,42 +1193,11 @@
/// <param name="model">鍖呰淇℃伅</param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditPackag(AddEditPackagVm model)
+ [UnitOfWork]
+ public async Task EditPackag(AddEditPackagVm model)
{
- try
- {
- var claimsIdentity = this.User.Identity as ClaimsIdentity;
- if (claimsIdentity == null)
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
- UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
- if (string.IsNullOrWhiteSpace(UserId))
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
-
- model.CreateUser = int.Parse(UserId);
- int i = _packagSvc.EditPackag(model);
-
- if (i == 1)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "缂栬緫", "缂栬緫鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
- return Ok(new { code = 0, msg = "缂栬緫鎴愬姛" });
- }
- if (i == 2)
- {
- return Ok(new { code = i, msg = "鍖呰绛夌骇涓嶅彲瓒婄骇淇敼 璇烽噸鏂拌緭鍏�" });
- }
- else
- {
- return Ok(new { code = 1, msg = "缂栬緫澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _packagSvc.EditPackag(model);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "缂栬緫", "缂栬緫鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
}
/// <summary>
@@ -1713,37 +1206,11 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelPackag(AddEditPackagVm model)
+ [UnitOfWork]
+ public async Task DelPackag(AddEditPackagVm model)
{
- try
- {
- var claimsIdentity = this.User.Identity as ClaimsIdentity;
- if (claimsIdentity == null)
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
- UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
- if (string.IsNullOrWhiteSpace(UserId))
- {
- throw new Exception("鏈幏鍙栧埌鐢ㄦ埛淇℃伅");
- }
-
- var bolls = _packagSvc.DelPackag(model.Id, int.Parse(UserId));
-
- if (bolls)
- {
- _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "鍒犻櫎", "鍒犻櫎鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, Convert.ToInt32(UserId));
- return Ok(new { code = 0, msg = "鍒犻櫎鎴愬姛" });
- }
- else
- {
- return Ok(new { code = 1, msg = "鍒犻櫎澶辫触" });
- }
- }
- catch (Exception e)
- {
- return Ok(new { code = 1, msg = e.Message });
- }
+ await _packagSvc.DelPackag(model.Id, _userManager.UserId);
+ await _operation.InsertOperation("鍩虹淇℃伅", "鍖呰绠$悊", model.PackagNo, "鍒犻櫎", "鍒犻櫎鍖呰淇℃伅 鍖呰缂栧彿锛�" + model.PackagNo, _userManager.UserId);
}
#endregion
@@ -1755,7 +1222,7 @@
/// <returns></returns>
[HttpPost]
[ServiceFilter(typeof(ApiResponseActionFilter))]
- public async Task<SqlSugarPagedList<OperationDto>> GetSysOperationList(GetOperationVm model)
+ public async Task<SqlSugarPagedList> GetSysOperationList(GetOperationVm model)
{
return await _operation.GetSysOperationList(model);
}
@@ -1781,18 +1248,9 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetInterfaceList(InterfaceVm model)
+ public async Task<SqlSugarPagedList> 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>
@@ -1801,18 +1259,9 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult GetInterfaceDetailList(InterfaceDetailVm model)
+ public async Task<SqlSugarPagedList> 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>
@@ -1821,41 +1270,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult AddInterface(InterfaceVm model)
+ [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>
@@ -1864,41 +1290,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult EditInterface(InterfaceVm model)
+ [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>
@@ -1907,37 +1310,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelInterface(InterfaceVm model)
+ [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>
@@ -1946,37 +1330,18 @@
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
- public IActionResult DelInterfaceDetail(InterfaceDetailVm model)
+ [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