From c862dd0756111a4264666f7e7636a5a062cce806 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 19 四月 2024 09:11:56 +0800
Subject: [PATCH] 修改MES接口,优化托盘更换逻辑

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

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 b3837d0..a89959d 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"
@@ -57,9 +57,10 @@
                 VOLContext context = new VOLContext();
                 Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
                 Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
-                var stations = stationinfoRepository.Find(x => x.stationCode.Contains("X") && x.location_state == "Abnormal" /*LocationStateEnum.Abnormal.ToString()*/ && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray")).ToList();
+                var stations = stationinfoRepository.Find(x => (x.stationCode.Contains("X")|| x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")) && x.location_state == "Abnormal" /*LocationStateEnum.Abnormal.ToString()*/ && (x.tray_type == "SmallTray/LargeTray" || x.tray_type == "LargeTray/SmallTray") && x.enable).ToList();
                 foreach (var station in stations)
                 {
+                    if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any()) continue;
                     var types = station.tray_type.Split('/');
                     var area = types[0] == "SmallTray" ? "11" : "10";
                     //鎵�1搴撳尯鐨勭┖鎵樹綅
@@ -93,6 +94,8 @@
                             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");

--
Gitblit v1.9.3