From 0b5ccdca6263cf7a2cee460f30c76ef1efea2811 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期六, 27 四月 2024 17:47:27 +0800
Subject: [PATCH] 人工出库,人工入库,人工移库,PDA扫码确认外协物料已被取走接口

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/JobsPart/Common/ReplaceTray.cs |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 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 79a3d97..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,18 +57,19 @@
                 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搴撳尯鐨勭┖鎵樹綅
-
-                    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();
+                    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()
@@ -93,6 +94,10 @@
                             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, types[1]);
                     }

--
Gitblit v1.9.3