| | |
| | | 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 菜单管理 |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "为获取到当前操作人信息" }); |
| | | } |
| | | var bolls = _roadwaySvc.EditStorageRoadway(model.Id, model.RoadwayName, model.Priority, model.Type, model.Temp,model.Availa, int.Parse(userId)); |
| | | var bolls = _roadwaySvc.EditStorageRoadway(model.Id, model.RoadwayName, model.Priority, model.Type, model.Temp, model.Availa, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | SysStorageRoadway storage = _roadwaySvc.GetStorageRoadway(model.Id); |
| | |
| | | //{ |
| | | // return Ok(new { code = 400, ErrorMsg = "为获取到当前操作人信息" }); |
| | | //} |
| | | var bolls = await _locatSvc.AddStorageLocat(model.HouseNo, model.RoadwayNo, model.AreaNo, model.Row, model.Col, model.Layer, model.Depth, 1); |
| | | var bolls = await _locatSvc.AddStorageLocat(model.Index, model.HouseNo, model.RoadwayNo, model.AreaNo, model.Row, model.Col, model.Layer, model.Depth, 1); |
| | | if (bolls > 0) |
| | | { |
| | | await _operation.InsertOperation("仓库设置", "储位管理", model.RoadwayNo, "添加", "添加储位信息 储位号:" + model.RoadwayNo, 1); |
| | |
| | | { |
| | | return Ok(new { code = 1, msg = "为获取到当前操作人信息" }); |
| | | } |
| | | var bolls = _locatSvc.EditStorageLocat(model, _config.WcsHost + _config.EditLocateUrl,int.Parse(userId)); |
| | | var bolls = _locatSvc.EditStorageLocat(model, _config.WcsHost + _config.EditLocateUrl, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | SysStorageLocat storage = _locatSvc.GetStorageLocat(model.Id); |
| | |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetAvailabilityRoadry() |
| | | { |
| | | { |
| | | try |
| | | { |
| | | var list = _locatSvc.GetAvailabilityRoadry(); |
| | |
| | | |
| | | #region 数据归档 |
| | | [HttpGet] |
| | | public IActionResult GetArchivingLogList(int Page=1, int Limit=10) |
| | | public IActionResult GetArchivingLogList(int Page = 1, int Limit = 10) |
| | | { |
| | | try |
| | | { |
| | | var list = _archiving.GetArchivingLogList(Page,Limit, out int count); |
| | | var list = _archiving.GetArchivingLogList(Page, Limit, out int count); |
| | | return Ok(new |
| | | { |
| | | data = list, |
| | |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = $"操作失败:{e.Message}" }); |
| | | } |
| | | |
| | | |
| | | } |
| | | #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 |
| | | } |