From 3c1595797d13715cd745008f31fe6f1b601f0759 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期日, 12 五月 2024 09:41:28 +0800
Subject: [PATCH] 优化叠盘入库功能

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

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 d64c0cd..389772f 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"
@@ -377,6 +377,7 @@
                 Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(Context);
                 var plc = repository.FindFirst(x => x.plcinfo_name == client.PLCName);
                 List<string> stationCodes = new List<string>() { "S01001001", "S01001002", "W01001001", "W01001002", "W01001003" };
+                dt_stationinfo EmptyStation = null;
                 string remark = "";
                 foreach (var stationCode in stationCodes)
                 {
@@ -415,14 +416,24 @@
                             }
                             remark = "鏌ヨ绌烘墭鍙犵洏浣�";
                             #region 绌烘墭鍙犵洏
-                            var EmptyStations = stationinfoRepository.Find(x => x.stationCode.Contains("DD") && x.quantity < 5 && x.enable).ToList();
-                            var 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).FirstOrDefault();
+                            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);
+                                }
+                            }
                             #endregion
-                            remark = "鏌ユ壘搴撳唴绌烘墭浣�";
-                            if (EmptyStation == null)//鏌ユ壘搴撳唴绌烘墭鐩�
+                            else
+                            {
+                                remark = "鏌ユ壘搴撳唴绌烘墭浣�";
                                 EmptyStation = GetStation.EmptyPalletStation(area);
+                            }
 
 
                             if (EmptyStation != null)

--
Gitblit v1.9.3