From 07b2fc307e6d7f8ddb4f652198f3d4856f884141 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <1247017146@qq.com>
Date: 星期三, 21 五月 2025 14:25:34 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 104 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
index f533dc7..3c643e1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/AGV/AGVService.cs"
@@ -73,7 +73,7 @@
                     var taskStation = BaseDal.QueryFirst(x => x.SourceAddress == item.stationName || x.TargetAddress == item.stationName);
                     outStationStatus.Add(new OutStationStatus()
                     {
-                        StationName = item.stationName,
+                        StationName = item.HostName,
                         StationEnable = station.StationEnable == "1" ? "0" : "1",
                         IsDistributionTask = taskStation == null ? "0" : "1",
                         Spare1 = "00"
@@ -161,12 +161,12 @@
                     switch (Status.AutoStatus)
                     {
                         case "MaintenanceMode":
-                            //杩愯
+                            //鎵嬪姩
                             _Socket.DeviceAutoStatusReport("1");
                             Thread.Sleep(500);
                             break;
                         case "ControlMode":
-                            //鍏虫満
+                            //鑷姩
                             _Socket.DeviceAutoStatusReport("0");
                             Thread.Sleep(500);
                             break;
@@ -319,8 +319,108 @@
                 return content.Error(ex.Message);
             }
         }
+        public WebResponseContent RequestOutTask(string PalletCode, string SourceAddress, string TargetAddress)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                //var tasks = BaseDal.QueryFirst(x => x.PalletCode == PalletCode);
+                //if (tasks != null)
+                //{
+                //    return content.Error("璇ユ墭鐩樺凡瀛樺湪浠诲姟");
+                //}
+                Dt_Task newTask = new Dt_Task()
+                {
+                    TaskNum = BaseDal.GetTaskNo().Result,
+                    SourceAddress = SourceAddress,
+                    CurrentAddress = SourceAddress,
+                    TargetAddress = TargetAddress,
+                    NextAddress = TargetAddress,
+                    Grade = 1,
+                    PalletCode = PalletCode,
+                    TaskType = (int)TaskOutboundTypeEnum.Outbound,
+                    TaskState = (int)TaskOutStatusEnum.OutNew,
+                    Dispatchertime = DateTime.Now,
+                    SeqNo = Convert.ToInt32(1),
+                    CommandID = Convert.ToInt32(101)
+                };
+                task_call task_Call = new task_call()
+                {
+                    d_task_type = newTask.TaskType == (int)TaskTypeEnum.Inbound ? 1 : 2,
+                    d_floor = 1,
+                    d_involed1 = newTask.SourceAddress,
+                    d_involed2 = newTask.TargetAddress,
+                    d_involed5 = newTask.TaskNum,
+                };
+                SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand();
+                return content.OK();
+
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+
+        public WebResponseContent InTask(string PalletCode, string SourceAddress, string TargetAddress)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                Dt_Task newTask = new Dt_Task()
+                {
+                    TaskNum = BaseDal.GetTaskNo().Result,
+                    SourceAddress = SourceAddress,
+                    TargetAddress = TargetAddress,
+                    PalletCode = PalletCode,
+                    TaskType = (int)TaskInboundTypeEnum.Inbound,
+                    TaskState = (int)TaskInStatusEnum.InNew,
+                    Dispatchertime = DateTime.Now,
+                    SeqNo = Convert.ToInt32(1),
+                    CommandID = Convert.ToInt32(101)
+                };
+                task_call task_Call = new task_call()
+                {
+                    d_task_type = newTask.TaskType == (int)TaskTypeEnum.Inbound ? 1 : 2,
+                    d_floor = 1,
+                    d_involed1 = newTask.SourceAddress,
+                    d_involed2 = newTask.TargetAddress,
+                    d_involed5 = newTask.TaskNum,
+                };
+                SqlSugarHelper.DbAGV.Insertable(task_Call).ExecuteCommand();
+                return content.OK();
+            }
+            catch (Exception ex)
+            {
+                return content.Error(ex.Message);
+            }
+        }
+        public WebResponseContent GetAGVStatus()
+        {
+            try
+            {
+                var x = _Socket.GetAGVStatus();
+                return WebResponseContent.Instance.OK(data: x);
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+        public WebResponseContent GetStationStatus(string StationName)
+        {
+            try
+            {
+                var x = _Socket.GetStationStatus(StationName);
+                return WebResponseContent.Instance.OK(data: x);
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
         #endregion 澶栭儴鎺ュ彛鏂规硶
 
-        
+
     }
 }

--
Gitblit v1.9.3