From 56584afcaf6b4460a2393c8b812a2a9afd742a96 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 08 五月 2024 20:34:55 +0800
Subject: [PATCH] 优化代码

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 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 a89959d..da98f63 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"
@@ -54,10 +54,10 @@
         {
             try
             {
-                VOLContext context = new VOLContext();
+                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.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();
+                Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);//"Abnormal" 
+                var stations = stationinfoRepository.Find(x => (x.stationCode.Contains("X") || x.stationCode.Contains("W01001004") || x.stationCode.Contains("W01001005")) && x.location_state == 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;
@@ -99,7 +99,8 @@
                         EmptyStation.location_state = LocationStateEnum.Busy.ToString();
                         stationinfoRepository.Update(EmptyStation, true);
                         WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿agvtask.agv_tasknum}", "PCS");
-                        CreatePartQueue(agvtaskRepository, agvtask, types[1]);
+                        CreatePartQueue(agvtaskRepository, agvtask, agvtask.agv_Traytype == "SmallTray" ? "LargeTray" : "SmallTray");
+                        //CreatePartQueue(agvtaskRepository, agvtask, types[1]);
                     }
                 }
             }
@@ -129,7 +130,7 @@
                 agv_toaddress = agvtask.agv_fromaddress,
                 agv_userid = "绯荤粺",
                 agv_TrayStatus = agvtask.agv_TrayStatus,
-                agv_Traytype = type == "" ? agvtask.agv_Traytype : type,
+                agv_Traytype = type,
             };
             agvtaskRepository.Add(taskPart, true);
             WriteDBLog.Success("鍒涘缓鏇存崲绌虹洏浠诲姟", $"浠诲姟缂栧彿锛歿taskPart.agv_tasknum}", "PCS");

--
Gitblit v1.9.3