| | |
| | | private readonly IArchivingServer _archiving;//数据归档 |
| | | |
| | | private readonly ApiUrlConfig _config; //接口交互路径 |
| | | private readonly IPrintTemplateServer _template;//打印模板 |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | |
| | | /// <param name="operation">操作日志</param> |
| | | /// <param name="table">异常处理</param> |
| | | /// <param name="category">物料类别</param> |
| | | public SysController(IOptions<ApiUrlConfig> setting, IWareHouseServer wareHouseSvc, IStorageAreaServer areaSvc, IStorageRoadwayServer roadwaySvc, IStorageLocatServer locatSvc, IPalletsServer palletSvc, IPalletTrackServer palletTrackSvc, IMenuServer menuSvc, IDictionaryServer dic, IOperationSysServer operation, IExceptionServer table, IHeaderSettingsServer headerSet, IMaterialCategoryServer category, IArchivingServer archiving) |
| | | public SysController(IOptions<ApiUrlConfig> setting, IWareHouseServer wareHouseSvc, IStorageAreaServer areaSvc, IStorageRoadwayServer roadwaySvc, IStorageLocatServer locatSvc, IPalletsServer palletSvc, IPalletTrackServer palletTrackSvc, IMenuServer menuSvc, IDictionaryServer dic, IOperationSysServer operation, IExceptionServer table, IHeaderSettingsServer headerSet, IMaterialCategoryServer category, IArchivingServer archiving, IPrintTemplateServer template) |
| | | { |
| | | _config = setting.Value; |
| | | |
| | |
| | | _category = category;//物料类别 |
| | | |
| | | _archiving = archiving;//数据归档 |
| | | _template = template;//打印模板 |
| | | } |
| | | |
| | | #region 菜单管理 |
| | |
| | | /// <param name="level">层级</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level) |
| | | public async Task<IActionResult> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level) |
| | | { |
| | | //查询菜单信息列表 |
| | | List<FunctionMenuVm> menulist = _menuSvc.GetMenuList(MenuName, pMenuNo, MenuNo, level); |
| | | List<FunctionMenuVm> menulist = await _menuSvc.GetMenuList(MenuName, pMenuNo, MenuNo, level); |
| | | return Ok(new |
| | | { |
| | | data = menulist, |
| | |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 打印模板 |
| | | |
| | | /// <summary> |
| | | /// 获取打印模板 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<IActionResult> GetPrintTemplateList([FromQuery] PrintTemplateVm model) |
| | | { |
| | | try |
| | | { |
| | | RefAsync<int> count = new RefAsync<int>(0); |
| | | var list = await _template.GetPrintTemplateList(model, count); |
| | | return Ok(new { code = 0, count = count.Value, msg = "打印模板", data = list }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取默认打印模板 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public async Task<IActionResult> GetDefaultPrintTemplate([FromQuery] string type = "1") |
| | | { |
| | | try |
| | | { |
| | | var data = await _template.GetDefaultPrintTemplate(type); |
| | | return Ok(new { code = 0, msg = "打印模板", data = data }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加打印模板 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddPrintTemplate(SysPrintTemplate 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | await _template.AddPrintTemplate(model, int.Parse(userId)); |
| | | return Ok(new { code = 0, msg = "添加成功", data = "" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改打印模板 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> EditPrintTemplate(SysPrintTemplate 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 = "未获取到当前操作人信息" }); |
| | | } |
| | | await _template.EditPrintTemplate(model, int.Parse(userId)); |
| | | return Ok(new { code = 0, msg = "修改成功", data = "" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 删除打印模板 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public async Task<IActionResult> DelPrintTemplate(SysPrintTemplate 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | await _template.DelPrintTemplate(model, int.Parse(userId)); |
| | | return Ok(new { code = 0, msg = "添加成功", data = "" }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |