From cb62fe00ff0c80bce983b0aa7a2b320fdc26f85f Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 20 五月 2024 08:51:03 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/SuZhouGuanHong/TaiYuanTaiZhong

---
 代码管理/WMS/WMS_Client/src/views/dialog/addTask.vue                                           |   57 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs                          |   60 ++
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs                            |    4 
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs                                  |    3 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs                                           |   41 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs                           |  116 ++++
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs                                         |  172 +++--
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs           |   47 +
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs                                  |   46 +
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs                              |    8 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs                                   |    2 
 代码管理/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue                     |   33 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs                               |    4 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs              |   24 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/IServices/Taskinfo/Partial/Idt_agvtaskService.cs           |    3 
 代码管理/WMS/WMS_Client/src/api/http.js                                                        |    2 
 代码管理/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs                            |    6 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs                           |   57 +
 代码管理/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs                                     |   38 +
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_agvtaskController.cs |   12 
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/新文件夹/GetLocation.cs                        |    6 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs                                |   71 +-
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs                          |  109 +++
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs                             |   99 ++-
 代码管理/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs                     |   10 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs                    |  282 +++++++++
 代码管理/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js                 |   14 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs             |  118 ++++
 代码管理/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json                                        |    3 
 代码管理/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json                                        |    4 
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs                            |  108 +++
 代码管理/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs                                    |  116 ++++
 代码管理/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs                                   |   17 
 33 files changed, 1,429 insertions(+), 263 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs"
index 2e3dab7..e2c7715 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_Comm/StateEnum/LocationStateEnum.cs"
@@ -31,6 +31,10 @@
         /// <summary>
         /// 寮傚父
         /// </summary>
-        Abnormal
+        Abnormal,
+        /// <summary>
+        /// 妗佹灦涓嬫枡
+        /// </summary>
+        Load
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
index ed61b2b..c1ad6b1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Gantry.cs"
@@ -12,6 +12,7 @@
 using WIDESEA_Comm.LogInfo;
 using WIDESEA_Comm.TaskNo;
 using WIDESEA_Core.EFDbContext;
+using WIDESEA_Core.Extensions;
 using WIDESEA_Core.FreeDB;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
@@ -544,7 +545,7 @@
                                     station.heatNumber = Mes_Work.heatID;
                                     station.tray_status = "StrogeTray";
                                 }
-
+                                station.remark = "";
                                 var count = stationinfoRepository.Update(station, true);
                                 if (count < 1)
                                     throw new Exception($"涓嬫枡浣嶄俊鎭洿鏂板け璐ワ紒涓嬫枡浣嶇紪鍙凤細{station.stationCode}");
@@ -580,8 +581,6 @@
                         var Request = (bool)DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Request_Load").First(), client);
                         if (!Request) continue;
 
-                        //var Area = client.ReadByOrder<Int16>("W_AreaNr", name);//璇诲彇璐т綅鍙蜂俊鎭�
-                        //if (Area != 0) continue;
 
                         #region 璇诲彇妗佹灦淇℃伅
                         var Wheel_Type = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_Wheel_Type").First(), client);//杞﹁疆绫诲瀷
@@ -599,6 +598,7 @@
                             client.WriteByOrder("W_Enabl_Load", false, name);//淇″彿涓篺alse妗佹灦鍋滄杩涘叆
                             //WriteDBLog.Error(name, $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n\n鏈煡璇㈠埌宸ュ崟淇℃伅", "PCS");
                             WriteLog.Write_Log(name + "鐢宠鏀炬枡寮傚父", Wheel_id, "鏌ヨ鏈哄姞宸ュ伐鍗�", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN鍙凤細{Wheel_id}鏈煡璇㈠埌宸ュ崟淇℃伅\n鍐欏叆妗佹灦淇℃伅锛歕n鏄惁鍏佽涓嬫枡锛歿false}");
+                            continue;
                         }
 
 
@@ -615,6 +615,8 @@
                         #endregion
 
 
+
+
                         var wheel = Pipeline.QueryMateriel(Work.drawingNo);
                         var wheel1 = Pipeline.QueryMateriel1(Work.drawingNo);
                         if (wheel == null && wheel1 == null)
@@ -626,6 +628,17 @@
                             #endregion
                             continue;
                         }
+
+                        #region 鎹㈠浘鍙�,涓嬫枡鍙e叾浠栧浘鍙锋墭鐩樺叏閮ㄥ叆搴�
+                        var stations = Stations.Where(x => x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).ToList();
+                        foreach (var station in stations)
+                        {
+                            if (station.stationCode == NGStation || name == "3鍗曞厓涓嬫枡鍖�")
+                                agvtask(stationinfoRepository, station, Work, "TaskType_OutsourceInbound");
+                            else
+                                agvtask(stationinfoRepository, station, Work, "TaskType_Inbound");
+                        }
+                        #endregion
 
                         var PartStatus = DBExtension.Read(details.Where(x => x.plcdetail_name == "R_PartStatus").First(), client);//1:ok;2:nok
 
@@ -669,12 +682,9 @@
                             if (Stationinfo == null)
                             {
                                 #region 瑙﹀彂NG浠诲姟
-                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).FirstOrDefault();
+                                var NG = Stations.Where(x => x.enable && x.stationCode == NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.Number != Work.workOrder && x.quantity > 0).FirstOrDefault();
                                 if (NG != null)
-                                {
-                                    if (NG.stationType != Work.drawingNo || NG.Number != Work.workOrder)
-                                        agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
-                                }
+                                    agvtask(stationinfoRepository, NG, Work, "TaskType_OutsourceInbound");
                                 #endregion
 
                                 Stationinfo = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 0).FirstOrDefault();
@@ -685,9 +695,9 @@
                             {
 
                                 #region 鎹㈢被鍨嬬洿鎺ュ叆搴�
-                                var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault();
-                                if (stationinfo1 != null)
-                                    agvtask(stationinfoRepository, stationinfo1, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
+                                //var stationinfo1 = Stations.Where(x => x.enable && x.stationCode != NGStation && x.stationCode != Stationinfo.stationCode && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.stationType != Work.drawingNo).FirstOrDefault();
+                                //if (stationinfo1 != null)
+                                //    agvtask(stationinfoRepository, stationinfo1, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                 #endregion
 
                                 #region 鎵樼洏杞﹁疆鍫嗗灈绗洓涓椂涓嬪彂鍙﹀涓�涓倝鍙风殑鍏ュ簱浠诲姟
@@ -769,6 +779,8 @@
                                     client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//鎵樼洏涓婄殑绗嚑涓溅杞�
                                     client.WriteByOrder("W_Storage_Type", (Int16)1, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
                                     client.WriteByOrder("W_Enabl_Load", true, name);//鏄惁鍏佽
+                                    Stationinfo.remark = "妗佹灦涓嬫枡";
+                                    stationinfoRepository.Update(Stationinfo, true);
                                     #region 鏃ュ織璁板綍
                                     //WriteDBLog.Success(name + "鍏佽鏀炬枡", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細OK" +$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
                                     //    $"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\nW_Enabl_Load锛歵rue", "PCS");
@@ -785,7 +797,7 @@
                                 #region 娌℃墭鐩樺彲鐢�,瑙﹀彂鍏ュ簱浠诲姟
                                 if (!Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state != LocationStateEnum.Stroge.ToString()).Any())
                                 {
-                                    var station = Stations.Where(x => x.enable && x.stationCode != NGStation).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
+                                    var station = Stations.Where(x => x.enable && x.stationCode != NGStation && x.location_state == LocationStateEnum.Stroge.ToString()).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
                                     agvtask(stationinfoRepository, station, Work, name == "3鍗曞厓涓嬫枡鍖�" ? "TaskType_OutsourceInbound" : "TaskType_Inbound");
                                 }
                                 #endregion
@@ -827,6 +839,7 @@
                                     Stationinfo.tray_type = Stationinfo.tray_type == "SmallTray" ? "SmallTray/LargeTray" : "LargeTray/SmallTray";
                                     Stationinfo.remark = "鎵樼洏绫诲瀷涓嶄竴鑷撮渶鏇存崲鎵樼洏";
                                     stationinfoRepository.Update(Stationinfo, true);
+                                    continue;
                                 }
                                 #endregion
                                 var Pipelinedetails = plcRepository.Find(x => x.plcdetail_iotype == Pipelineplc.plcinfo_iotyep && x.plcdetail_number == Stationinfo.stationCode).ToList();
@@ -880,6 +893,8 @@
                                     client.WriteByOrder("W_IndexNr", (Int16)(Stationinfo.quantity + 1), name);//鎵樼洏涓婄殑绗嚑涓溅杞�
                                     client.WriteByOrder("W_Storage_Type", (Int16)1, name);//鎵樼洏绫诲瀷1-妯斁;2-绔栨斁(鏆傛椂鍙湁妯斁鎵樼洏)
                                     client.WriteByOrder("W_Enabl_Load", true, name);//鏄惁鍏佽
+                                    Stationinfo.remark = "妗佹灦涓嬫枡";
+                                    stationinfoRepository.Update(Stationinfo, true);
                                     #region 鏃ュ織璁板綍
                                     //WriteDBLog.Success(name + "鍏佽鏀炬枡", $"璇诲彇妗佹灦淇℃伅锛歕n杞﹁疆SN锛歿Wheel_id}\n杞瀷ID锛歿Wheel_Type}\n杞﹁疆鐘舵�侊細NG" +$"\n璇诲彇鎵樼洏鍏夌數淇″彿锛歿PalletSignal}" +
                                     //    $"\n\n鍐欏叆妗佹灦淇℃伅锛歕n涓嬫枡浣嶅彿锛歿area}\n绗嚑涓溅杞細{(Stationinfo.quantity + 1)}\n鎵樼洏绫诲瀷锛�1\nW_Enabl_Load锛歵rue", "PCS");
@@ -914,6 +929,8 @@
         {
             VOLContext Context = new VOLContext();
             Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+            IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(Context);
+            Work = workinfoRepository.Find(x => x.workOrder == stationinfo.Number && x.processCode == "17").FirstOrDefault();
             var task = agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).FirstOrDefault();
             if (task != null) return;
             if (!string.IsNullOrEmpty(Work.area))
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
index 22961fb..bff502d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs"
@@ -16,6 +16,7 @@
 using WIDESEA_Comm.TaskNo;
 using WIDESEA_WCS.JobsPart.Common;
 using System.Xml.Linq;
+using WIDESEA_Common;
 
 namespace WIDESEA_WCS
 {
@@ -84,9 +85,9 @@
                         {
 
                             #region 鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�
-                            var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
+                            //var area = Gantry_client.ReadByOrder<Int16>("place_prog", number);//鏀炬枡瀹屾垚鐨勫尯鍩熷彿
 
-                            WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�", $"PCS鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦鍖哄煙鍙凤細{area}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+                            //WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇鍖哄煙鍙锋槸鍚︿竴鑷�", $"PCS鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦鍖哄煙鍙凤細{area}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
                             //if (AreaNr != area)
                             //{
                             //    client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
@@ -97,9 +98,9 @@
                             #endregion
 
                             #region 鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�
-                            var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//妗佹灦璁板綍鐨勮溅杞暟閲�
+                            //var quantity = Gantry_client.ReadByOrder<Int16>("pos_prog", number);//妗佹灦璁板綍鐨勮溅杞暟閲�
 
-                            WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�", $"鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦杞﹁疆鏁帮細{quantity}\nPCS杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
+                            //WriteLog.Write_Log(number + "鍙栨枡瀹屾垚鍑洪敊", bindSNS[bindSNS.Length - 1], "鍒ゆ柇杞﹁疆鏁伴噺鏄惁涓�鑷�", $"鍖哄煙鍙凤細{AreaNr}锛沑n妗佹灦杞﹁疆鏁帮細{quantity}\nPCS杞﹁疆鏁帮細{station.quantity}\n閿欒淇℃伅锛歅CS鍖哄煙鍙蜂笌妗佹灦鍖哄煙鍙蜂笉涓�鑷达紒");
                             //if (quantity != station.quantity)
                             //{
                             //    client.WriteByOrder("W_AlarmSignal", (Int16)2, number);//鎶ヨ
@@ -196,18 +197,18 @@
                         }
 
                         #region 鏇存柊涓�涓娴嬩笂鏂欎换鍔�
-                        Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
-                        if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
-                        {
-                            var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
-                            if (task != null)
-                            {
-                                task.agv_taskstate = "Create";
-                                task.agv_toaddress = Station.stationCode;
-                                agvtaskService.Update(task, true);
-                                WriteDBLog.Success("鏇存柊涓�涓娴嬩笂鏂欎换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
-                            }
-                        }
+                        //Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+                        //if (!agvtaskService.Find(x => x.agv_toaddress == Station.stationCode).Any())
+                        //{
+                        //    var task = agvtaskService.Find(x => x.agv_taskstate == "Queue" && (x.agv_tasktype == "TaskType_OutsourceOutbound" || x.agv_tasktype == "TaskType_Outbound") && x.agv_toaddress == "").OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+                        //    if (task != null)
+                        //    {
+                        //        task.agv_taskstate = "Create";
+                        //        task.agv_toaddress = Station.stationCode;
+                        //        agvtaskService.Update(task, true);
+                        //        WriteDBLog.Success("鏇存柊涓�涓娴嬩笂鏂欎换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}", "PCS");
+                        //    }
+                        //}
                         #endregion
                     }
                 }
@@ -411,78 +412,105 @@
                                 agvtaskService.Update(task, true);
                                 station.location_state = LocationStateEnum.Busy.ToString();
                                 stationinfoRepository.Update(station, true);
-                                WriteDBLog.Success("鏇存柊绌烘墭闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+                                WriteDBLog.Success("鏇存柊琛ョ┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
                                 continue;
                             }
-                            remark = "鏌ヨ绌烘墭鍙犵洏浣�";
-                            #region 绌烘墭鍙犵洏
-                            if (stationCode.Contains("S"))
-                            {
-                                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
-                                EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
-                                if (EmptyStation == null)
-                                    EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0 && x.enable).FirstOrDefault();
-                                if (EmptyStation == null)
-                                {
-                                    EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0 && x.enable).OrderByDescending(x => x.quantity).FirstOrDefault();
-                                    if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
-                                }
-                            }
+                            #region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
+                            //remark = "鏌ヨ绌烘墭鍙犵洏浣�";
+                            //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
+                            //if (stationCode.Contains("S"))
+                            //{
+                            //    //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
+                            //    EmptyStation = EmptyStations.Where(x => x.tray_type == station.tray_type && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
+                            //    if (EmptyStation == null)
+                            //        EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
+                            //    if (EmptyStation == null)
+                            //    {
+                            //        EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
+                            //        if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
+                            //    }
+                            //}
+                            //EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault();
+                            //if (EmptyStation != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
                             #endregion
-                            else
+
+                            #region 鍒涘缓鍙栫┖鎵橀槦鍒椾换鍔�
+                            dt_agvtask agvtask = new dt_agvtask()
                             {
-                                remark = "鏌ユ壘搴撳唴绌烘墭浣�";
-                                EmptyStation = GetStation.EmptyPalletStation(area);
-                                if (EmptyStation != null)
-                                    if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
-                            }
+                                agv_fromaddress = station.stationCode,
+                                agv_id = Guid.NewGuid(),
+                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                                agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
+                                agv_createtime = DateTime.Now,
+                                agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
+                                //agv_materielid = station.stationType,
+                                agv_qty = 1,
+                                StarQuantity = 0,
+                                EndQuantity = 0,//EmptyStation.quantity,
+                                agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+                                agv_toaddress = "",//EmptyStation.stationCode,
+                                agv_userid = "绯荤粺",
+                                agv_TrayStatus = "EmptyTray",//station.tray_status,
+                                agv_Traytype = station.tray_type,
+                            };
+                            agvtaskService.Add(agvtask, true);
+                            station.location_state = LocationStateEnum.Busy.ToString();
+                            stationinfoRepository.Update(station, true);
+                            //EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                            //stationinfoRepository.Update(EmptyStation, true);
+                            WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+                            #endregion
+
+                            #region 鍒涘缓鍙栫┖鎵樻柊寤轰换鍔�
+                            //else
+                            //{
+                            //    remark = "鏌ユ壘搴撳唴绌烘墭浣�";
+                            //    EmptyStation = GetStation.EmptyPalletStation(area);
+                            //    if (EmptyStation != null)
+                            //        if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
+                            //}
 
 
-                            if (EmptyStation != null)
-                            {
-                                #region 鍚屼竴涓┖鎵樹綅鍙兘鍚屾椂鐢熸垚涓�涓┖鎵樹换鍔�
-                                //remark = "鏌ヨ绌烘墭浣嶆槸鍚﹀瓨鍦ㄤ换鍔�";
-                                //if (agvtaskService.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any())
-                                //    return;
-                                #endregion
-                                dt_agvtask agvtask = new dt_agvtask()
-                                {
-                                    agv_fromaddress = station.stationCode,
-                                    agv_id = Guid.NewGuid(),
-                                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
-                                    agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
-                                    agv_createtime = DateTime.Now,
-                                    agv_taskstate = "Create",
-                                    //agv_materielid = station.stationType,
-                                    agv_qty = 1,
-                                    StarQuantity = 0,
-                                    EndQuantity = EmptyStation.quantity,
-                                    agv_tasktype = "TaskType_EmptyPallet",
-                                    agv_toaddress = EmptyStation.stationCode,
-                                    agv_userid = "绯荤粺",
-                                    agv_TrayStatus = "EmptyTray",//station.tray_status,
-                                    agv_Traytype = station.tray_type,
-                                };
-                                agvtaskService.Add(agvtask, true);
-                                station.location_state = LocationStateEnum.Busy.ToString();
-                                stationinfoRepository.Update(station, true);
-                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
-                                stationinfoRepository.Update(EmptyStation, true);
-                                WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
-                            }
+                            //if (EmptyStation != null)
+                            //{
+                            //    dt_agvtask agvtask = new dt_agvtask()
+                            //    {
+                            //        agv_fromaddress = station.stationCode,
+                            //        agv_id = Guid.NewGuid(),
+                            //        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                            //        agv_grade = station.stationCode.Contains("S0100100") ? 3 : 1,
+                            //        agv_createtime = DateTime.Now,
+                            //        agv_taskstate = AGVTaskStateEnum.Create.ToString(),
+                            //        //agv_materielid = station.stationType,
+                            //        agv_qty = 1,
+                            //        StarQuantity = 0,
+                            //        EndQuantity = EmptyStation.quantity,
+                            //        agv_tasktype = "TaskType_EmptyPallet",
+                            //        agv_toaddress = EmptyStation.stationCode,
+                            //        agv_userid = "绯荤粺",
+                            //        agv_TrayStatus = "EmptyTray",//station.tray_status,
+                            //        agv_Traytype = station.tray_type,
+                            //    };
+                            //    agvtaskService.Add(agvtask, true);
+                            //    station.location_state = LocationStateEnum.Busy.ToString();
+                            //    stationinfoRepository.Update(station, true);
+                            //    EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                            //    stationinfoRepository.Update(EmptyStation, true);
+                            //    WriteDBLog.Success("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "PCS");
+                            //}
+                            #endregion
                         }
                     }
                     catch (Exception ex)
                     {
-                        //WriteDBLog.Error("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}", "PCS");
-                        WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", "閿欒淇℃伅锛�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}");
+                        WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"{stationCode}锛歿remark}閿欒淇℃伅锛歿ex.Message}");
                     }
                 }
             }
             catch (Exception ex)
             {
                 //WriteDBLog.Error("鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
-                WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵樹换鍔�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
+                WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鍒涘缓鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"閿欒淇℃伅锛歿ex.Message}");
             }
         }
 
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
index 2a95776..d3978c3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/Jobs/Task/AutoTaskJob.cs"
@@ -30,7 +30,7 @@
 
         private void DoAction(IJobExecutionContext context)
         {
-            EmptyTray.EmptyTrayIn();//绌烘墭鍙犵洏鍏ュ簱
+            //EmptyTray.EmptyTrayIn();//绌烘墭鍙犵洏鍏ュ簱
             StationTask.CreateTask();//鍏ュ簱
             OutboundTask.CreateOutboundTask();//鍑哄簱
             ReplaceTray.ReplaceTrayTask();//鏇存崲鎵樼洏
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
index 196578d..4870fd0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/EmptyTrayTask.cs"
@@ -6,6 +6,7 @@
 using WIDESEA_Comm;
 using WIDESEA_Comm.LogInfo;
 using WIDESEA_Comm.TaskNo;
+using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
@@ -34,34 +35,52 @@
                 Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                 List<string> strings = new List<string>() { };
                 var stations = stationinfoRepository.Find(x => x.stationCode.Contains("X") || x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")).ToList();
-                stations = stations.Where(x => x.location_state == "Empty" && x.enable).ToList();
+                stations = stations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.enable).ToList();
                 foreach (var station in stations)
                 {
                     if (agvtaskRepository.Find(x => x.agv_toaddress == station.stationCode).Any())
                         continue;
                     var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", station.stationCode);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
                     var MaterialSignal = Pipeline_client.ReadByOrder<Int16>("R_MaterialSignal", station.stationCode);//璇诲彇璐х墿淇″彿:1:鏈�,2鏃�
+
                     if (PalletSignal == 2 && MaterialSignal == 2)
                     {
-                        dt_agvtask taskPart = new dt_agvtask()
+                        if (station.remark == TrayTypeEnum.SmallTray.ToString() || station.remark == TrayTypeEnum.LargeTray.ToString()) station.tray_type = station.remark;
+
+                        var agv_task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress) && x.agv_Traytype == station.tray_type).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+                        if (agv_task != null)
                         {
-                            agv_fromaddress = "",
-                            agv_id = Guid.NewGuid(),
-                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
-                            agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
-                            agv_createtime = DateTime.Now,
-                            agv_taskstate = "Queue",
-                            agv_qty = 1,
-                            agv_tasktype = "TaskType_EmptyPallet",
-                            agv_toaddress = station.stationCode,
-                            agv_userid = "绯荤粺",
-                            agv_TrayStatus = "EmptyTray",// station.tray_status,
-                            agv_Traytype = station.tray_type
-                        };
-                        station.location_state = LocationStateEnum.Busy.ToString();
-                        stationinfoRepository.Update(station, true);
-                        agvtaskRepository.Add(taskPart, true);
-                        WriteDBLog.Success("鍒涘缓琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
+                            agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
+                            //agv_task.EndQuantity = EmptyStation.quantity;
+                            agv_task.agv_toaddress = station.stationCode;
+                            agvtaskRepository.Update(agv_task, true);
+                            station.location_state = LocationStateEnum.Busy.ToString();
+                            stationinfoRepository.Update(station, true);
+                            WriteDBLog.Success("鏇存柊琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "PCS");
+                        }
+                        else
+                        {
+                            dt_agvtask taskPart = new dt_agvtask()
+                            {
+                                agv_fromaddress = "",
+                                agv_id = Guid.NewGuid(),
+                                agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                                agv_grade = station.stationCode.Contains("W0100100") ? 3 : 2,
+                                agv_createtime = DateTime.Now,
+                                agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
+                                agv_qty = 1,
+                                agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+                                agv_toaddress = station.stationCode,
+                                agv_userid = "绯荤粺",
+                                agv_TrayStatus = TrayStateEnum.EmptyTray.ToString(),// station.tray_status,
+                                agv_Traytype = station.tray_type
+                            };
+                            station.location_state = LocationStateEnum.Busy.ToString();
+                            stationinfoRepository.Update(station, true);
+                            agvtaskRepository.Add(taskPart, true);
+                            WriteDBLog.Success("鍒涘缓琛ョ┖鎵樹换鍔�", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");
+                        }
+
                     }
                 }
             }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs"
index e1bb7ba..182dbce 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/GetStation/EmptyPalletStation.cs"
@@ -76,7 +76,15 @@
                 VOLContext Context = new VOLContext();
                 Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                 var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
-                OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                if (station.area == "10" || station.area == "11")
+                {
+                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                }
+                else
+                {
+                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                }
+
             }
             catch (Exception ex)
             {
@@ -124,25 +132,40 @@
                 var area = task.agv_Traytype == "SmallTray" ? "11" : "10";
 
                 #region 浼樺厛鍑�3搴撳尯鍐呯┖鎵樼洏
+                //if (area == "11")
+                //{
+                //    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+                //    if (EmptyStation == null)
+                //        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+                //    if (EmptyStation != null)
+                //        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+                //    if (EmptyStation != null)//绌烘墭璐т綅涓嶄负绌哄垽鏂槸鍚﹀瓨鍦ㄥ叾浠栦换鍔�
+                //        if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
+                //    //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
+                //}
+                #endregion
+
+                #region 鏌ユ壘AB搴撳尯鍙嚭搴撶┖鎵樿揣浣�
                 if (area == "11")
                 {
-                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
-                    if (EmptyStation == null)
-                        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002"/* && x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
-                    if (EmptyStation != null)
-                        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == EmptyStation.area && x.line == EmptyStation.line /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
-                    if (EmptyStation != null)//绌烘墭璐т綅涓嶄负绌哄垽鏂槸鍚﹀瓨鍦ㄥ叾浠栦换鍔�
-                        if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
-                    //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
+                    //EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
+                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.area).ThenBy(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
+                    if (EmptyStation != null)//蹇呴』鍑哄畬AB搴撶┖鎵樻墠鑳藉嚭绌烘墭鍖�
+                        if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) return;// EmptyStation = null;
                 }
                 #endregion
 
                 #region 鏌ユ壘绌烘墭搴撳尯
                 if (EmptyStation == null)
-                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area /*&& x.location_state == "Stroge"*/ && x.tray_status == "EmptyTray" && x.enable).OrderBy(x => x.column).FirstOrDefault();
+                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.area == area && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
+                #endregion
+
+                #region 绌烘墭璐т綅涓嶄负绌哄垽鏂槸鍚﹀瓨鍦ㄥ叾浠栦换鍔�
                 if (EmptyStation != null)
-                    if (stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
-                //if (EmptyStation.location_state == LocationStateEnum.Busy.ToString()) EmptyStation = null;
+                    if (QueueStation(EmptyStation.stationCode) || stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state.Contains("Busy")).Any()) EmptyStation = null;
+                #endregion
+
+                #region 鏇存柊琛ョ┖鎵橀槦鍒椾换鍔�
                 if (EmptyStation != null)
                 {
                     var PalletSignal = Pipeline_client.ReadByOrder<Int16>("R_PalletSignal", task.agv_toaddress);//璇诲彇鎵樼洏淇″彿:1:鏈�,2鏃�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
index 02427d5..ca16830 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/OutboundTask.cs"
@@ -34,7 +34,7 @@
                 Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
                 IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
 
-                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderBy(x => x.CreateTime).ToList();
+                var Mes_Works = workinfoRepository.Find(x => x.processCode == "28").OrderByDescending(x => x.CreateTime).ToList();
                 foreach (var Mes_Work in Mes_Works)
                 {
                     var inventory = inventoryRepository.Find(x => x.SN == Mes_Work.SN).FirstOrDefault();
@@ -53,6 +53,8 @@
                             stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.column).FirstOrDefault();
                             if (stationinfo != null)
                             {
+                                if (agvtaskRepository.Find(x => x.agv_fromaddress == stationinfo.stationCode).Any()) continue;
+
                                 if (stationinfoRepository.Find(x => x.line == stationinfo.line && x.area == stationinfo.area && x.column > stationinfo.column && !x.enable).Any())
                                     continue;
                                 if (string.IsNullOrEmpty(stationinfo.bindSN))
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
index da98f63..444ca4f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs"
@@ -7,6 +7,7 @@
 using WIDESEA_Comm;
 using WIDESEA_Comm.LogInfo;
 using WIDESEA_Comm.TaskNo;
+using WIDESEA_Common;
 using WIDESEA_Core.EFDbContext;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WCS.IRepositories;
@@ -48,7 +49,7 @@
         #endregion
 
         /// <summary>
-        /// 鍒涘缓鏇存崲鎵樼洏浠诲姟
+        /// 鍒涘缓鏇存崲鎵樼洏浠诲姟,闇�淇敼
         /// </summary>
         public static void ReplaceTrayTask()
         {
@@ -61,47 +62,65 @@
                 foreach (var station in stations)
                 {
                     if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue;
+                    #region MyRegion
                     var types = station.tray_type.Split('/');
-                    var area = types[0] == "SmallTray" ? "11" : "10";
-                    //鎵�1搴撳尯鐨勭┖鎵樹綅
-                    var EmptyStation = GetStation.EmptyPalletStation(area);
-                    //var EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains("A") /*&& x.location_state == "Empty"*/ && x.enable)
-                    //    .OrderBy(x => x.column).OrderBy(x => x.line).FirstOrDefault();
-                    //if (EmptyStation == null)
-                    //    EmptyStation = stationinfoRepository.Find(x => x.area == area && x.quantity < 5 && x.stationCode.Contains(area == "10" ? "D" : "C") /*&& x.location_state == "Empty"*/ && x.enable)
-                    //    .OrderBy(x => x.line).OrderBy(x => x.column).FirstOrDefault();
-                    if (EmptyStation != null)
+                    dt_agvtask agvtask = new dt_agvtask()
                     {
-                        dt_agvtask agvtask = new dt_agvtask()
-                        {
-                            agv_fromaddress = station.stationCode,
-                            agv_id = Guid.NewGuid(),
-                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
-                            agv_grade = 2,
-                            agv_createtime = DateTime.Now,
-                            agv_taskstate = "Create",
-                            //agv_materielid = station.stationType,
-                            agv_qty = 1,
-                            StarQuantity = 0,
-                            EndQuantity = EmptyStation.quantity,
-                            agv_tasktype = "TaskType_EmptyPallet",
-                            agv_toaddress = EmptyStation.stationCode,
-                            agv_userid = "绯荤粺",
-                            agv_TrayStatus = station.tray_status,
-                            //bindSN = station.bindSN,
-                            //agv_worktype = Convert.ToInt32(mesinfo.processCode),
-                            //agv_materbarcode = mesinfo.materialCode,
-                            agv_Traytype = types[0]
-                        };
-                        agvtaskRepository.Add(agvtask, true);
-                        station.location_state = LocationStateEnum.Busy.ToString();
-                        stationinfoRepository.Update(EmptyStation, true);
-                        EmptyStation.location_state = LocationStateEnum.Busy.ToString();
-                        stationinfoRepository.Update(EmptyStation, true);
-                        WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
-                        CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
-                        //CreatePartQueue(agvtaskRepository, agvtask, types[1]);
-                    }
+                        agv_fromaddress = station.stationCode,
+                        agv_id = Guid.NewGuid(),
+                        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                        agv_grade = 1,
+                        agv_createtime = DateTime.Now,
+                        agv_taskstate = AGVTaskStateEnum.Queue.ToString(),
+                        agv_qty = 1,
+                        StarQuantity = 0,
+                        EndQuantity = 0,//EmptyStation.quantity,
+                        agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+                        agv_toaddress = "",//EmptyStation.stationCode,
+                        agv_userid = "绯荤粺",
+                        agv_TrayStatus = station.tray_status,
+                        agv_Traytype = types[0]
+                    };
+                    agvtaskRepository.Add(agvtask, true);
+                    station.location_state = LocationStateEnum.Busy.ToString();
+                    stationinfoRepository.Update(station, true);
+                    WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+                    CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
+                    #endregion
+
+                    #region MyRegion
+                    //var types = station.tray_type.Split('/');
+                    //var area = types[0] == "SmallTray" ? "11" : "10";
+                    ////鎵�1搴撳尯鐨勭┖鎵樹綅
+                    //var EmptyStation = GetStation.EmptyPalletStation(area);
+                    //if (EmptyStation != null)
+                    //{
+                    //    dt_agvtask agvtask = new dt_agvtask()
+                    //    {
+                    //        agv_fromaddress = station.stationCode,
+                    //        agv_id = Guid.NewGuid(),
+                    //        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                    //        agv_grade = 2,
+                    //        agv_createtime = DateTime.Now,
+                    //        agv_taskstate = "Create",
+                    //        agv_qty = 1,
+                    //        StarQuantity = 0,
+                    //        EndQuantity = EmptyStation.quantity,
+                    //        agv_tasktype = "TaskType_EmptyPallet",
+                    //        agv_toaddress = EmptyStation.stationCode,
+                    //        agv_userid = "绯荤粺",
+                    //        agv_TrayStatus = station.tray_status,
+                    //        agv_Traytype = types[0]
+                    //    };
+                    //    agvtaskRepository.Add(agvtask, true);
+                    //    station.location_state = LocationStateEnum.Busy.ToString();
+                    //    stationinfoRepository.Update(station, true);
+                    //    EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                    //    stationinfoRepository.Update(EmptyStation, true);
+                    //    WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+                    //    CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
+                    //} 
+                    #endregion
                 }
             }
             catch (Exception ex)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
index 5d521e3..385af08 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/RestockHCJ.cs"
@@ -172,7 +172,6 @@
                         else
                             GetStation.EmptyPalletStation(agvtask);
                     }
-                    WriteDBLog.Success("鏇存柊绌烘墭闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
                 }
                 else if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_OutsourceInbound.ToString() || agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Inbound.ToString())//澶栧崗搴撳叆搴�/AB搴撳叆搴�
                 {
@@ -205,14 +204,15 @@
                     {
                         if (agvtask.agv_tasktype == AGVTaskTypeEnum.TaskType_Outbound.ToString())
                             if (GetStation.QueueStation(agvtask.agv_fromaddress)) return;//闄愬埗涓�琛屼竴娆″彧鑳藉嚭涓�涓换鍔�
-                        var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList();
+                        //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && (x.tray_status == TrayStateEnum.EmptyTray.ToString() || x.location_state == LocationStateEnum.Empty.ToString()) && x.enable).ToList();
+                        var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("S01001") && x.enable).ToList();
                         foreach (var EmptyStation in EmptyStations)
                         {
                             if (agvtaskService.Find(x => x.agv_toaddress == EmptyStation.stationCode).Any()) continue;
                             agvtask.agv_taskstate = AGVTaskStateEnum.Create.ToString();
                             agvtask.agv_toaddress = EmptyStation.stationCode;
-                            EmptyStation.location_state = LocationStateEnum.Busy.ToString();
-                            stationinfoRepository.Update(EmptyStation, true);
+                            //EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                            //stationinfoRepository.Update(EmptyStation, true);
                             agvtaskService.Update(agvtask, true);
                             WriteDBLog.Success("鏇存柊鍑哄簱闃熷垪浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
                             return;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
index 7c0a658..9722c24 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/\346\226\260\346\226\207\344\273\266\345\244\271/GetLocation.cs"
@@ -39,7 +39,7 @@
                     dt_stationinfo TargetLocation = null;
 
                     #region 瀵绘壘宸插垎閰嶅悓鍥惧彿鍏ュ簱浠诲姟搴撲綅
-                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3")).FirstOrDefault();
+                    TargetLocation = area1 == "4" ? stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && x.enable && x.area == area1).FirstOrDefault() : stationinfoRepository.Find(x => x.stationType == agvtask.agv_materielid && x.location_state == LocationStateEnum.InBusy.ToString() && (x.area == "2" || x.area == "3") && x.enable).FirstOrDefault();
                     if (TargetLocation != null)
                     {
                         TargetLocation = stationinfoRepository.Find(x => x.line == TargetLocation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable && x.area == TargetLocation.area).OrderBy(x => x.column).FirstOrDefault();
@@ -132,11 +132,11 @@
 
                     #region 鏈壘鍒板簱瀛樻垨褰撳墠搴撳瓨琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
                     var area = GetArea(mesinfo.quantity, agvtask.agv_Traytype);
-                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+                    TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                     if (TargetLocation == null && area != "4")
                     {
                         area = area == "2" ? "3" : "2";
-                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).ThenBy(x => x.column).FirstOrDefault();
+                        TargetLocation = stationinfoRepository.Find(x => x.column == (area == "2" ? 1 : 2) && x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.line).FirstOrDefault();
                     }
 
                     #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
index 1ecb410..1d06fa1 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/PCS/WCS_Server/WIDESEA_WebApi/appsettings.json"
@@ -16,8 +16,8 @@
   "Connection": {
     "DBType": "MsSql", //MySql/MsSql/PgSql  //鏁版嵁搴撶被鍨嬶紝濡傛灉浣跨敤鐨勬槸sqlserver姝ゅ搴旇缃负MsSql
     //sqlserver杩炴帴瀛楃涓睵@ssw0rd
-    "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
-    //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
+    //"DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
+    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
 
     //mysql杩炴帴瀛楃涓�(鍗囩骇EFCore3.1鍒版椂宸插皢mysql杩炴帴瀛楃涓蹭慨鏀�,2019-12-20)
     // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
index 0af90a4..eb0a016 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/api/http.js"
@@ -12,7 +12,7 @@
 let loadingInstance;
 let loadingStatus = false;
 if (process.env.NODE_ENV == 'development') {
-    axios.defaults.baseURL = 'http://127.0.0.1:8098/';
+    axios.defaults.baseURL = 'http://192.168.12.101:8098/';
 }
 else if (process.env.NODE_ENV == 'debug') {
     axios.defaults.baseURL = 'http://192.168.12.101:8098/';
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue"
index 3904ac0..7f4b64e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/Task/widesea_wms/taskinfo/dt_agvtask.vue"
@@ -22,7 +22,7 @@
     export default defineComponent({
         setup() {
             const table = ref({
-                key: 'ID',
+                key: 'agv_id',
                 footer: "Foots",
                 cnName: 'AGV浠诲姟',
                 name: 'taskinfo/dt_agvtask',
@@ -30,23 +30,24 @@
                 sortName: "ID"
             });
             const editFormFields = ref({"agv_fromaddress":"","agv_toaddress":"","agv_tasktype":"","agv_grades":"","agv_code":""});
-            const editFormOptions = ref([[{
-        title: "NG涓嬫枡浣�",
-        required: false,
-        field: "agv_fromaddress",
-        type: "select",
-        data: [
-          { key: "X01001003", value: "1鍗曞厓NG涓嬫枡浣�" },
-          { key: "X02001003", value: "2鍗曞厓NG涓嬫枡浣�" },
-          { key: "X03001002", value: "3鍗曞厓NG涓嬫枡浣�" }
-        ]
-      },
-    //   {"title":"NG涓嬫枡浣�","field":"agv_fromaddress","type":"text","required":true}
-    ],
+            const editFormOptions = ref([
+    //             [{
+    //     title: "NG涓嬫枡浣�",
+    //     required: false,
+    //     field: "agv_fromaddress",
+    //     type: "select",
+    //     data: [
+    //       { key: "X01001003", value: "1鍗曞厓NG涓嬫枡浣�" },
+    //       { key: "X02001003", value: "2鍗曞厓NG涓嬫枡浣�" },
+    //       { key: "X03001002", value: "3鍗曞厓NG涓嬫枡浣�" }
+    //     ]
+    //   },
+    // //   {"title":"NG涓嬫枡浣�","field":"agv_fromaddress","type":"text","required":true}
+    // ],
             
                             //   [{"title":"缁堢偣鍦板潃","field":"agv_toaddress","type":"text","required":true}],
-                            //   [{"dataKey":"task_grade","data":[],"title":"浠诲姟绛夌骇","required":true,"field":"agv_grade","type":"select"}],
-                            //   [{"dataKey":"agv_tasktypes","data":[],"title":"浠诲姟绫诲瀷","required":true,"field":"agv_tasktype","type":"select"}]
+                              [{"dataKey":"task_grade","data":[],"title":"浠诲姟绛夌骇","required":true,"field":"agv_grade","type":"select"}],
+                              [{"dataKey":"agv_tasktypes","data":[],"title":"浠诲姟绫诲瀷","required":true,"field":"agv_tasktype","type":"select"}]
                             //   [{"dataKey":"agv_code","data":[],"title":"AGV缂栧彿","required":true,"field":"agv_code","type":"select"}]
                             ]);
             const searchFormFields = ref({"agv_tasknum":"","agv_fromaddress":"","agv_toaddress":"","agv_tasktype":[],"agv_taskstate":[],"agv_materielid":"","agv_createtime":"","agv_barcode":"","agv_materbarcode":""});
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/dialog/addTask.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/dialog/addTask.vue"
index 3af9917..ac6d802 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/dialog/addTask.vue"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/dialog/addTask.vue"
@@ -1,6 +1,6 @@
 <template>
     <div>
-        <vol-box :lazy="true" v-model="detialBox" title="鎵嬪姩绉诲簱" :height="350" :width="400" :padding="15">
+        <vol-box :lazy="true" v-model="detialBox" title="NG浠诲姟" :height="350" :width="400" :padding="15">
             <div>
                 <el-form :model="formdata" label-width="120px" :rules="rules" size="mini" ref="ruleFormRef">
                     <!-- <el-form-item label="绫诲瀷">
@@ -10,18 +10,18 @@
                         </el-radio-group>
                     </el-form-item> -->
 
-                    <el-form-item v-if="inType == 'handle'" label="璧峰鍦板潃" prop="from_address">
-                        <el-select v-model="formdata.from_address" clearable filterable placeholder="璇烽�夋嫨璧峰鍦板潃">
-                            <el-option v-for="item in formAddressList" :label="item.key" :value="item.key" />
+                    <el-form-item v-if="inType == 'handle'" label="NG涓嬫枡浣�" prop="from_address">
+                        <el-select v-model="formdata.from_address" clearable filterable placeholder="璇烽�夋嫨NG涓嬫枡浣�">
+                            <el-option v-for="item in formAddressList" :label="item.value" :value="item.key" />
                         </el-select>
                     </el-form-item>
-                    <el-form-item label="鐩殑鍦板潃" prop="to_address">
+                    <!-- <el-form-item label="鐩殑鍦板潃" prop="to_address">
                         <el-select v-model="formdata.to_address" clearable filterable placeholder="璇烽�夋嫨鐩殑鍦板潃">
                             <el-option v-for="item in toAddressList" :label="item.key" :value="item.key" />
                         </el-select>
-                    </el-form-item>
+                    </el-form-item> -->
                     <el-form-item label="">
-                        <el-button type="primary" @click="onSubmit()" size="mini"> 纭绉诲簱</el-button>
+                        <el-button type="primary" @click="onSubmit()" size="mini"> 纭娣诲姞NG浠诲姟</el-button>
                     </el-form-item>
                 </el-form>
             </div>
@@ -35,17 +35,17 @@
 export default {
     components: { "vol-box": VolBox1Vue },
     methods: {},
-    created() {
-        this.http.post("/api/Sys_Dictionary/GetVueDictionary", ["route_began", "route_end"]).then(x => {
-            x.forEach(item => {
-                if (item.dicNo == 'route_end') {
-                    this.toAddressList = item.data;
-                } else if (item.dicNo == 'route_began') {
-                    this.formAddressList = item.data;
-                }
-            })
-        })
-    },
+    // created() {
+    //     this.http.post("/api/Sys_Dictionary/GetVueDictionary", ["route_began", "route_end"]).then(x => {
+    //         x.forEach(item => {
+    //             if (item.dicNo == 'route_end') {
+    //                 this.toAddressList = item.data;
+    //             } else if (item.dicNo == 'route_began') {
+    //                 this.formAddressList = item.data;
+    //             }
+    //         })
+    //     })
+    // },
     data() {
         return {
             detialBox: false,
@@ -59,7 +59,11 @@
                 from_address: "",
                 to_address: ""
             },
-            formAddressList: [],
+            formAddressList: [
+                { key: "X01001003", value: "1鍗曞厓NG涓嬫枡浣�" },
+          { key: "X02001003", value: "2鍗曞厓NG涓嬫枡浣�" },
+          { key: "X03001002", value: "3鍗曞厓NG涓嬫枡浣�" }
+            ],
             toAddressList: []
         };
     },
@@ -68,10 +72,17 @@
             var _this = this;
             this.$refs.ruleFormRef.validate((valid) => {
                 if (valid) {
-                    _this.http.post("/api/ToMes/AddToFloat3", _this.formdata, "姝e湪娣诲姞....").then(x => {
-                        if (!x.status) return _this.$Message.error(x.message);
-                        _this.$Message.success("娣诲姞鎴愬姛!");
-                        _this.refresh();
+                    _this.http.post("/api/dt_agvtask/addNgTask", _this.formdata, "姝e湪娣诲姞....").then(x => {
+                        if (!x.status){
+                            _this.detialBox=false;
+                            _this.formdata.from_address="";
+                             _this.$Message.error(x.message);
+                        }else{
+                            _this.detialBox=false;
+                            _this.formdata.from_address="";
+                            _this.$Message.success("娣诲姞鎴愬姛!");
+                            window.location.reload();
+                        }
                     });
                 }
             })
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js"
index 0373480..d3c9566 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Client/src/views/extension/widesea_wms/taskinfo/dt_agvtask.js"
@@ -6,11 +6,12 @@
 **鍚庡彴鎿嶄綔瑙侊細http://v2.volcore.xyz/document/netCoreDev
 *****************************************************************************************/
 //姝s鏂囦欢鏄敤鏉ヨ嚜瀹氫箟鎵╁睍涓氬姟浠g爜锛屽彲浠ユ墿灞曚竴浜涜嚜瀹氫箟椤甸潰鎴栬�呴噸鏂伴厤缃敓鎴愮殑浠g爜
+import addTask from "@/views/dialog/addTask"
 
 let extension = {
   components: {
     //鏌ヨ鐣岄潰鎵╁睍缁勪欢
-    gridHeader: '',
+    gridHeader: addTask,
     gridBody: '',
     gridFooter: '',
     //鏂板缓銆佺紪杈戝脊鍑烘鎵╁睍缁勪欢
@@ -21,6 +22,12 @@
   tableAction: '', //鎸囧畾鏌愬紶琛ㄧ殑鏉冮檺(杩欓噷濉啓琛ㄥ悕,榛樿涓嶇敤濉啓)
   buttons: { view: [], box: [], detail: [] }, //鎵╁睍鐨勬寜閽�
   methods: {
+  //   onClick: function () {
+  //     this.add();
+  // }
+  add(){
+    this.$refs.gridHeader.detialBox = true;
+  },
      //涓嬮潰杩欎簺鏂规硶鍙互淇濈暀涔熷彲浠ュ垹闄�
     onInit() {  //妗嗘灦鍒濆鍖栭厤缃墠锛�
         //绀轰緥锛氬湪鎸夐挳鐨勬渶鍓嶉潰娣诲姞涓�涓寜閽�
@@ -39,7 +46,7 @@
         this.buttons.forEach(x => {
           if(x.value == 'Add')
           {
-            x.name = 'NG浠诲姟'
+            x.name = 'NG浠诲姟';
           }
         });
         //绀轰緥锛氳缃慨鏀规柊寤恒�佺紪杈戝脊鍑烘瀛楁鏍囩鐨勯暱搴�
@@ -72,6 +79,9 @@
       // this.$refs.table.$refs.table.toggleRowSelection(row); //鍗曞嚮琛屾椂閫変腑褰撳墠琛�;
     },
     modelOpenAfter(row) {
+      // if(this.currentAction=='Add'){
+      //   this.editFormFields.agv_fromaddress='xxx';
+      // }
       //鐐瑰嚮缂栬緫銆佹柊寤烘寜閽脊鍑烘鍚庯紝鍙互鍦ㄦ澶勫啓閫昏緫锛屽锛屼粠鍚庡彴鑾峰彇鏁版嵁
       //(1)鍒ゆ柇鏄紪杈戣繕鏄柊寤烘搷浣滐細 this.currentAction=='Add';
       //(2)缁欏脊鍑烘璁剧疆榛樿鍊�
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs"
new file mode 100644
index 0000000..bc79452
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Comm/StateEnum/TrayEnum.cs"
@@ -0,0 +1,38 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_Comm
+{
+    /// <summary>
+    /// 鎵樼洏鐘舵��
+    /// </summary>
+    public enum TrayStateEnum
+    {
+        /// <summary>
+        /// 绌烘墭鐩�
+        /// </summary>
+        EmptyTray,
+        /// <summary>
+        /// 婊℃墭鐩�
+        /// </summary>
+        StrogeTray
+
+    }
+    /// <summary>
+    /// 鎵樼洏绫诲瀷
+    /// </summary>
+    public enum TrayTypeEnum
+    {
+        /// <summary>
+        /// 灏忔墭鐩�
+        /// </summary>
+        SmallTray,
+        /// <summary>
+        /// 澶ф墭鐩�
+        /// </summary>
+        LargeTray,
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
index e8934a1..f28587f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/DomainModels/Taskinfo/dt_agvtask.cs"
@@ -33,7 +33,7 @@
         [MaxLength(50)]
         [Column(TypeName = "nvarchar(50)")]
         [Editable(true)]
-        [Required(AllowEmptyStrings = false)]
+        //[Required(AllowEmptyStrings = false)]
         public string agv_tasknum { get; set; }
 
         /// <summary>
@@ -81,7 +81,7 @@
         [MaxLength(20)]
         [Column(TypeName = "nvarchar(20)")]
         [Editable(true)]
-        [Required(AllowEmptyStrings = false)]
+        //[Required(AllowEmptyStrings = false)]
         public string agv_taskstate { get; set; }
 
         /// <summary>
@@ -134,7 +134,7 @@
         [Display(Name = "鍒涘缓鏃堕棿")]
         [Column(TypeName = "datetime")]
         [Editable(true)]
-        [Required(AllowEmptyStrings = false)]
+        //[Required(AllowEmptyStrings = false)]
         public DateTime agv_createtime { get; set; }
 
         /// <summary>
@@ -157,8 +157,8 @@
         ///浠诲姟绫诲瀷
         /// </summary>
         [Display(Name = "浠诲姟绫诲瀷")]
-        [MaxLength(20)]
-        [Column(TypeName = "nvarchar(20)")]
+        [MaxLength(50)]
+        [Column(TypeName = "nvarchar(50)")]
         [Editable(true)]
         //[Required(AllowEmptyStrings = false)]
         public string agv_tasktype { get; set; }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs"
index a236cdb..9782528 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_Entity/ToAGV/RequestTask.cs"
@@ -65,6 +65,122 @@
         #endregion
     }
     /// <summary>
+    /// 璧风偣浠诲姟涓嬪彂淇℃伅
+    /// </summary>
+    public class RequestFromTask
+    {
+        /// <summary>
+        /// 浣滀笟浠诲姟鍙�
+        /// </summary>
+        public string TASK_NO { get; set; }
+        /// <summary>
+        /// 璧风偣
+        /// </summary>
+        public string FROM_POSITION { get; set; }
+        /// <summary>
+        /// 缁堢偣
+        /// </summary>
+        //public string TO_POSITION { get; set; }
+        /// <summary>
+        /// 浠诲姟绛夌骇
+        /// </summary>
+        public int? Grade { get; set; } = 0;
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        public int Quantity { get; set; }
+
+        ///<summary>
+        /// 杞繍鎵樼洏鏃讹紝璧风偣搴曢儴鍑犱釜鎵樼洏锛屽叆鍫嗗彔瀹屽叏閮ㄨ浆杩愬垯涓�0锛屽鏋滆浆杩愪簲灞備笂鐨勪竴涓垯涓�4锛屼笂闈㈡暟閲忓垯涓�1
+        ///</summary>
+        public int StarQuantity { get; set; }
+
+        ///<summary>
+        /// 杞繍鎵樼洏鏃讹紝缁堢偣搴曢儴鍑犱釜鎵樼洏锛屽叆鍫嗗彔瀹屽叏閮ㄨ浆杩愬垯涓�0锛屽鏋滆浆杩愪簲灞備笂鐨勪竴涓垯涓�4锛屼笂闈㈡暟閲忓垯涓�1
+        ///</summary>
+        public int EndQuantity { get; set; }
+        /// <summary>
+        /// 鎵樼洏绫诲瀷 1灏忔墭鐩橈紝2澶ф墭鐩�
+        /// </summary>
+        public int TrayType { get; set; }
+        /// <summary>
+        /// 浠诲姟绫诲瀷 1杞繍杞﹁疆浠诲姟锛�2杞繍绌烘墭鐩樹换鍔�
+        /// </summary>
+        public int TaskType { get; set; }
+        /// <summary>
+        /// 鐗╂枡淇℃伅
+        /// </summary>
+        public string Material { get; set; }
+        #region 杞﹁疆鏁版嵁
+        public float A { get; set; }
+        public float B { get; set; }
+        public float C { get; set; }
+        public float D { get; set; }
+        public float E { get; set; }
+        public float F { get; set; }
+        public float G { get; set; }
+        public float H { get; set; }
+        #endregion
+    }
+    /// <summary>
+    /// 缁堢偣浠诲姟涓嬪彂淇℃伅
+    /// </summary>
+    public class RequestToaddTask
+    {
+        /// <summary>
+        /// 浣滀笟浠诲姟鍙�
+        /// </summary>
+        public string TASK_NO { get; set; }
+        /// <summary>
+        /// 璧风偣
+        /// </summary>
+        //public string FROM_POSITION { get; set; }
+        /// <summary>
+        /// 缁堢偣
+        /// </summary>
+        public string TO_POSITION { get; set; }
+        /// <summary>
+        /// 浠诲姟绛夌骇
+        /// </summary>
+        public int? Grade { get; set; } = 0;
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        public int Quantity { get; set; }
+
+        ///<summary>
+        /// 杞繍鎵樼洏鏃讹紝璧风偣搴曢儴鍑犱釜鎵樼洏锛屽叆鍫嗗彔瀹屽叏閮ㄨ浆杩愬垯涓�0锛屽鏋滆浆杩愪簲灞備笂鐨勪竴涓垯涓�4锛屼笂闈㈡暟閲忓垯涓�1
+        ///</summary>
+        public int StarQuantity { get; set; }
+
+        ///<summary>
+        /// 杞繍鎵樼洏鏃讹紝缁堢偣搴曢儴鍑犱釜鎵樼洏锛屽叆鍫嗗彔瀹屽叏閮ㄨ浆杩愬垯涓�0锛屽鏋滆浆杩愪簲灞備笂鐨勪竴涓垯涓�4锛屼笂闈㈡暟閲忓垯涓�1
+        ///</summary>
+        public int EndQuantity { get; set; }
+        /// <summary>
+        /// 鎵樼洏绫诲瀷 1灏忔墭鐩橈紝2澶ф墭鐩�
+        /// </summary>
+        public int TrayType { get; set; }
+        /// <summary>
+        /// 浠诲姟绫诲瀷 1杞繍杞﹁疆浠诲姟锛�2杞繍绌烘墭鐩樹换鍔�
+        /// </summary>
+        public int TaskType { get; set; }
+        /// <summary>
+        /// 鐗╂枡淇℃伅
+        /// </summary>
+        public string Material { get; set; }
+        #region 杞﹁疆鏁版嵁
+        public float A { get; set; }
+        public float B { get; set; }
+        public float C { get; set; }
+        public float D { get; set; }
+        public float E { get; set; }
+        public float F { get; set; }
+        public float G { get; set; }
+        public float H { get; set; }
+        #endregion
+    }
+    /// <summary>
     /// AGV鍙嶉淇℃伅
     /// </summary>
     public class Respone
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
index a5a9f3f..e55620e 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/AGVServer.cs"
@@ -25,23 +25,24 @@
         /// </summary>
         public static void SendAgvTask()
         {
-            WriteLog.Write_Log("鑷姩涓嬪彂浠诲姟", "SendAgvTask","");
+            WriteLog.Write_Log("鑷姩涓嬪彂浠诲姟", "SendAgvTask", "");
             Respone respone = new Respone();
             RequestTask requestTask = new RequestTask();
             string postJson = string.Empty;
             string report = string.Empty;
-            try
+
+            VOLContext Context = new VOLContext();
+            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+            var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
+                    .ThenBy(x => x.agv_createtime).ToList();
+            if (agv_tasks.Count < 1)
+                agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
+                    .ThenBy(x => x.agv_createtime).ToList();
+            if (agv_tasks.Count > 0)
             {
-                VOLContext Context = new VOLContext();
-                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
-                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
-                        .ThenBy(x => x.agv_createtime).ToList();
-                if (agv_tasks.Count < 1)
-                    agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == "Create" && !string.IsNullOrEmpty(x.agv_remark)).OrderByDescending(x => x.agv_grade)
-                        .ThenBy(x => x.agv_createtime).ToList();
-                if (agv_tasks.Count > 0)
+                foreach (var agv_task in agv_tasks)
                 {
-                    foreach (var agv_task in agv_tasks)
+                    try
                     {
                         var Materiel = QueryData.QueryMateriel(agv_task.agv_materielid);//鏌ユ壘杞﹁疆鏁版嵁
                         var Materiel1 = QueryData.QueryMateriel1(agv_task.agv_materielid);//鏌ユ壘杞﹁疆鏁版嵁
@@ -75,32 +76,34 @@
                             requestTask.H = Materiel == null ? Materiel1.h : Materiel.h;
                         }
                         postJson = JsonConvert.SerializeObject(requestTask);
-                        report = Request.RequestData(postJson, "http://192.168.12.204:5000/api/TaskCreat/CreatTask");
-                        respone = JsonConvert.DeserializeObject<Respone>(report);
-                        if (respone.Success)
-                        {
-                            agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
-                            agv_task.agv_realesstime = DateTime.Now;
-                            agvtaskRepository.Update(agv_task, true);
-                            WriteWMSLog.LogAdd(requestTask.TASK_NO, "鎴愬姛 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
-                        }
-                        else
-                        {
-                            agv_task.agv_remark = respone.Msg;
-                            var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists
-                            if (task == null)
-                                agvtaskRepository.Update(agv_task, true);
-                            WriteWMSLog.LogAdd(requestTask.TASK_NO, "澶辫触 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
-                        }
+                        //report = Request.RequestData(postJson, AGVAPIAddress.IPAddress_AGVTask);//"http://192.168.12.204:5000/api/TaskCreat/CreatTask"
+                        RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVTask);
+                        //respone = JsonConvert.DeserializeObject<Respone>(report);
+                        //if (respone.Success)
+                        //{
+                        //    agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
+                        //    agv_task.agv_realesstime = DateTime.Now;
+                        //    agvtaskRepository.Update(agv_task, true);
+                        //    WriteWMSLog.LogAdd(requestTask.TASK_NO, "鎴愬姛 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+                        //}
+                        //else
+                        //{
+                        //    agv_task.agv_remark = respone.Msg;
+                        //    var task = agvtaskRepository.Find(x => x.agv_tasknum == agv_task.agv_tasknum && x.agv_remark == agv_task.agv_remark).FirstOrDefault();//.Exists
+                        //    if (task == null)
+                        //        agvtaskRepository.Update(agv_task, true);
+                        //    WriteWMSLog.LogAdd(requestTask.TASK_NO, "澶辫触 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+                        //}
+                    }
+                    catch (Exception ex)
+                    {
+                        respone.Success = false;
+                        respone.Msg = ex.Message;
+                        WriteWMSLog.LogAdd(requestTask.TASK_NO, "澶辫触", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
                     }
                 }
             }
-            catch (Exception ex)
-            {
-                respone.Success = false;
-                respone.Msg = ex.Message;
-                WriteWMSLog.LogAdd(requestTask.TASK_NO, "澶辫触", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
-            }
+
         }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
new file mode 100644
index 0000000..ea0743b
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/EmptyPalletTask.cs"
@@ -0,0 +1,109 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WCS.JobsPart.Common;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static System.Collections.Specialized.BitVector32;
+
+namespace WIDESEA_WMS.Common
+{
+    public partial class AGVServer
+    {
+        /// <summary>
+        /// 鏇存柊鍙栫┖鎵橀槦鍒椾换鍔�
+        /// </summary>
+        public static void UpdateEmptyPalletTask()
+        {
+            string tasknum = "";
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+
+                #region 鍙犵洏鍖烘弧5涓叆搴� 闇�浼樺寲
+                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.enable).ToList();
+                var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5).FirstOrDefault();
+                if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
+                //EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0&&x.lastUpdateTime.).FirstOrDefault();//鏃堕棿瓒呰繃6灏忔椂鍏ュ簱
+                #endregion
+
+                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
+                foreach (var agv_task in agv_tasks)
+                {
+                    try
+                    {
+                        tasknum = agv_task.agv_tasknum;
+                        #region MyRegion
+                        //var task = agvtaskRepository.Find(x => (x.agv_toaddress.Contains("W") || x.agv_toaddress.Contains("X")) && x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+                        //if (task != null)
+                        //{
+                        //    task.agv_fromaddress = station.stationCode;
+                        //    task.StarQuantity = 0;
+                        //    task.agv_taskstate = "Create";
+                        //    if (station.stationCode.Contains("S0100100"))
+                        //        task.agv_grade = 3;
+                        //    agvtaskService.Update(task, true);
+                        //    station.location_state = LocationStateEnum.Busy.ToString();
+                        //    stationinfoRepository.Update(station, true);
+                        //    WriteDBLog.Success("鏇存柊琛ョ┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿task.agv_tasknum}锛屾墭鐩樹俊鍙�:{PalletSignal},璐х墿淇″彿:{MaterialSignal}", "WMS");
+                        //    return;
+                        //}
+                        #endregion
+                        #region MyRegion
+                        //dt_stationinfo EmptyStation = null;
+                        //#region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
+                        //if (agv_task.agv_fromaddress.Contains("S"))
+                        //{
+                        //    //var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
+                        //    EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
+                        //    if (EmptyStation == null)
+                        //        EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
+                        //    if (EmptyStation == null)
+                        //    {
+                        //        EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
+                        //        if (EmptyD != null) EmptyTray.CreateEmptyTrayIn(stationinfoRepository, EmptyD);
+                        //    }
+                        //}
+                        //#endregion
+                        //else
+                        //{
+                        //    EmptyStation = GetStation.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
+                        //}
+
+                        #endregion
+
+                        var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task);
+                        if (EmptyStation != null)
+                        {
+                            agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
+                            agv_task.EndQuantity = EmptyStation.quantity;
+                            agv_task.agv_toaddress = EmptyStation.stationCode;
+                            agvtaskRepository.Update(agv_task, true);
+                            EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                            stationinfoRepository.Update(EmptyStation, true);
+                            WriteDBLog.Success("鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "WMS");
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"{tasknum}锛涢敊璇俊鎭細{ex.Message}");
+                    }
+
+                }
+            }
+            catch (Exception ex)
+            {
+                WriteLog.Write_Log("鎶ラ敊鏃ュ織", "鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", "閿欒淇℃伅锛�", $"{tasknum}锛涢敊璇俊鎭細{ex.Message}");
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
index 671fc19..9d475f9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/HandleTask.cs"
@@ -164,11 +164,10 @@
         {
             VOLContext context = new VOLContext();
             Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
-            var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress);
-            var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress);
 
             if (task.agv_taskstate == AGVTaskStateEnum.Complete1.ToString())
             {
+            var station2 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_toaddress);
                 ////绌烘墭浠诲姟闇�淇敼閫昏緫
                 if (station2.stationCode.Contains("X"))
                     station2.quantity = 0;// task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 0 : task.agv_qty; //task.agv_qty;
@@ -188,6 +187,7 @@
             }
             else if (task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
             {
+            var station1 = stationinfoRepository.FindFirst(t => t.stationCode == task.agv_fromaddress);
                 #region MyRegion
                 //if (station1.stationCode.Contains("S"))
                 //    station1.quantity = 0;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs"
new file mode 100644
index 0000000..e09a3e4
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/Request.cs"
@@ -0,0 +1,46 @@
+锘縰sing Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Common;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_Entity.ToAGV;
+using WIDESEA_WMS.IRepositories;
+
+namespace WIDESEA_WMS.Common
+{
+    public partial class AGVServer
+    {
+        /// <summary>
+        /// 鍚慉GV璇锋眰
+        /// </summary>
+        public static Respone RequestAGV(Idt_agvtaskRepository agvtaskRepository, dt_agvtask agv_task, string postJson, string IP)
+        {
+            var report = Request.RequestData(postJson, IP);
+            var respone = JsonConvert.DeserializeObject<Respone>(report);
+            if (respone.Success)
+            {
+                if (agv_task.agv_taskstate != AGVTaskStateEnum.Complete.ToString())
+                    agv_task.agv_taskstate = AGVTaskStateEnum.SendOut.ToString();
+                if (agv_task.agv_taskstate == AGVTaskStateEnum.Complete.ToString())
+                    agv_task.agv_completeBeginTime = DateTime.Now;
+                else
+                    agv_task.agv_realesstime = DateTime.Now;
+                agvtaskRepository.Update(agv_task, true);
+                WriteWMSLog.LogAdd(agv_task.agv_tasknum, "鎴愬姛 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+            }
+            else
+            {
+                if (agv_task.agv_remark != respone.Msg)
+                    agv_task.agv_remark = respone.Msg;
+                agvtaskRepository.Update(agv_task, true);
+                WriteWMSLog.LogAdd(agv_task.agv_tasknum, "澶辫触 ", "AGV", "WMS", postJson, report, "涓嬪彂AGV浠诲姟", "SendAGVTask", respone.Msg);
+            }
+            return respone;
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
new file mode 100644
index 0000000..f767587
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendFromaddress.cs"
@@ -0,0 +1,60 @@
+锘縰sing Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.ToAGV;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+
+namespace WIDESEA_WMS.Common
+{
+    public partial class AGVServer
+    {
+        /// <summary>
+        /// 涓嬪彂璧风偣浠诲姟
+        /// </summary>
+        public static void SendFromaddress()
+        {
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+                RequestFromTask requestFromTask = new RequestFromTask();
+                var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
+                foreach (var agv_task in agv_tasks)
+                {
+                    try
+                    {
+                        requestFromTask.TASK_NO = agv_task.agv_tasknum;
+                        requestFromTask.FROM_POSITION = agv_task.agv_fromaddress;
+                        requestFromTask.Material = agv_task.agv_materielid;
+                        requestFromTask.Grade = agv_task.agv_grade;
+                        requestFromTask.Quantity = agv_task.agv_qty;
+                        requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
+                        requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
+                        #region 缁�/鎷嗙┖鐩樹换鍔¢渶澶勭悊
+                        requestFromTask.StarQuantity = agv_task.StarQuantity;
+                        requestFromTask.EndQuantity = agv_task.EndQuantity;
+                        #endregion
+                        var postJson = JsonConvert.SerializeObject(requestFromTask);
+                        RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVFromaddTask);
+                    }
+                    catch (Exception ex)
+                    {
+
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
new file mode 100644
index 0000000..68ad08c
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/SendToaddress.cs"
@@ -0,0 +1,108 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm;
+using WIDESEA_Common;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.ToAGV;
+using WIDESEA_WCS.JobsPart.Common;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+
+namespace WIDESEA_WMS.Common
+{
+    public partial class AGVServer
+    {
+        /// <summary>
+        /// 涓嬪彂缁堢偣浠诲姟
+        /// </summary>
+        public static void SendToaddress()
+        {
+            VOLContext Context = new VOLContext();
+            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+            Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+            RequestToaddTask requestFromTask = new RequestToaddTask();
+            var agv_tasks = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Complete.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && string.IsNullOrEmpty(x.agv_toaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).ToList();
+            foreach (var agv_task in agv_tasks)
+            {
+                try
+                {
+                    #region 鏌ユ壘婊¤冻鏉′欢鐨勮ˉ绌烘墭浠诲姟
+                    var task = agvtaskRepository.Find(x => x.agv_taskstate == AGVTaskStateEnum.Queue.ToString() && x.agv_tasktype == AGVTaskTypeEnum.TaskType_EmptyPallet.ToString() && x.agv_Traytype == agv_task.agv_Traytype && string.IsNullOrEmpty(x.agv_fromaddress)).OrderByDescending(x => x.agv_grade).ThenBy(x => x.agv_createtime).FirstOrDefault();
+                    if (task != null)
+                    {
+                        requestFromTask.TASK_NO = agv_task.agv_tasknum;
+                        requestFromTask.TO_POSITION = task.agv_toaddress;
+                        requestFromTask.Material = agv_task.agv_materielid;
+                        requestFromTask.Grade = agv_task.agv_grade;
+                        requestFromTask.Quantity = agv_task.agv_qty;
+                        requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
+                        requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
+                        #region 缁�/鎷嗙┖鐩樹换鍔¢渶澶勭悊
+                        requestFromTask.StarQuantity = agv_task.StarQuantity;
+                        requestFromTask.EndQuantity = task.EndQuantity;
+                        #endregion
+                        var postJson = JsonConvert.SerializeObject(requestFromTask);
+                        var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
+                        if (respone.Success)
+                        {
+                            agv_task.EndQuantity = task.EndQuantity;
+                            agv_task.agv_toaddress = task.agv_toaddress;
+                            agvtaskRepository.Update(agv_task, true);
+                            agvtaskRepository.Delete(task, true);
+                        }
+                        else
+                            throw new Exception(respone.Msg);
+                        WriteDBLog.Success("鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "WMS");
+                    }
+                    #endregion
+                    else
+                    {
+                        #region 鏌ユ壘婊¤冻浠诲姟鏉′欢鐨勫湴鍧�
+                        var EmptyStation = EmptyTray.GetEmptyTrayStation(stationinfoRepository, agv_task);
+                        if (EmptyStation != null)
+                        {
+                            //agv_task.agv_taskstate = AGVTaskStateEnum.Create.ToString();
+                            //agvtaskRepository.Update(agv_task, true);//鏌ョ湅AGV浠诲姟鏁版嵁鏄惁鍦ㄥ彟涓�涓柟娉曞唴杩涜浜嗘暟鎹洿鏂�
+
+                            requestFromTask.TASK_NO = agv_task.agv_tasknum;
+                            requestFromTask.TO_POSITION = EmptyStation.stationCode;
+                            requestFromTask.Material = agv_task.agv_materielid;
+                            requestFromTask.Grade = agv_task.agv_grade;
+                            requestFromTask.Quantity = agv_task.agv_qty;
+                            requestFromTask.TrayType = agv_task.agv_Traytype.Contains("Small") ? 1 : 2;
+                            requestFromTask.TaskType = agv_task.agv_tasktype.Contains("TaskType_EmptyPallet") ? 2 : 1;
+                            #region 缁�/鎷嗙┖鐩樹换鍔¢渶澶勭悊
+                            requestFromTask.StarQuantity = agv_task.StarQuantity;
+                            requestFromTask.EndQuantity = EmptyStation.quantity;
+                            #endregion
+                            var postJson = JsonConvert.SerializeObject(requestFromTask);
+                            var respone = RequestAGV(agvtaskRepository, agv_task, postJson, AGVAPIAddress.IPAddress_AGVToaddTask);
+                            if (respone.Success)
+                            {
+                                agv_task.EndQuantity = EmptyStation.quantity;
+                                agv_task.agv_toaddress = EmptyStation.stationCode;
+                                agvtaskRepository.Update(agv_task, true);
+                                EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                                stationinfoRepository.Update(EmptyStation, true);
+                            }
+                            else
+                                throw new Exception(respone.Msg);
+                            WriteDBLog.Success("鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}", "WMS");
+                        }
+                        #endregion
+                    }
+                }
+                catch (Exception ex)
+                {
+                    WriteDBLog.Error("鏇存柊鑷姩鍙栫┖鎵橀槦鍒椾换鍔�", $"浠诲姟缂栧彿锛歿agv_task.agv_tasknum}锛涢敊璇俊鎭細{ex.Message}", "WMS");
+                }
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs"
new file mode 100644
index 0000000..1a9b536
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/AGVTask/UploadMesInfo/AGVAPIAddress.cs"
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_WMS.Common
+{
+    public class AGVAPIAddress
+    {
+        /// <summary>
+        /// 瀹屾暣AGV浠诲姟涓嬪彂鍦板潃
+        /// </summary>
+        public const string IPAddress_AGVTask = "http://192.168.12.204:5000/api/TaskCreat/CreatTask";
+        /// <summary>
+        /// AGV璧风偣浠诲姟涓嬪彂鍦板潃
+        /// </summary>
+        public const string IPAddress_AGVFromaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatGetPalletTask";
+        /// <summary>
+        /// AGV缁堢偣浠诲姟涓嬪彂鍦板潃
+        /// </summary>
+        public const string IPAddress_AGVToaddTask = "http://192.168.12.204:5000/api/TaskCreat/CreatPutPalletTask";
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
new file mode 100644
index 0000000..93cdff5
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyPalletStation.cs"
@@ -0,0 +1,282 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+using static System.Collections.Specialized.BitVector32;
+
+namespace WIDESEA_WCS.JobsPart.Common
+{
+    public class GetStation
+    {
+        /// <summary>
+        /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ叆搴撳崰鐢�
+        /// true锛氭槸 false锛氬惁
+        /// </summary>
+        /// <param name="StationCode"></param>
+        /// <returns></returns>
+        public static bool InBusyStation(string StationCode)
+        {
+            bool OK = false;
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+                var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+                OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.InBusy.ToString()).Any();
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return OK;
+        }
+        /// <summary>
+        /// 褰撳墠搴撲綅鍚屼竴琛屾槸鍚﹀瓨鍦ㄥ嚭搴撳崰鐢�
+        /// true锛氭槸 false锛氬惁
+        /// </summary>
+        /// <param name="StationCode"></param>
+        /// <returns></returns>
+        public static bool OutBusyStation(string StationCode)
+        {
+            bool OK = false;
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+                var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+                OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.location_state == LocationStateEnum.OutBusy.ToString()).Any();
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return OK;
+        }
+        /// <summary>
+        /// 褰撳墠搴撲綅澶栬竟鐨勮揣浣嶆槸鍚﹂兘涓虹┖
+        /// true锛氬惁 false锛氭槸
+        /// </summary>
+        /// <param name="StationCode"></param>
+        /// <returns></returns>
+        public static bool QueueStation(string StationCode)
+        {
+            bool OK = false;
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+                var station = stationinfoRepository.Find(x => x.stationCode == StationCode).FirstOrDefault();
+                if (station.area == "10" || station.area == "11")
+                {
+                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column < station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                }
+                else
+                {
+                    OK = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return OK;
+        }
+        /// <summary>
+        /// 鎵惧彲鍏ュ簱绌烘墭浣�
+        /// </summary>
+        public static void EmptyStation()
+        {
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+                Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+                var Stations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity == 5 && x.enable).ToList();
+                foreach (var Station in Stations)
+                {
+                    var area = Station.tray_type == "SmallTray" ? "11" : "10";
+                }
+            }
+            catch (Exception ex)
+            {
+
+            }
+        }
+        /// <summary>
+        /// 鏌ユ壘褰撳墠琛屽彲鍏ュ簱绌鸿揣浣�
+        /// </summary>
+        /// <param name="EmptyStation"></param>
+        /// <param name="stationinfoRepository"></param>
+        /// <returns></returns>
+        public static dt_stationinfo Station(dt_stationinfo EmptyStation, Idt_stationinfoRepository stationinfoRepository)
+        {
+            dt_stationinfo stationinfo = null;
+            try
+            {
+                if (stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state.Contains("Busy")).Any()) return stationinfo;
+
+
+                stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.quantity > 0 && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+                if (stationinfo != null)
+                    if (stationinfo.quantity < 5) return stationinfo;
+
+                stationinfo = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderBy(x => x.column).FirstOrDefault();
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return stationinfo;
+        }
+
+        /// <summary>
+        /// 绌烘墭鍙叆搴撹揣浣�
+        /// </summary>
+        /// <param name="area"></param>
+        /// <returns></returns>
+        public static dt_stationinfo EmptyPalletStation1(string area)
+        {
+            dt_stationinfo stationinfo = null;
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+
+                #region 鏌ユ壘AB搴撳彲鍏ョ┖鎵樼┖璐т綅
+                if (area == "11" && stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any())
+                {
+                    #region MyRegion
+                    var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3") && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.area).ThenByDescending(x => x.line).ThenByDescending(x => x.column).FirstOrDefault();
+                    #endregion
+
+                    #region 鏌ユ壘搴撳尯2鍜屽簱鍖�3鐨勭┖鎵樿揣浣�
+                    //var EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && (x.area == "2" || x.area == "3")
+                    //   && x.tray_status == TrayStateEnum.EmptyTray.ToString() && x.enable).OrderByDescending(x => x.lastUpdateTime).FirstOrDefault();
+
+                    if (EmptyStation != null)
+                    {
+                        stationinfo = Station(EmptyStation, stationinfoRepository);
+                        if (stationinfo != null)
+                            if (!QueueStation(stationinfo.stationCode)) return stationinfo;
+
+                        EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+                        if (EmptyStation.quantity != 5) return null;
+                    }
+                    #endregion
+
+                    #region 鏈壘鍒扮┖鎵樿揣浣嶆垨褰撳墠琛屽凡婊�,瀵绘壘鏂扮殑涓�琛�
+                    stationinfo = stationinfoRepository.Find(x => x.column == 2 && x.area == "3" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault();
+                    if (stationinfo == null)
+                        stationinfo = stationinfoRepository.Find(x => x.column == 1 && x.area == "2" && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.line).FirstOrDefault();
+                    #endregion
+                }
+                #endregion
+
+                #region 鏌ユ壘绌烘墭搴撳尯
+                else
+                {
+                    if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo;
+                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault();
+                    if (stationinfo != null)
+                        if (!QueueStation(stationinfo.stationCode) && stationinfo.quantity < 5) return stationinfo;
+                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+
+                }
+                #endregion
+
+                #region 鏌ョ湅褰撳墠绌鸿揣浣嶅悗鏄惁瀛樺湪鏈夋枡
+                if (stationinfo != null)
+                    if (GetStation.QueueStation(stationinfo.stationCode)) stationinfo = null;
+                #endregion
+
+                #region 鍒ゆ柇褰撳墠璐т綅鏄惁瀛樺湪浠诲姟
+                if (stationinfo != null)
+                    if (agvtaskService.Find(x => x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
+                #endregion
+
+            }
+            catch (Exception ex)
+            {
+                throw;
+            }
+            return stationinfo;
+        }
+        /// <summary>
+        /// 绌烘墭鍙叆搴撹揣浣�
+        /// </summary>
+        /// <param name="area"></param>
+        /// <returns></returns>
+        public static dt_stationinfo EmptyPalletStation(string area)
+        {
+            dt_stationinfo stationinfo = null;
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_agvtaskRepository agvtaskService = new dt_agvtaskRepository(Context);
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+
+                #region 鏌ユ壘绌烘墭鐩樺簱鍖�
+                if (stationinfoRepository.Find(x => x.stationCode == "A01001001" && x.quantity == 5 && x.location_state == LocationStateEnum.Stroge.ToString()).Any())
+                {
+                    var EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01005002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
+                    if (EmptyStation != null)
+                    {
+                        if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any())
+                            return EmptyStation;
+                    }
+                    EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01005002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+
+
+                    if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository);
+                    if (stationinfo != null) return stationinfo;
+
+                    EmptyStation = stationinfoRepository.Find(x => x.area == EmptyStation.area && x.line == EmptyStation.line && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+
+                    if (EmptyStation.quantity == 5)
+                    {
+                        EmptyStation = stationinfoRepository.Find(x => x.stationCode == "C01004002" && x.location_state == LocationStateEnum.Empty.ToString()).FirstOrDefault();
+                        if (EmptyStation != null)
+                        {
+                            if (!stationinfoRepository.Find(x => x.line == EmptyStation.line && x.area == EmptyStation.area && x.location_state != LocationStateEnum.Empty.ToString()).Any())
+                                return EmptyStation;
+                        }
+
+                        EmptyStation = stationinfoRepository.Find(x => x.quantity > 0 && x.stationCode == "C01004002" && x.location_state == "Stroge" && x.tray_status == "EmptyTray" && x.enable).FirstOrDefault();
+                        if (EmptyStation != null) stationinfo = Station(EmptyStation, stationinfoRepository);
+                    }
+
+                }
+                else
+                {
+                    if (stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Busy.ToString()).Any()) return stationinfo;
+                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.quantity > 0 && x.enable).OrderBy(x => x.column).FirstOrDefault();
+                    if (stationinfo != null)
+                        if (stationinfo.quantity < 5) return stationinfo;
+                    stationinfo = stationinfoRepository.Find(x => x.area == area && x.location_state == LocationStateEnum.Empty.ToString() && x.enable).OrderByDescending(x => x.column).FirstOrDefault();
+
+                }
+                #endregion
+
+                #region 鍒ゆ柇褰撳墠璐т綅鏄惁瀛樺湪浠诲姟
+                if (stationinfo != null)
+                    if (agvtaskService.Find(x => /*x.agv_fromaddress == stationinfo.stationCode ||*/ x.agv_toaddress == stationinfo.stationCode).Any()) stationinfo = null;
+                #endregion
+
+            }
+            catch (Exception ex)
+            {
+                throw;
+            }
+            return stationinfo;
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
new file mode 100644
index 0000000..8c7b8b2
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/GetStation/EmptyTrayIn.cs"
@@ -0,0 +1,116 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Comm.LogInfo;
+using WIDESEA_Comm.TaskNo;
+using WIDESEA_Comm;
+using WIDESEA_Core.EFDbContext;
+using WIDESEA_Entity.DomainModels;
+using WIDESEA_WMS.IRepositories;
+using WIDESEA_WMS.Repositories;
+
+namespace WIDESEA_WCS.JobsPart.Common
+{
+    public class EmptyTray
+    {
+        /// <summary>
+        /// 绌烘墭鍙犵洏鍏ュ簱
+        /// </summary>
+        public static void EmptyTrayIn()
+        {
+            try
+            {
+                VOLContext Context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
+                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity == 5 && x.enable).ToList();
+                foreach (var EmptyStation in EmptyStations)
+                {
+                    CreateEmptyTrayIn(stationinfoRepository, EmptyStation);
+                }
+            }
+            catch (Exception ex)
+            {
+                WriteDBLog.Success("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+            }
+        }
+        /// <summary>
+        /// 鑾峰彇鍙叆绌烘墭璐т綅
+        /// </summary>
+        public static dt_stationinfo GetEmptyTrayStation(Idt_stationinfoRepository stationinfoRepository,dt_agvtask agv_task)
+        {
+            dt_stationinfo EmptyStation = null;
+            #region 妫�娴嬩笂鏂欑殑绌烘墭鍙犵洏
+            if (agv_task.agv_fromaddress.Contains("S"))
+            {
+                var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
+                EmptyStation = EmptyStations.Where(x => x.tray_type == agv_task.agv_Traytype && x.quantity < 5 && x.location_state == LocationStateEnum.Stroge.ToString()).FirstOrDefault();
+                if (EmptyStation == null)
+                    EmptyStation = EmptyStations.Where(x => x.location_state == LocationStateEnum.Empty.ToString() && x.quantity == 0).FirstOrDefault();
+                if (EmptyStation == null)
+                {
+                    var EmptyD = EmptyStations.Where(x => x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderByDescending(x => x.quantity).FirstOrDefault();
+                    if (EmptyD != null) CreateEmptyTrayIn(stationinfoRepository, EmptyD);
+                }
+            }
+            #endregion
+            else
+            {
+                EmptyStation = GetStation.EmptyPalletStation1(agv_task.agv_Traytype == "SmallTray" ? "11" : "10");
+            }
+            return EmptyStation;
+        }
+        /// <summary>
+        /// 鍒涘缓绌烘墭鍙犵洏鍏ュ簱浠诲姟
+        /// </summary>
+        /// <param name="stationinfoRepository"></param>
+        /// <param name="EmptyStation"></param>
+        public static void CreateEmptyTrayIn(Idt_stationinfoRepository stationinfoRepository, dt_stationinfo EmptyStation)
+        {
+            VOLContext Context = new VOLContext();
+            Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(Context);
+            try
+            {
+                if (agvtaskRepository.Find(x => x.agv_fromaddress == EmptyStation.stationCode || x.agv_toaddress == EmptyStation.stationCode).Any()) return;
+                var area = EmptyStation.tray_type == "SmallTray" ? "11" : "10";
+                var toEmptyStation = GetStation.EmptyPalletStation1(area);
+                if (toEmptyStation != null)
+                {
+                    #region 鍚屼竴涓┖鎵樹綅鍙兘鍚屾椂鐢熸垚涓�涓┖鎵樹换鍔�
+                    if (agvtaskRepository.Find(x => x.agv_fromaddress == toEmptyStation.stationCode || x.agv_toaddress == toEmptyStation.stationCode).Any()) return;
+                    #endregion
+
+                    dt_agvtask agvtask = new dt_agvtask()
+                    {
+                        agv_fromaddress = EmptyStation.stationCode,
+                        agv_id = Guid.NewGuid(),
+                        agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                        agv_grade = 3,
+                        agv_createtime = DateTime.Now,
+                        agv_taskstate = "Create",
+                        //agv_materielid = station.stationType,
+                        agv_qty = EmptyStation.quantity - toEmptyStation.quantity,
+                        StarQuantity = toEmptyStation.quantity,
+                        EndQuantity = toEmptyStation.quantity,
+                        agv_tasktype = "TaskType_EmptyPallet",
+                        agv_toaddress = toEmptyStation.stationCode,
+                        agv_userid = "绯荤粺",
+                        agv_TrayStatus = "EmptyTray",//station.tray_status,
+                        agv_Traytype = EmptyStation.tray_type,
+                    };
+                    agvtaskRepository.Add(agvtask, true);
+                    EmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                    stationinfoRepository.Update(EmptyStation, true);
+                    toEmptyStation.location_state = LocationStateEnum.Busy.ToString();
+                    stationinfoRepository.Update(toEmptyStation, true);
+                    WriteDBLog.Success("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
+                }
+            }
+            catch (Exception ex)
+            {
+                WriteDBLog.Error("鍒涘缓鍙犵洏浣嶇┖鎵樺叆搴撲换鍔�", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+            }
+        }
+    }
+}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/Taskinfo/Partial/Idt_agvtaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/Taskinfo/Partial/Idt_agvtaskService.cs"
index f56bf3e..98efc94 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/Taskinfo/Partial/Idt_agvtaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/IServices/Taskinfo/Partial/Idt_agvtaskService.cs"
@@ -5,9 +5,12 @@
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_Core.Utilities;
 using System.Linq.Expressions;
+using WIDESEA_Entity.DomainModels.Mes;
+using Microsoft.AspNetCore.Mvc;
 namespace WIDESEA_WMS.IServices
 {
     public partial interface Idt_agvtaskService
     {
+        WebResponseContent addNgTask([FromBody] MesRequestTemp request);
     }
  }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
index 8f5044e..799c98a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Services/Taskinfo/Partial/dt_agvtaskService.cs"
@@ -26,6 +26,10 @@
 using WIDESEA_Comm.LogInfo;
 using StackExchange.Redis;
 using WIDESEA_Comm;
+using WIDESEA_Entity.DomainModels.Mes;
+using WIDESEA_WMS.Common;
+using System.Reflection.Emit;
+using System.Threading.Tasks;
 
 namespace WIDESEA_WMS.Services
 {
@@ -46,7 +50,119 @@
             //澶氱鎴蜂細鐢ㄥ埌杩檌nit浠g爜锛屽叾浠栨儏鍐靛彲浠ヤ笉鐢�
             //base.Init(dbRepository);
         }
-
+        public override WebResponseContent Del(object[] keys, bool delList = true)
+        {
+            #region 鎵归噺淇敼璐т綅鐘舵��
+            //VOLContext context = new VOLContext();
+            //Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+            //var fromaddress = repository.Find(x => keys.Contains(x.agv_id)).Select(x => x.agv_fromaddress).ToList();
+            //var stations = stationinfoRepository.Find(x => fromaddress.Contains(x.stationCode)).ToList();
+            //foreach (var station in stations)
+            //{
+            //    station.location_state = LocationStateEnum.Stroge.ToString();
+            //    //station.tray_type= TrayTypeEnum.SmallTray.ToString();
+            //    //station.tray_status= TrayStateEnum.StrogeTray.ToString();
+            //}
+            //stationinfoRepository.UpdateRange(stations, x => new { x.location_state }, true); 
+            #endregion
+            VOLContext volContext = new VOLContext();
+            Idt_agvtask_htyRepository agvtask_HtyRepository=new dt_agvtask_htyRepository(volContext);
+            var agvtasks = repository.Find(x => keys.Contains(x.agv_id)).ToList();
+            List<dt_agvtask_hty> dt_Agvtask_Hties = new List<dt_agvtask_hty>();
+            foreach (var task in agvtasks)
+            {
+                dt_agvtask_hty agvtask_Hty = new dt_agvtask_hty()
+                {
+                    hty_pkid = Guid.NewGuid(),
+                    agv_id = task.agv_id,
+                    agv_tasknum = task.agv_tasknum,
+                    agv_materielid = task.agv_materielid,
+                    agv_qty = task.agv_qty,
+                    agv_createtime = task.agv_createtime,
+                    agv_realesstime = task.agv_realesstime,
+                    agv_executingBeginTime = task.agv_executingBeginTime,
+                    agv_executingEndTime = task.agv_executingEndTime,
+                    agv_completeBeginTime = task.agv_completeBeginTime,
+                    agv_finishedtime = task.agv_finishedtime,
+                    agv_taskstate = task.agv_taskstate,
+                    agv_tasktype = task.agv_tasktype,
+                    agv_fromaddress = task.agv_fromaddress,
+                    agv_toaddress = task.agv_toaddress,
+                    agv_operatetype = "Del",
+                    agv_compeletor = UserContext.Current.UserName,
+                    agv_completedate = DateTime.Now,
+                    agv_grade = task.agv_grade,
+                    agv_userid = task.agv_userid,
+                    agv_Traytype = task.agv_Traytype,
+                    agv_TrayStatus = task.agv_TrayStatus,
+                    agv_worktype = task.agv_worktype,
+                    agv_remark = task.agv_remark,
+                    bindSN = task.bindSN,
+                    jobID = task.jobID,
+                    agv_materbarcode = task.agv_materbarcode,
+                };
+                dt_Agvtask_Hties.Add(agvtask_Hty);
+            }
+            agvtask_HtyRepository.AddRange(dt_Agvtask_Hties,true);
+            return base.Del(keys, delList);
+        }
+        public WebResponseContent addNgTask(MesRequestTemp requestTemp)
+        {
+            WebResponseContent content = new WebResponseContent();
+            try
+            {
+                var fromaddress = requestTemp.from_address;
+                VOLContext context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+                IVV_Mes_WorkinfoRepository workinfoRepository = new VV_Mes_WorkinfoRepository(context);
+                var station = stationinfoRepository.Find(x => x.stationCode == fromaddress).FirstOrDefault();
+                if (_repository.Find(x => x.agv_fromaddress == fromaddress || x.agv_toaddress == fromaddress).Any())
+                    throw new Exception($"璐т綅{fromaddress}宸插瓨鍦ㄤ换鍔★紒");
+                if (station == null) throw new Exception($"鏈壘鍒拌揣浣峽fromaddress}锛�");
+                if (!station.enable) throw new Exception($"璐т綅{fromaddress}鏈惎鐢紒");
+                if (station.quantity < 1) throw new Exception($"璐т綅{fromaddress}鏃犺溅杞紒");
+                var Work = workinfoRepository.Find(x => x.workOrder == station.Number && x.processCode == "17").FirstOrDefault();
+                if (Work == null) throw new Exception($"鏈壘鍒拌揣浣峽fromaddress}鐨勬満鍔犲伐宸ュ崟淇℃伅");
+                dt_agvtask agvtask = new dt_agvtask()
+                {
+                    agv_fromaddress = station.stationCode,
+                    agv_id = Guid.NewGuid(),
+                    agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                    agv_grade = 2,
+                    agv_createtime = DateTime.Now,
+                    agv_taskstate = "Queue",
+                    agv_materielid = station.stationType,
+                    agv_qty = station.quantity,
+                    agv_tasktype = "TaskType_OutsourceInbound",
+                    agv_toaddress = "",
+                    agv_userid = UserContext.Current.UserName,
+                    bindSN = station.bindSN,
+                    agv_worktype = Convert.ToInt32(Work.processCode),
+                    agv_materbarcode = Work.materialCode,
+                    agv_Traytype = station.tray_type,
+                    jobID = station.Number,
+                    agv_TrayStatus = station.tray_status
+                };
+                _repository.Add(agvtask, true);
+                station.location_state = LocationStateEnum.InBusy.ToString();
+                stationinfoRepository.Update(station, true);
+                content.OK();
+            }
+            catch (Exception ex)
+            {
+                content.Message = ex.Message;
+            }
+            return content;
+        }
+        public override WebResponseContent Update(SaveModel saveModel)
+        {
+            WebResponseContent content = new WebResponseContent();
+            var agv_id = saveModel.MainData["agv_id"].ToString();
+            var task = _repository.Find(x => x.agv_id.ToString() == agv_id).FirstOrDefault();
+            if (task.agv_taskstate != AGVTaskStateEnum.Queue.ToString()) return content.Error("褰撳墠浠诲姟涓嶅彲鏇存敼锛�");
+            WriteDBLog.Success($"鎵嬪姩淇敼浠诲姟", new { 鏁版嵁 = saveModel }, "WMS", UserContext.Current.UserName);
+            return base.Update(saveModel);
+        }
         #region 娣诲姞NG浠诲姟
         public override WebResponseContent Add(SaveModel saveDataModel)
         {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs"
index dfc9c30..b40fa60 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/ToMes/shiftingparking.cs"
@@ -42,6 +42,8 @@
                 if (station2 == null) return content.Error("璇疯緭鍏ユ纭殑璧风偣鍦板潃锛�");
                 if (!station1.tray_type.Contains("Small") && station2.area != "4")
                     throw new Exception($"澶ф墭鐩樺彧鑳藉瓨鏀惧湪搴撳尯4锛�");
+                if (station1.tray_type.Contains("Small") && station2.area != "3" && station2.area != "2")
+                    throw new Exception($"灏忔墭鐩樺彧鑳藉瓨鏀惧湪搴撳尯2/搴撳尯3锛�");
                 if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(from_address) || x.agv_toaddress.Contains(from_address)).Any())
                     throw new Exception($"璧风偣{from_address}宸插瓨鍦ㄤ换鍔★紒");
                 if (agvtaskRepository.Find(x => x.agv_fromaddress.Contains(to_address) || x.agv_toaddress.Contains(to_address)).Any())
@@ -52,17 +54,9 @@
                     throw new Exception($"缁堢偣{to_address}涓嶆槸绌鸿揣浣嶏紒");
                 if (string.IsNullOrEmpty(station1.stationType))
                     throw new Exception($"璧风偣{from_address}鏈粦瀹氱墿鏂欑被鍨嬶紒");
-                
-                if (station2.area == "1")
-                {
-                    if (stationinfoRepository.Find(x => x.area == station2.area && x.column == station2.column && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
-                        throw new Exception($"缁堢偣{to_address}鍚屽垪瀛樺湪涓庤捣鐐圭墿鏂欑被鍨嬩笉鍖归厤锛�");
-                }
-                else
-                {
-                    if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
-                        throw new Exception($"缁堢偣{to_address}鍚岃瀛樺湪涓庤捣鐐圭墿鏂欑被鍨嬩笉鍖归厤锛�");
-                }
+
+                if (stationinfoRepository.Find(x => x.area == station2.area && x.line == station2.line && x.enable && x.location_state != LocationStateEnum.Empty.ToString() && x.stationType != station1.stationType).Any())
+                    throw new Exception($"缁堢偣{to_address}鍚岃瀛樺湪涓庤捣鐐圭墿鏂欑被鍨嬩笉鍖归厤锛�");
                 var inventory = inventoryRepository.Find(x => x.stationCode == station1.stationCode).FirstOrDefault();
                 if (inventory == null) throw new Exception($"璧风偣{from_address}鏈壘鍒板簱瀛樹俊鎭紒");
 
@@ -92,6 +86,7 @@
                 station2.location_state = LocationStateEnum.InBusy.ToString();
                 station2.heatNumber = station1.heatNumber;
                 station2.Number = station1.Number;
+                station2.billetID = station1.billetID;
                 station2.stationType = station1.stationType;
                 stationinfoRepository.Update(station2, true);
                 content.OK();
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
index 371f541..80480a7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/JobTask.cs"
@@ -12,7 +12,10 @@
         [Invoke(Begin = "2024-01-01 00:00", Interval = 1000 * 5, /*IsEnabled = true,*/ SkipWhileExecuting = true)]
         public void TaskTime()
         {
+            AGVServer.UpdateEmptyPalletTask();
             AGVServer.SendAgvTask();
+            AGVServer.SendFromaddress();
+            AGVServer.SendToaddress();
         }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_agvtaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_agvtaskController.cs"
index 34a5e3a..e451e9f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_agvtaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/Controllers/WIDESEA_WMS/Partial/dt_agvtaskController.cs"
@@ -11,6 +11,8 @@
 using Microsoft.AspNetCore.Http;
 using WIDESEA_Entity.DomainModels;
 using WIDESEA_WMS.IServices;
+using WIDESEA_Core.Utilities;
+using WIDESEA_Entity.DomainModels.Mes;
 
 namespace WIDESEA_WMS.Controllers
 {
@@ -29,5 +31,15 @@
             _service = service;
             _httpContextAccessor = httpContextAccessor;
         }
+        /// <summary>
+        /// 娣诲姞NG浠诲姟
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost, Route("addNgTask")]
+        public WebResponseContent addNgTask([FromBody] MesRequestTemp request)
+        {
+            return _service.addNgTask(request);
+        }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json"
index 9bfab82..ee645d9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WebApi/appsettings.json"
@@ -16,7 +16,8 @@
   "Connection": {
     "DBType": "MsSql", //MySql/MsSql/PgSql  //鏁版嵁搴撶被鍨嬶紝濡傛灉浣跨敤鐨勬槸sqlserver姝ゅ搴旇缃负MsSql
     //sqlserver杩炴帴瀛楃涓�
-    "DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
+    "DbConnectionString": "Data Source=192.168.12.101;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=123456;Connect Timeout=500;",
+    //"DbConnectionString": "Data Source=.;Initial Catalog=WIDESEA_DB;Persist Security Info=True;User ID=sa;Password=P@ssw0rd;Connect Timeout=500;",
 
     //mysql杩炴帴瀛楃涓�(鍗囩骇EFCore3.1鍒版椂宸插皢mysql杩炴帴瀛楃涓蹭慨鏀�,2019-12-20)
     // "DbConnectionString": " Data Source=127.0.0.1;Database=netcoredev;AllowLoadLocalInfile=true;User ID=root;Password=123456;allowPublicKeyRetrieval=true;pooling=true;CharSet=utf8;port=3306;sslmode=none;",

--
Gitblit v1.9.3