From d567d9d6926abb103f3ab73402134daa6a09ef11 Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期六, 02 十一月 2024 18:28:13 +0800
Subject: [PATCH] 修改问题

---
 Wms/Wms/Controllers/PdaCrController.cs |   84 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 80 insertions(+), 4 deletions(-)

diff --git a/Wms/Wms/Controllers/PdaCrController.cs b/Wms/Wms/Controllers/PdaCrController.cs
index b4f542b..a668121 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 鐩樼偣
@@ -360,7 +363,7 @@
                 }
 
                 var uId = int.Parse(userId);
-                _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId);
+                _pdaCrSvc.AgvTransport(model.PalletNo, model.AreaNo, model.Ruku, uId, _config.WcsHost + _config.GenAgvSchedulingTask);
 
                 return Ok(new { data = "", code = 0, msg = "鎴愬姛" });
             }
@@ -392,7 +395,53 @@
                 }
 
                 var uId = int.Parse(userId);
-                _pdaCrSvc.AgvTransport2(model.SoNo,model.PalletNo, model.AreaNo, uId);
+                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>
+        /// 浜哄伐杞繍
+        /// </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 = "鎴愬姛" });
             }
@@ -401,6 +450,33 @@
                 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