From 6fc644cfee67b245cd3fd3485422ff216a2fca4e Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期日, 12 五月 2024 11:21:45 +0800
Subject: [PATCH] 删除30天前文本日志

---
 代码管理/PCS/WCS_Server/WIDESEA_WCS/Common/Pipeline.cs |   35 +++++++++++++++++++++++++----------
 1 files changed, 25 insertions(+), 10 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 6cbb4af..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"
@@ -146,10 +146,10 @@
 
                 #region 鐢宠涓婃枡
 
-                if (!Gantry_client.ReadByOrder<bool>("W_RequestUnload", number))
+                var Station = stationinfoRepository.Find(x => x.area == area_code(number) && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
+                if (Station != null)
                 {
-                    var Station = stationinfoRepository.Find(x => x.area == area_code(number) && x.enable && x.location_state == LocationStateEnum.Stroge.ToString() && x.quantity > 0).OrderBy(x => x.lastUpdateTime).FirstOrDefault();
-                    if (Station != null)
+                    if (!Gantry_client.ReadByOrder<bool>("W_RequestUnload", number))
                     {
                         var SNS = Station.bindSN.Split(",");
                         List<string> list = new List<string>();
@@ -210,6 +210,10 @@
                         }
                         #endregion
                     }
+                }
+                else
+                {
+                    Gantry_client.WriteByOrder("W_RequestUnload", false, number);
                 }
 
                 #endregion
@@ -373,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)
                 {
@@ -411,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)
@@ -591,7 +606,7 @@
                 if (mes_Head != null)
                 {
                     mes_Head.finishNum = mes_Head.finishNum + 1;
-                    //freeDB.DataBase.Update<dt_mes_head>().SetSource(mes_Head).UpdateColumns(x => new { x.finishNum }).ExecuteAffrows();
+                    if (mes_Head.finishNum == mes_Head.quantity) mes_Head.FinishTime = DateTime.Now;
                     mes_HeadRepository.Update(mes_Head, true);
                 }
             }

--
Gitblit v1.9.3