From aa777daee492ba7f53d3c41f235f95c4d5505dbe Mon Sep 17 00:00:00 2001 From: chengsc <11752@DESKTOP-DS49RCP> Date: 星期六, 18 一月 2025 09:20:07 +0800 Subject: [PATCH] Revert "修改抽检" --- Wms/Wms/Controllers/PdaCrController.cs | 203 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 201 insertions(+), 2 deletions(-) diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs index a324d4a..cf4cc6b 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,202 @@ } } + /// <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.AgvHost + _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,model.Ruku, 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> + /// 浜哄伐杞繍 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [HttpPost] + public IActionResult ArtificialTransport(PdaArtificialTransportVm 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.ArtificialTransport(model.PalletNo, model.LocatNo, model.EndLocatNo, _config.MesHost + _config.MesGetTokenUrl,_config.MesHost+_config.MesBeiLiaoUrl, uId); + + return Ok(new { data = "", code = 0, msg = "鎴愬姛" }); + } + 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