| | |
| | | private readonly IOperationSysServer _operation; //操作日志 |
| | | private readonly IExceptionServer _table; //异常处理 |
| | | private readonly IHeaderSettingsServer _headerSet;//表头设置 |
| | | private readonly IPrintTemplateServer _template;//打印模板 |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | |
| | | /// <param name="dic">数据字典</param> |
| | | /// <param name="operation">操作日志</param> |
| | | /// <param name="table">异常处理</param> |
| | | public SysController(IWareHouseServer wareHouseSvc, IStorageAreaServer areaSvc, IStorageRoadwayServer roadwaySvc, IStorageLocatServer locatSvc, IPalletsServer palletSvc, IPalletTrackServer palletTrackSvc, IMenuServer menuSvc, IDictionaryServer dic, IOperationSysServer operation, IExceptionServer table, IHeaderSettingsServer headerSet) |
| | | public SysController(IWareHouseServer wareHouseSvc, IStorageAreaServer areaSvc, IStorageRoadwayServer roadwaySvc, IStorageLocatServer locatSvc, IPalletsServer palletSvc, IPalletTrackServer palletTrackSvc, IMenuServer menuSvc, IDictionaryServer dic, IOperationSysServer operation, IExceptionServer table, IHeaderSettingsServer headerSet, IPrintTemplateServer template) |
| | | { |
| | | _wareHouseSvc = wareHouseSvc; //仓库 |
| | | _areaSvc = areaSvc; //区域 |
| | |
| | | _table = table; //异常处理 |
| | | |
| | | _headerSet = headerSet;//表头设置 |
| | | _template = template;//打印模板 |
| | | } |
| | | |
| | | #region 菜单管理 |
| | |
| | | |
| | | #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 |
| | | |
| | | #region 数据表格表头自定义(通用方法) |
| | | /// <summary> |