From 2cf8f4a928d3479068fc51be9633db4583eba3c9 Mon Sep 17 00:00:00 2001
From: wxw <Administrator@DESKTOP-5BIMHQ3>
Date: 星期五, 09 五月 2025 13:05:23 +0800
Subject: [PATCH] 修改问题

---
 Wms/Wms/Controllers/DownApiController.cs |  250 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 237 insertions(+), 13 deletions(-)

diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs
index a4e3fb8..4656c21 100644
--- a/Wms/Wms/Controllers/DownApiController.cs
+++ b/Wms/Wms/Controllers/DownApiController.cs
@@ -21,6 +21,8 @@
 using Microsoft.Extensions.Logging;
 using ZXing.QrCode.Internal;
 using Model.ModelVm.BllCheckVm;
+using Model.ModelVm.SysVm;
+using System.Security.Policy;
 
 namespace Wms.Controllers
 {
@@ -40,7 +42,8 @@
         private readonly IWaveMageServer _waveSvc;//浠诲姟鍚屾Svc
         private readonly IRcsServer _rcsserver;//RCS鐩稿叧浠诲姟
         private readonly INoticeServer _noticeSvc;//浜屾ゼ鍗曟嵁鐩稿叧
-        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc, IRcsServer rcsserver, INoticeServer noticeSvc)
+        private readonly IHopperTransportServer _hopper;//浜屾ゼ鍗曟嵁鐩稿叧
+        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc, IRcsServer rcsserver, INoticeServer noticeSvc, IHopperTransportServer hopper)
         {
             _config = setting.Value;
             _exNoticeSvc = exNoticeSvc;
@@ -51,6 +54,7 @@
             _waveSvc = waveSvc;
             _rcsserver = rcsserver;
             _noticeSvc = noticeSvc;
+            _hopper = hopper;
         }
 
         #region WMS鎺ュ彛 璋冪敤涓嬫父绯荤粺鎺ュ彛 
@@ -642,15 +646,6 @@
         }
         #endregion
 
-
-        #region PDA
-
-        //绌烘墭鎸囦护涓嬪彂锛堝嚭搴擄級
-
-
-        #endregion
-
-
         #region 浜屾ゼ涓氬姟
         /// <summary>
         /// RCS鍙《
@@ -905,7 +900,7 @@
                 LogFile.SaveLogToFile($"AGV浠诲姟鎵ц閫氱煡-璧板嚭鍌ㄤ綅-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
 
                 //鍏蜂綋澶勭悊鏂规硶
-
+                _hopper.OutBinAgv(model.taskCode, _config.AgvHost + _config.GenAgvSchedulingTask);
 
 
                 resultModel = new AgvResultModel { code = "0", message = "鎴愬姛", reqCode = model.reqCode };
@@ -940,8 +935,7 @@
                 LogFile.SaveLogToFile($"AGV浠诲姟鎵ц閫氱煡-浠诲姟缁撴潫-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
 
                 //鍏蜂綋澶勭悊鏂规硶
-                _rcsserver.RCSFinishTask(model.taskCode, "1", "AGV");
-
+                _hopper.RCSFinishTask(model.taskCode, "1", "AGV");
 
                 resultModel = new AgvResultModel { code = "0", message = "鎴愬姛", reqCode = model.reqCode };
                 var jsonData2 = JsonConvert.SerializeObject(resultModel);
@@ -1122,5 +1116,235 @@
             }
         }
         #endregion
+
+        #region JC37 鏂欐枟杞繍3銆�4妤间笟鍔�
+
+        /// <summary>
+        /// 鑾峰彇鍖哄煙鏍规嵁瑙掕壊
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetAreaListByUser()
+        {
+            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 model = _hopper.GetAreaListByUser(int.Parse(userId));
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        } 
+
+        /// <summary>
+        /// 鑾峰彇鍌ㄤ綅鏍规嵁鍖哄煙
+        /// </summary>
+        /// <param name="areaNo"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetLocatByArea(string areaNo)
+        {
+            try
+            {
+                var model = _hopper.GetLocatByArea(areaNo);
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇缃愮被鍨嬫牴鎹尯鍩�
+        /// </summary>
+        /// <param name="areaNo"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetPlnStatusByArea(string areaNo)
+        {
+            try
+            { 
+                var model = _hopper.GetPlnStatusByArea(areaNo);
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐗╂枡鏍规嵁缃愮被鍨�
+        /// </summary>
+        /// <param name="palletStatus"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetSkuByStatus(string palletStatus)
+        {
+            try
+            {
+                var model = _hopper.GetSkuByStatus(palletStatus);
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鎵规鏍规嵁鐗╂枡
+        /// </summary>
+        /// <param name="skuNo"></param>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetLotNoBySku(string skuNo)
+        {
+            try
+            {
+                var model = _hopper.GetLotNoBySku(skuNo);
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇鐗╂枡
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public IActionResult GetSku()
+        {
+            try
+            {
+                var model = _hopper.GetSku();
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+
+        /// <summary>
+        ///  
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult jiaoLiaoHopper(HopperModel 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 = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                _hopper.jiaoLiaoHopper(model.AreaNo,model.LocateNo,model.PlnStatus,model.Standard,model.SkuNo,model.LotNo,"", int.Parse(userId));
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+
+        /// <summary>
+        ///  
+        /// </summary>
+        /// <param name=""></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult jiaoCheHopper(HopperModel 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 = "鏈幏鍙栧埌褰撳墠鎿嶄綔浜轰俊鎭�" });
+                }
+                _hopper.jiaoCheHopper(model.AreaNo, model.LocateNo,model.PlnNo, model.PlnStatus, model.Weight , model.SkuNo, model.LotNo,"", int.Parse(userId));
+
+                return Ok(new { data = model, code = 0, msg = "" });
+            }
+            catch (Exception e)
+            {
+                return Ok(new { data = "", code = 1, msg = e.Message });
+            }
+        }
+        /// <summary>
+        /// 娓呮礂鏈哄彨鏂欑姸鎬�
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public IActionResult RCSCleanRequest(RCSCleanRequestModel model)
+        {
+            var logStr = $@".\log\AGV\娓呮礂鏈哄彨鏂�" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
+            AgvResultModel resultModel = null;//杩斿洖淇℃伅
+            try
+            {
+                var jsonData = JsonConvert.SerializeObject(model);
+                LogFile.SaveLogToFile($"娓呮礂鏈哄彨鏂�-璇锋眰鎶ユ枃锛�( {jsonData} ),", logStr);
+
+                //鍏蜂綋澶勭悊鏂规硶
+                _hopper.RCSCleanRequest(model.deviceID,model.deviceStation,model.status, _config.AgvHost + _config.GenAgvSchedulingTask);
+
+                resultModel = new AgvResultModel { code = "0", message = "璇锋眰鎴愬姛!"};
+                var jsonData2 = JsonConvert.SerializeObject(resultModel);
+                LogFile.SaveLogToFile($"娓呮礂鏈哄彨鏂�-杩斿洖鎶ユ枃锛�( {jsonData2} ),", logStr);
+                return Ok(resultModel);
+            }
+            catch (Exception e)
+            {
+                LogFile.SaveLogToFile($"娓呮礂鏈哄彨鏂欏紓甯革細( {e.Message} ),", logStr);
+
+                resultModel = new AgvResultModel { code = "1", message = e.Message, data = "", reqCode = "" };
+                var jsonData2 = JsonConvert.SerializeObject(resultModel);
+                LogFile.SaveLogToFile($"娓呮礂鏈哄彨鏂�-杩斿洖鎶ユ枃锛�( {jsonData2} ),", logStr);
+                return Ok(resultModel);
+            }
+        }
+        #endregion
+
     }
 }

--
Gitblit v1.8.0