From f3ec4fe9c98a87b42b00b6ac4790fe156a32aa6b Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期四, 19 六月 2025 16:53:20 +0800
Subject: [PATCH] 最新

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs |   56 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 18 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs"
index 34a9a0f..a98819f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/Partial/UntieStation.cs"
@@ -10,6 +10,9 @@
 using WIDESEA_Comm.AGVInterface.Requset;
 using WIDESEA_Common;
 using WIDESEA_Core;
+using WIDESEA_Core.Const;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO;
 using WIDESEA_Model.Models;
 
 namespace WIDESEA_StoragIntegrationServices
@@ -17,37 +20,54 @@
     public partial class ToAGVService
     {
         /// <summary>
-        /// 
+        /// PDA鎵цagv浠诲姟鐩磋蛋鍔熻兘
         /// </summary>
         /// <param name="taskinfo"></param>
         /// <param name="operationType">鎿嶄綔绫诲瀷(1-缁戝畾 2-瑙g粦)</param>
         /// <returns></returns>
-        public static WebResponseContent UntieStation(Dt_Task taskinfo, string operationType)
+        public  WebResponseContent UntieStation(SaveModel saveModel)
         {
+
             WebResponseContent content = new WebResponseContent();
+
+            string CZTM = saveModel.MainData["CZTM"].ToString();
+            if (string.IsNullOrEmpty(CZTM)) throw new Exception("杞﹁酱鏉$爜涓虹┖");
+
+            string TargetAddress = saveModel.MainData["TargetAddress"].ToString();
+            if (string.IsNullOrEmpty(TargetAddress)) return content.Error("鏈�夋嫨缂撳瓨鍙帮紝缂撳瓨鍙颁笉鍙负绌�");
             try
             {
-                bindCtnrAndBin bind = new bindCtnrAndBin()
+                //璋冨彇wcs鎺ュ彛锛岃鍙栬绔欏彴鏄惁鍙斁
+                var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
+                var ReceiveByWMSTask = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.GetPlcState)?.ConfigValue;
+                if (ReceiveByWMSTask == null || ipAddress == null)
                 {
-                    reqCode = Guid.NewGuid().ToString().Replace("-", ""),
-                    clientCode = "WMS",
-                    ctnrTyp = "2",
-                    indBind = operationType,   // 1-缁戝畾 2-瑙g粦
-                    stgBinCode = taskinfo.SourceAddress,
-                };
+                    throw new Exception("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddrss = ipAddress + ReceiveByWMSTask;
 
-                string ipaddress = AGV_Interface + "/getCLInfostring";
+                var respon = HttpHelper.Post(wmsIpAddrss, JsonConvert.SerializeObject(TargetAddress));   //http://localhost:9291/api/Task/ReceiveTask,
 
-                var requestBindInfo = bind.ToDictionary();
+                if (respon == null) return content.OK("鐢熸垚浠诲姟鎴愬姛");
 
-                var strRespon = HttpsClient.PostAsync(ipaddress, requestBindInfo).Result;
+                WebResponseContent respone = JsonConvert.DeserializeObject<WebResponseContent>(respon.ToString());
+                if (!respone.Status)
+                {
+                    return content.Error(respone.Message);
+                }
 
-                var responBase = JsonConvert.DeserializeObject<AGVResponBase>(strRespon);
-                if (responBase.code != "0") throw new Exception(responBase.message);
-
-                //todo
-
-                return content.OK();
+                RequestTaskDto input=new RequestTaskDto();
+                input.Position = TargetAddress;
+                WebResponseContent agvtocon=genAgvSchedulingTask(input);
+                if(agvtocon.Status)
+                {
+                    return content.OK("鐢熸垚浠诲姟鎴愬姛");
+                }
+                else
+                {
+                    return content.Error("閿欒淇℃伅锛�"+agvtocon.Message);
+                }
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3