From 75ca84b7570d7a6a805c27164c3f17c1f2158423 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周五, 13 12月 2024 08:34:26 +0800
Subject: [PATCH] 111

---
 CC/iWareCC_ASRS/ThreadService/01_BZ01工位(清灰,洗板后工位)/DataProcess_BZ01.cs |  117 +++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 82 insertions(+), 35 deletions(-)

diff --git "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs" "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
index 3d3307b..0697162 100644
--- "a/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
+++ "b/CC/iWareCC_ASRS/ThreadService/01_BZ01\345\267\245\344\275\215\357\274\210\346\270\205\347\201\260\357\274\214\346\264\227\346\235\277\345\220\216\345\267\245\344\275\215\357\274\211/DataProcess_BZ01.cs"
@@ -31,6 +31,7 @@
         {
             var alertMsg = "";
             LogType logType = LogType.DataProcess_BZ01;
+            string lastUpi = "";//鏈�鍚庤褰曠殑UPI鏁版嵁
             while (true)
             {
                 Thread.Sleep(1000);//浼戠湢2绉掞紝灏嗕紤鐪犲啓鍒板墠闈紝鏄负浜嗕笅闈㈢殑continue鏂规硶鎵ц鍚庝笉鏄剧ず閿欒淇℃伅鐨勬彁绀猴紒锛侊紒銆怑ditBy shaocx,2022-05-24銆�
@@ -64,7 +65,14 @@
                                 SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-璇锋眰浜嗚В鐮侊紝浣嗘槸缁撴灉鏄┖鐨�,姝ゆ寰幆缁撴潫";
                                 continue;
                             }
+                            if (lastUpi == result)
+                            {
+                                SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"{rgvLocation.ToString()}-閲嶅鐨刄PI{result}";
+                                continue;
+                            }
                             var upiCode = result;
+                            lastUpi = upiCode;
+
                             var qitaoReault = false;//榻愬寘缁撴灉
                             using (WmsDBModel wmsDB = new WmsDBModel())
                             {
@@ -119,47 +127,80 @@
                                         }
                                         else
                                         {
-                                            //杩橀渶瑕侀獙璇佸湪杩欎簺鍖哄煙涓紝鏄惁姝g‘鎺掗槦锛屽鏋滄病鏈夋纭帓闃燂紝閭d箞灏辫涓轰笉榻愬 銆怑ditby shaocx,2024-12-12銆�
-                                            var queueList = wmsDB.mes_upi_linequeue.Where(x => x.PackageCode == upiObj.PackageCode && x.AreaCode == queryAreaCode)
-                                                .OrderBy(x => x.Id).ToList();
-                                            var fisrtId = queueList.OrderBy(x => x.Id).First().Id;
-                                            var endId = queueList.OrderByDescending(x => x.Id).First().Id;
-                                            //缁х画鏌ヨ杩欎釜鏃堕棿娈靛唴鐨勯槦鍒楁暟鎹�
-                                            //閲嶅啓璇ラ槦鍒�
-                                            queueList = wmsDB.mes_upi_linequeue.Where(x => x.Id >= fisrtId && x.Id <= endId).OrderBy(x => x.Id).ToList();
-                                            var syCount = allList.Where(x => x.Shelf >= upiObj.Shelf).Count();
-                                            if (queueList.Count() != syCount)
+                                            var isJiXuValidate = true;
+                                            if (upiObj.Shelf != 1)
                                             {
-                                                qitaoReault = false;
-                                                upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
-                                            }
-                                            else
-                                            {
-                                                //鍒ゆ柇鏄惁涔卞簭
-                                                bool isLuanXuan = false;
-                                                int temp_shelf = 0;
-                                                for (int i = 0; i < queueList.Count; i++)
+                                                var qianmianList = allList.Where(x => x.Shelf < upiObj.Shelf).ToList();
+                                                //鐪嬩互鍓嶇殑鏉垮湪鍝噷锛屽繀椤婚兘鍦� 鐮佸灈鍖哄煙
+                                                var yiqianQuyu = AreaCodeEnum.鐮佸灈鍖哄煙;
+                                                var count_MD = qianmianList.Where(x => x.AreaCode == (int)yiqianQuyu).Count();
+                                                if (count_MD != qianmianList.Count())
                                                 {
-                                                    if (i == 0)
+                                                    isJiXuValidate = false;
+                                                    qitaoReault = false;
+                                                    upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
+                                                }
+                                            }
+
+                                            if (isJiXuValidate)
+                                            {//鏄惁缁х画楠岃瘉
+                                                //杩橀渶瑕侀獙璇佸湪杩欎簺鍖哄煙涓紝鏄惁姝g‘鎺掗槦锛屽鏋滄病鏈夋纭帓闃燂紝閭d箞灏辫涓轰笉榻愬 銆怑ditby shaocx,2024-12-12銆�
+                                                var queueList = wmsDB.mes_upi_linequeue.Where(x => x.PackageCode == upiObj.PackageCode && x.AreaCode == queryAreaCode)
+                                                    .OrderBy(x => x.Id).ToList();
+                                                var fisrtId = queueList.OrderBy(x => x.Id).First().Id;
+                                                var endId = queueList.OrderByDescending(x => x.Id).First().Id;
+                                                //缁х画鏌ヨ杩欎釜鏃堕棿娈靛唴鐨勯槦鍒楁暟鎹�
+                                                //閲嶅啓璇ラ槦鍒�
+                                                queueList = wmsDB.mes_upi_linequeue.Where(x => x.Id >= fisrtId && x.Id <= endId).OrderBy(x => x.Id).ToList();
+                                                var syCount = allList.Where(x => x.Shelf >= upiObj.Shelf).Count();
+                                                if (queueList.Count() != syCount)
+                                                {
+                                                    qitaoReault = false;
+                                                    upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
+                                                }
+                                                else
+                                                {
+                                                    //鍒ゆ柇鏄惁涔卞簭
+                                                    bool isLuanXuan = false;
+                                                    int temp_shelf = 0;
+                                                    for (int i = 0; i < queueList.Count; i++)
                                                     {
-                                                        temp_shelf = queueList[i].Shelf;
-                                                    }
-                                                    else
-                                                    {
-                                                        if ((temp_shelf + 1) != queueList[i].Shelf)
-                                                        {//璁や负涔卞簭浜�
-                                                            qitaoReault = false;
-                                                            isLuanXuan = true;
-                                                            upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
-                                                            break;//璺冲嚭寰幆
+                                                        if (i == 0)
+                                                        {
+                                                            temp_shelf = queueList[i].Shelf;
+                                                            if (temp_shelf != upiObj.Shelf)
+                                                            {
+                                                                qitaoReault = false;
+                                                                isLuanXuan = true;
+                                                                upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
+                                                                break;//璺冲嚭寰幆
+                                                            }
+                                                            if (queueList[i].Upi != upiObj.UPI)
+                                                            {
+                                                                qitaoReault = false;
+                                                                isLuanXuan = true;
+                                                                upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
+                                                                break;//璺冲嚭寰幆
+                                                            }
+                                                        }
+                                                        else
+                                                        {
+                                                            temp_shelf = temp_shelf + 1;
+                                                            if (temp_shelf != queueList[i].Shelf)
+                                                            {//璁や负涔卞簭浜�
+                                                                qitaoReault = false;
+                                                                isLuanXuan = true;
+                                                                upiObj.AreaCode = (int)AreaCodeEnum.缂撳瓨鍒嗘嫞鍖�;
+                                                                break;//璺冲嚭寰幆
+                                                            }
                                                         }
                                                     }
-                                                }
 
-                                                if (isLuanXuan == false)
-                                                {
-                                                    qitaoReault = true;
-                                                    upiObj.AreaCode = (int)AreaCodeEnum.鐮佸灈鍖哄煙;
+                                                    if (isLuanXuan == false)
+                                                    {
+                                                        qitaoReault = true;
+                                                        upiObj.AreaCode = (int)AreaCodeEnum.鐮佸灈鍖哄煙;
+                                                    }
                                                 }
                                             }
                                         }
@@ -169,6 +210,12 @@
                                     }
                                 }
 
+                                //if (qitaoReault == false) {
+                                //    //涓存椂
+                                //    SystemWarningMsg._lbl_alert_DataProcess_BZ01 = $"妯℃嫙鍟婂晩锛屾殏鍋滃晩鍟�";
+                                //    continue;
+                                //}
+
                                 using (StationServiceClient client = new StationServiceClient())
                                 {
                                     var res = await client.WriteQiTaoInfoAsync((int)EDevice.Station, rgvLocation, qitaoReault);

--
Gitblit v1.9.3