From 48335b93b2b2850a8540bbe8b0182c6f8f1f4626 Mon Sep 17 00:00:00 2001
From: czw <selecti@yeah.net>
Date: 星期日, 06 七月 2025 12:00:49 +0800
Subject: [PATCH] 1

---
 HH.WCS.QingXiNongfu/process/DeviceProcess.cs |  114 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 88 insertions(+), 26 deletions(-)

diff --git a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
index 27022f3..65da30a 100644
--- a/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
+++ b/HH.WCS.QingXiNongfu/process/DeviceProcess.cs
@@ -312,7 +312,7 @@
                     si = "0";
 
                 }
-                else if (data.Contains("11"))// && (ods.Find(x => x.SQL_PLineNo.Contains("绾哥")) != null || plc.deviceName.Contains("T1"))
+                if (data.Contains("11"))// && (ods.Find(x => x.SQL_PLineNo.Contains("绾哥")) != null || plc.deviceName.Contains("T1"))
                 {
                     //if (!ods.Any())
                     //    return;
@@ -320,13 +320,22 @@
                     if (_cl.N_CURRENT_NUM > 0 || _clrel.Any())
                     {
                         LogHelper.Info($" time锛歿_clrel0?.T_CREATE} = s_type锛歿_clrel0.S_TYPE}");
+                        //if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 10 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
+                        //    goto ballll;
+                        //plg 2025骞�鏈�3鏃� 鍘婚櫎10绉掓椂闂撮檺鍒�                         if (_clrel.Any())
-                            //if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 10 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
-                            //    goto ballll;
-                            //plg 2025骞�鏈�3鏃� 鍘婚櫎10绉掓椂闂撮檺鍒�-                            if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 3 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
-                                goto ballll;
-
+                        {
+                            if (od?.SQL_PLineNo == "T1鎻愬崌鏈�)
+                            {
+                                if (!string.IsNullOrEmpty(_clrel0.S_TYPE))
+                                    goto ballll;
+                            }
+                            else
+                            {
+                                if (DateTime.Now.Subtract(_clrel0.T_CREATE).TotalSeconds < 3 || !string.IsNullOrEmpty(_clrel0.S_TYPE))
+                                    goto ballll;
+                            }
+                        }
                         LocationHelper.DoAction(db =>
                             {
                                 db.Deleteable(_clrel).ExecuteCommand();
@@ -1724,9 +1733,42 @@
                鐘舵�2	閫佺┖瀹屾垚涔嬪悗涓虹姸鎬�
                鐘舵�3	婊℃墭鍙栬蛋锛岄�绌轰箣鍓嶄负鐘舵�3锛屽紑鏈洪粯璁ょ姸鎬佷篃涓虹姸鎬�
            */
+            //3F 00 12 22 0D 0A--鏃犱换鍔′俊鍙�+            //3F 00 11 22 0D 0A--A鍙e伐浣滀俊鍙�+            //3F 00 12 21 0D 0A--B鍙d俊鍙�+            //3F 00 11 21 0D 0A--A銆丅鍙e伐浣滀俊鍙�+
+            //A鍙e浣嶄俊鍙�- 3F 00 10 0D 0A
+            //B鍙e浣嶄俊鍙�- 3F 00 20 0D 0A
 
             if (data.Length == 4)
             {
+                //if (data == "1122")//A鍙e伐浣滀俊鍙�+                //{
+                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
+                //    {
+
+                //    }
+                //}
+                //else if (data == "1221")//B鍙e伐浣滀俊鍙�+                //{
+                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
+                //    {
+
+                //    }
+                //}
+                //else if (data == "1121")//B鍙e伐浣滀俊鍙�+                //{
+                //    if (BottlePEMInfoFullTwo(plc, plc.location[0]))
+                //    {
+
+                //    }
+                //    if (BottlePEMInfoFullTwo(plc, plc.location[1]))
+                //    {
+
+                //    }
+                //}
+
                 if (data.Substring(1, 1) == "1")
                 {
                     if (BottlePEMInfoFull(plc, plc.location[0]))
@@ -1953,6 +1995,26 @@
                         }
                     }
                 }
+            }
+        }
+        static bool BottlePEMInfoFullTwo(Settings.deviceInfo plc, string location)
+        {
+            try
+            {
+                if (location != "")
+                {
+                    var workOrder = WCSHelper.GetWorkOrder(plc.deviceName);
+                    if (workOrder == null)
+                    {
+                        LogHelper.Info(plc.deviceName + "娌℃湁銆愭墽琛屼腑銆戠殑宸ュ崟");
+                        return false;
+                    }
+                }
+                return false;
+            }
+            catch (Exception ex)
+            {
+                return false;
             }
         }
 
@@ -2711,7 +2773,6 @@
             //灏辨煡鐪嬫湁娌℃湁绌虹殑鎺掍簡銆�
             //if (endBit != null) ///  瀵绘壘鏈弧鎺掞紝 鐩存帴杩斿洖缁撴灉銆�
             return endBit;
-        //LogHelper.Info(" _tempList over锛�);
 
         //杩欓噷寮� 瀵绘壘绌烘帓
         Empty:
@@ -3482,26 +3543,27 @@
                                         }
                                     if (endBit == null && _tempList.Any())
                                     {
-                                        LogHelper.Info(" ar_RplaceRow over锛�);
-                                        var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "鎶ュ簾");//.Select(x => x.N_ROW).Distinct();
-                                                                                                                                                                            //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "鏃�).Select(x => x.N_ROW).Distinct();
-                                        IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "鍏ュ簱閿�鍑哄簱閿�.Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct();
-                                        LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1));                                                                                        //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1));
-                                        var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct();
-                                        LogHelper.Info(" 鏈夎揣鎺掞細 - " + JsonConvert.SerializeObject(ar_RplaceRow2));
-                                        var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW);
+                                        LogHelper.Info(" ar_RplaceRow over锛� + JsonConvert.SerializeObject(_tempList.Select(x => x.N_ROW).Distinct()));
+                                        //var ar_RplaceRows = LocationHelper.GetLocList(x => x.S_AREA_CODE != area1 && x.S_AREA_CODE.Contains(are) && x.S_LOCK_STATE != "鎶ュ簾");//.Select(x => x.N_ROW).Distinct();
+                                        //                                                                                                                                    //var ar_RplaceRow1 = ar_RplaceRows.FindAll(x => x.S_LOCK_STATE != "鏃�).Select(x => x.N_ROW).Distinct();
+                                        //IEnumerable<int> ar_RplaceRow1 = ar_RplaceRows.FindAll(x => "鍏ュ簱閿�鍑哄簱閿�.Contains(x.S_LOCK_STATE?.Trim())).Select(x => x.N_ROW).Distinct();
+                                        //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1));                                                                                        //LogHelper.Info(" 鏈夐攣鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow1));
+                                        //var ar_RplaceRow2 = ar_RplaceRows.FindAll(x => x.N_CURRENT_NUM > 0).Select(x => x.N_ROW).Distinct();
+                                        //LogHelper.Info(" 鏈夎揣鎺掞細 - " + JsonConvert.SerializeObject(ar_RplaceRow2));
+                                        //var ar_RplaceRow_rowlock = LocationHelper.GetRowLock(x => x.S_AREA_CODE.Contains(are))?.Select(x => x.N_ROW);
 
-                                        var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct();
+                                        //var ar_RplaceRow = ar_RplaceRow1.Concat(ar_RplaceRow2).Concat(ar_RplaceRow_rowlock).Distinct();
 
-                                        if (ar_RplaceRow.Any())
-                                        {
-                                            LogHelper.Info("鎺掗櫎闈炵┖鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow));
-                                            _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW));
-                                        }
-                                        if (_tempList.Any())//涓変釜搴撳尯鐨勪氦闆嗙┖鎺�-                                        {
-                                            endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
-                                        }
+                                        //if (ar_RplaceRow.Any())
+                                        //{
+                                        //    LogHelper.Info("鎺掗櫎闈炵┖鎺�- " + JsonConvert.SerializeObject(ar_RplaceRow));
+                                        //    _tempList.RemoveAll(x => ar_RplaceRow.Contains(x.N_ROW));
+                                        //}
+                                        //if (_tempList.Any())//涓変釜搴撳尯鐨勪氦闆嗙┖鎺�+                                        //{
+                                        //    endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
+                                        //}
+                                        endBit = _tempList.OrderBy(x => x.N_ROW).ThenBy(x => x.N_COL).FirstOrDefault();
                                     }
 
                                     #endregion

--
Gitblit v1.9.1