| | |
| | | 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> |
| | |
| | | /// <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 |
| | |
| | | /// <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); |
| | |
| | | /// <param name="id">用户id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysUserInfor> GetUserinfoListById(int id) |
| | | { |
| | | return await _userInforServer.GetUserInfoById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertUserinfo(UserInfoDto UserInfoDto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DeleteUserInfo(int userids) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task UpdateUserinfo(UserInfoDto userdto) |
| | | { |
| | |
| | | /// <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); |
| | | pwdNew = Md5Tools.CalcMd5(pwdNew); |
| | | pwdNewTwo = Md5Tools.CalcMd5(pwdNewTwo); |
| | | //pwdNewTwo = Md5Tools.CalcMd5(pwdNewTwo); |
| | | //获取当前操作用户id |
| | | SysUserInfor user = await _userInforServer.GetUserInfoById(_userManager.UserId); |
| | | if (user == null) |
| | |
| | | if (user.PassWord != pwdOld) |
| | | throw Oops.Bah("原密码不正确"); |
| | | //修改密码 |
| | | int i = await _userInforServer.UptUserPassWord(pwdNew, _userManager.UserId); |
| | | int i = await _userInforServer.UptUserPassWord(pwdNew, pwdNewTwo, _userManager.UserId); |
| | | if (i <= 0) |
| | | throw Oops.Bah("修改密码失败"); |
| | | } |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<int> IsPassWordTime() |
| | | { |
| | | return await _userInforServer.IsPassWordTime(_userManager.UserId); |
| | |
| | | /// <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); |
| | |
| | | /// <param name="roleid">角色id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysRoles> GetRolesListById(int roleid) |
| | | { |
| | | return await _rolesServer.GetRoleInfoById(roleid); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertRoleInfo(RoleDto roledto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception"></exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DeleteRoleInfo(int roleids) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task UpdateRolesInfo(SysRoles role) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<FunctionMenuDto>> GetRBACLists(int id) |
| | | { |
| | | return await _rBACServer.GetMenuByroleIdNew(id); |
| | |
| | | /// </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> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<RoleRightDto>> GetRoleRightLists(int id) |
| | | { |
| | | return await _rBACServer.GetRoleRightList(id); |
| | |
| | | /// </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> |
| | |
| | | /// <param name="id">角色权限id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysRoleRight>> GetRoleRightOneListById(int id) |
| | | { |
| | | return await _roleRightServer.GetRoleRightOneListById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertRoleRight(string MenuNo, int id) |
| | | { |
| | |
| | | /// <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); |
| | |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysDepartment> GetDepartmentById(int id) |
| | | { |
| | | return await _department.GetDepartmentById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddDepartment(DepartmentDto departmentdto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelDepartment(int Id) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task ExitDepartment(DepartmentDto departmentdto) |
| | | { |
| | |
| | | /// <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); |
| | |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysFunSetting> GetFunSettingById(int id) |
| | | { |
| | | return await _setting.GetFunSettingById(id); |
| | |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo) |
| | | { |
| | | return await _setting.GetFunSettingByNo(funSetNo); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddFunSettings(FunSettingDto settingdto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelFunSettings(int id) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task ExitFunSettings(FunSettingDto settingdto) |
| | | { |
| | |
| | | /// <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); |
| | |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysMaterials> GetMateById(int id) |
| | | { |
| | | return await _mate.GetMateById(id); |
| | |
| | | /// <param name="matedto">物料dto</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task AddMate(MaterialsDto matedto) |
| | | { |
| | | await _mate.AddMate(matedto); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task DelMate(int id) |
| | | { |
| | | SysMaterials mate = await _mate.GetMateById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task ExitMate(MaterialsDto matedto) |
| | | { |
| | | await _mate.ExitMate(matedto); |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysUnit>> GetUnitList() |
| | | { |
| | | return await _mate.GetUnitList(); |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysPackag>> GetPackagList() |
| | | { |
| | | return await _mate.GetPackagList(); |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetCustomerList(GetCustomerVm model) |
| | | public async Task<SqlSugarPagedList> GetCustomerList(GetCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | | 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 }); |
| | | } |
| | | 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> |
| | | /// 查询单条客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetCustomer(IdVm model) |
| | | public async Task<SysCustomer> GetCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = await _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 async Task<IActionResult> GetCustomerSelect() |
| | | public async Task<List<SysCustomer>> GetCustomerSelect() |
| | | { |
| | | try |
| | | { |
| | | var bolls = await _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> |
| | | /// 添加客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddCustomer(AddCustomerVm model) |
| | | [UnitOfWork] |
| | | public async Task AddCustomer(AddCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = 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) |
| | | { |
| | | await _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> |
| | | /// 编辑客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> EditCustomer(EditCustomerVm model) |
| | | [UnitOfWork] |
| | | public async Task EditCustomer(EditCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = 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) |
| | | { |
| | | await _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> |
| | | /// 删除客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelCustomer(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | SysCustomer customer = await _customerSvc.GetCustomer(model.Id); |
| | | //获取当前登录的用户ID |
| | | 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 = await _customerSvc.DelCustomer(model.Id, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | await _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> |
| | | /// 删除客户信息(多删除) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelsCustomer(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _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 |
| | | |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetLogisticsInfoList(GetLogisticsInfoVm model) |
| | | public async Task<SqlSugarPagedList> GetLogisticsInfoList(GetLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | 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 }); |
| | | } |
| | | 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> |
| | | /// 查询单条物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetLogisticsInfo(IdVm model) |
| | | public async Task<SysLogisticsInfo> GetLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = await _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 async Task<IActionResult> GetLogisticsInfoSelect() |
| | | public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect() |
| | | { |
| | | try |
| | | { |
| | | var bolls = await _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> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddLogisticsInfo(AddLogisticsInfoVm model) |
| | | [UnitOfWork] |
| | | public async Task AddLogisticsInfo(AddLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | await _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> |
| | | /// 编辑物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> EditLogisticsInfo(EditLogisticsInfoVm model) |
| | | [UnitOfWork] |
| | | public async Task EditLogisticsInfo(EditLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | await _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> |
| | | /// 删除物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelLogisticsInfo(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsInfo(model.Id); |
| | | //获取当前登录的用户ID |
| | | 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 = await _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | |
| | | await _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.GetLogisticsDelInfo(model.Id); |
| | | await _operation.InsertOperation("基础信息", "物流管理", logisit.CarrierName, "删除", "删除物流信息 公司名称:" + logisit.CarrierName, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除物流信息(多条信息) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelsLogisticsInfo(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _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 |
| | | |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetUnitList(GetUnitVm model) |
| | | public async Task<SqlSugarPagedList> GetUnitList(GetUnitVm model) |
| | | { |
| | | try |
| | | { |
| | | 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 }); |
| | | } |
| | | 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> |
| | | /// 查询单条单位信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> GetUnit(IdVm model) |
| | | public async Task<SysUnit> GetUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var data = await _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> |
| | | /// 添加计量信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddUnit(AddEditUnitVm model) |
| | | [UnitOfWork] |
| | | public async Task AddUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _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("数据格式错误"); |
| | | } |
| | | |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> EditUnit(AddEditUnitVm model) |
| | | [UnitOfWork] |
| | | public async Task EditUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | SysUnit unit = await _unitSvc.GetUnit(model.Id); |
| | | await _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("数据格式错误"); |
| | | } |
| | | |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelUnit(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _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> |
| | | /// 删除计量单位信息(多删除) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelsUnit(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | 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 = await _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> |
| | | /// 查询包装信息 |
| | |
| | | /// <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> |
| | |
| | | /// <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> |
| | |
| | | /// <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> |
| | |
| | | /// <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> |
| | |
| | | /// <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 |
| | | |
| | |
| | | /// </summary> |
| | | /// <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); |
| | | } |
| | |
| | | /// <param name="dicName">字典名称</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysDictionary>> GetDicTypeList(string dicName) |
| | | { |
| | | return await _operation.GetDicTypeList(dicName); |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model) |
| | | public async Task<SqlSugarPagedList> GetInterfaceList(InterfaceVm model) |
| | | { |
| | | return await _interface.GetInterfaceList(model); |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model) |
| | | public async Task<SqlSugarPagedList> GetInterfaceDetailList(InterfaceDetailVm model) |
| | | { |
| | | return await _interface.GetInterfaceDetailList(model); |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task AddInterface(InterfaceVm model) |
| | | { |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task EditInterface(InterfaceVm model) |
| | | { |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelInterface(InterfaceVm model) |
| | | { |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DelInterfaceDetail(InterfaceDetailVm model) |
| | | { |