| | |
| | | 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, |
| | |
| | | //{ |
| | | // return Ok(new { code = 400, ErrorMsg = "为获取到当前操作人信息" }); |
| | | //} |
| | | var bolls = await _locatSvc.AddStorageLocat(model.Index, model.HouseNo, model.RoadwayNo, model.AreaNo, model.Row, model.Col, model.Layer, model.Depth, 1); |
| | | var bolls = 0; |
| | | if (model.HouseNo == "W01") |
| | | { |
| | | bolls = await _locatSvc.AddStorageLocat(model.Index, model.HouseNo, model.RoadwayNo, model.AreaNo, model.Row, model.Col, model.Layer, model.Depth, 1); |
| | | } |
| | | else |
| | | { |
| | | bolls = await _locatSvc.AddPkStorageLocat(model, 1); |
| | | } |
| | | |
| | | |
| | | if (bolls > 0) |
| | | { |
| | | await _operation.InsertOperation("仓库设置", "储位管理", model.RoadwayNo, "添加", "添加储位信息 储位号:" + model.RoadwayNo, 1); |
| | |
| | | var bolls = _locatSvc.EditStorageLocatList(model, _config.WcsHost + _config.EditLocateUrl, 1);//int.Parse(userId) |
| | | if (bolls) |
| | | { |
| | | SysStorageLocat storage = _locatSvc.GetStorageLocat(model.Id[0]); |
| | | string msg = "储位状态 储位号:" + storage.RoadwayNo; |
| | | SysStorageLocat storage; |
| | | //string msg = "储位状态 储位号:" + storage.RoadwayNo; |
| | | if (model.Id.Count > 1) |
| | | { |
| | | var list = _locatSvc.GetStorageLocat(); |
| | | foreach (var item in model.Id) |
| | | { |
| | | storage = _locatSvc.GetStorageLocat(item); |
| | | _operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "批量编辑", "批量修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId)); |
| | | storage = list.FirstOrDefault(m=>m.Id == item); |
| | | if (storage != null) |
| | | { |
| | | _operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "批量编辑", "批量修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId)); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | storage = _locatSvc.GetStorageLocat(model.Id[0]); |
| | | _operation.InsertOperation("仓库设置", "储位管理", storage.LocatNo, "修改", "修改储位信息 储位号:" + storage.LocatNo, Convert.ToInt32(userId)); |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | #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 |
| | | } |
| | | } |