From 0464969366317154fdbb51e106ca778b855bdd08 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期六, 17 八月 2024 15:45:28 +0800 Subject: [PATCH] Merge branch 'master' into wxw --- Wms/Wms/Controllers/SysController.cs | 148 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 140 insertions(+), 8 deletions(-) diff --git a/Wms/Wms/Controllers/SysController.cs b/Wms/Wms/Controllers/SysController.cs index 9ab5be7..d177afc 100644 --- a/Wms/Wms/Controllers/SysController.cs +++ b/Wms/Wms/Controllers/SysController.cs @@ -50,6 +50,7 @@ private readonly IArchivingServer _archiving;//鏁版嵁褰掓。 private readonly ApiUrlConfig _config; //鎺ュ彛浜や簰璺緞 + private readonly IPrintTemplateServer _template;//鎵撳嵃妯℃澘 /// <summary> /// 鏋勯�犲嚱鏁� @@ -65,7 +66,7 @@ /// <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; @@ -85,6 +86,7 @@ _category = category;//鐗╂枡绫诲埆 _archiving = archiving;//鏁版嵁褰掓。 + _template = template;//鎵撳嵃妯℃澘 } #region 鑿滃崟绠$悊 @@ -953,7 +955,7 @@ { 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); @@ -1089,7 +1091,7 @@ //{ // 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); @@ -1182,7 +1184,7 @@ { 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); @@ -2046,7 +2048,7 @@ /// <returns></returns> [HttpGet] public IActionResult GetAvailabilityRoadry() - { + { try { var list = _locatSvc.GetAvailabilityRoadry(); @@ -2162,11 +2164,11 @@ #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, @@ -2208,7 +2210,137 @@ { 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 + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + 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 + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + 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 + { + //鑾峰彇褰撳墠鐧诲綍鐨勭敤鎴稩D + 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 } -- Gitblit v1.8.0