From 836a3231be910fd3e11258e18cf389594ac9b420 Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 08 七月 2024 12:51:18 +0800
Subject: [PATCH] 处理人工出库空托

---
 代码管理/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
index 6edd1a4..5a545c3 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WMS_Server/WIDESEA_WMS/Common/QueueTask/OutboundTask.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_Core.Extensions;
 using WIDESEA_Entity.DomainModels;
@@ -50,7 +51,7 @@
                             //鏌ユ壘褰撳墠璐т綅鍚岃鏄惁瀛樺湪鍏ュ簱浠诲姟
                             if (GetStation.InBusyStation(Station.stationCode)) continue;
 
-                            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();
+                            stationinfo = stationinfoRepository.Find(x => x.line == Station.line && x.area == Station.area && x.enable && x.tray_status == "StrogeTray" && 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;
@@ -122,5 +123,53 @@
                 WriteDBLog.Error("鍒涘缓鍑哄簱浠诲姟", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
             }
         }
+        /// <summary>
+        /// 澶勭悊浜哄伐鍑哄簱绌烘墭
+        /// </summary>
+        public static void Outkongtuo()
+        {
+            try
+            {
+                VOLContext context = new VOLContext();
+                Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
+                Idt_agvtaskRepository agvdb = new dt_agvtaskRepository(context);
+                var Station = stationinfoRepository.Find(x => x.tray_status == "EmptyTrayss" && x.enable && x.location_state== LocationStateEnum.Stroge.ToString() && x.quantity==1).ToList();
+                foreach (var station in Station)
+                {
+                    var EmptyStations = stationinfoRepository.Find(x => x.area == station.area && x.line == station.line && x.column > station.column && x.location_state != LocationStateEnum.Empty.ToString()).Any();
+                    if (!EmptyStations)
+                    {
+                        dt_agvtask agvtask = new dt_agvtask()
+                        {
+                            agv_fromaddress = station.stationCode,
+                            agv_id = Guid.NewGuid(),
+                            agv_tasknum = IdenxManager.GetTaskNo("KH-", "WMS"),
+                            agv_grade = 3,
+                            agv_createtime = DateTime.Now,
+                            agv_taskstate = "Queue",
+                            agv_qty = station.quantity,
+                            agv_Traytype = station.tray_type,
+                            agv_tasktype = AGVTaskTypeEnum.TaskType_EmptyPallet.ToString(),
+                            //agv_toaddress = TargetLocation.stationCode,
+                            agv_toaddress = "",
+                            agv_userid = "绯荤粺",
+                            agv_TrayStatus = "EmptyTray",
+                        };
+
+                        agvdb.Add(agvtask, true);
+
+                        station.location_state = LocationStateEnum.OutBusy.ToString();
+                        stationinfoRepository.Update(station, x => new { x.location_state }, true);
+                    }
+
+                }
+
+            }
+            catch (Exception ex)
+            {
+
+                WriteDBLog.Error("鍒涘缓浜哄伐鍑哄簱鍚庣殑绌烘墭鍑哄簱", $"閿欒淇℃伅锛歿ex.Message}", "PCS");
+            }
+        }
     }
 }

--
Gitblit v1.9.3