From 1e26a7575d9969e728b0aa01466f490409cb173c Mon Sep 17 00:00:00 2001 From: chengsc <Demo@DESKTOP-CPA90BF> Date: 星期五, 18 十月 2024 18:41:30 +0800 Subject: [PATCH] Merge branch 'master' into csc --- Wms/Wms/Controllers/PdaCrController.cs | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 164 insertions(+), 2 deletions(-) diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs index a324d4a..ee47568 100644 --- a/Wms/Wms/Controllers/PdaCrController.cs +++ b/Wms/Wms/Controllers/PdaCrController.cs @@ -10,6 +10,8 @@ using WMS.IBLL.IPdaServer; using WMS.Entity.DataEntity; using WMS.Entity.SysEntity; +using Wms.Tools; +using Microsoft.Extensions.Options; namespace Wms.Controllers { @@ -19,10 +21,11 @@ public class PdaCrController : ControllerBase { private readonly IPdaCrServer _pdaCrSvc; - - public PdaCrController(IPdaCrServer pdaCrSvc) + private readonly ApiUrlConfig _config; //鎺ュ彛浜や簰璺緞 + public PdaCrController(IPdaCrServer pdaCrSvc, IOptions<ApiUrlConfig> setting) { _pdaCrSvc = pdaCrSvc; + _config = setting.Value; } #region 鐩樼偣 @@ -278,6 +281,165 @@ } } + /// <summary> + /// 鑾峰彇鎵樼洏鎵�鍦ㄦゼ灞傛墍鏈夊尯鍩� + /// </summary> + /// <returns></returns> + [HttpGet] + public IActionResult GetRunSoNoticeList() + { + try + { + List<string> result = _pdaCrSvc.GetRunSoNoticeList(); + + return Ok(new { data = result, code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + + } + /// <summary> + /// 鏍规嵁鎵樼洏鍙疯幏鍙栨墭鐩樹笂鐗╂枡淇℃伅 + /// </summary> + /// <param name="palletNo"></param> + /// <returns></returns> + [HttpGet] + public IActionResult GetSkuInfoByPalletNo(string palletNo) + { + try + { + List<DataStockDetail> result = _pdaCrSvc.GetSkuInfoByPalletNo(palletNo); + + return Ok(new { data = result, code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + + } + /// <summary> + /// 鏍规嵁鍑哄簱鍗曞彿鑾峰彇鍒嗛厤鐨勬墭鐩樹俊鎭� + /// </summary> + /// <param name="soNo"></param> + /// <returns></returns> + [HttpGet] + public IActionResult GetPalletNoListBySoNo(string soNo) + { + try + { + List<string> result = _pdaCrSvc.GetPalletNoListBySoNo(soNo); + + return Ok(new { data = result, code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + + } + /// <summary> + /// agv杞繍鍛煎彨灏忚溅 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult AgvTransport(PdaAgvTransportVm 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 = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + + var uId = int.Parse(userId); + _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId, _config.WcsHost + _config.GenAgvSchedulingTask); + + return Ok(new { data = "", code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + /// <summary> + /// agv杞繍鍛煎彨灏忚溅鍙栬揣 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult AgvTransport2(PdaAgvTransportVm 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 = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" }); + } + + var uId = int.Parse(userId); + var str = _pdaCrSvc.AgvTransport2(model.SoNo,model.PalletNo, model.AreaNo, uId, _config.WcsHost + _config.GenAgvSchedulingTask); + var msgStr = ""; + if (str.Contains("0")) + { + msgStr += "鎴愬姛"; + } + if (str.Contains("1")) + { + msgStr += "閮ㄥ垎鎵樼洏宸叉湁灏忚溅绛夊緟鎵ц鎴栨鍦ㄦ墽琛岀殑浠诲姟"; + } + + + return Ok(new { data = "", code = 0, msg = msgStr }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + } + #endregion + + #region 绠辩爜鏌ヨ + /// <summary> + /// pda绠辩爜鏌ヨ + /// </summary> + /// <param name="boxNo">绠辩爜</param> + /// <returns></returns> + [HttpGet] + public IActionResult GetBoxQueryList(string boxNo) + { + try + { + DataBoxDto stockList = _pdaCrSvc.GetBoxQueryList(boxNo); + if (stockList == null) + { + return Ok(new { data = stockList, code = 1, msg = "鏃犳暟鎹�" }); + } + return Ok(new { data = stockList, code = 0, msg = "鎴愬姛" }); + } + catch (Exception e) + { + return Ok(new { data = "", code = 1, msg = $"寮傚父锛歿e.Message}" }); + } + + } #endregion } -- Gitblit v1.8.0