From d1b72117058f1131046b6aa3add8e3ccfae033d8 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 10:36:07 +0800
Subject: [PATCH] docs: CAN 模拟器独立 TCP 服务进程设计规格(统一 CanDeviceDriver + 双工推送协议)

---
 Plugin.TestResult/Scanner.xaml.cs |   57 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/Plugin.TestResult/Scanner.xaml.cs b/Plugin.TestResult/Scanner.xaml.cs
index 48bf1c5..aeba0b8 100644
--- a/Plugin.TestResult/Scanner.xaml.cs
+++ b/Plugin.TestResult/Scanner.xaml.cs
@@ -158,12 +158,27 @@
                     {
                         try
                         {
-                            this.targetCellInfo = ScannerParser.GetCellInfoByCode(this.model, this.columns, this.rows, barcode);
+                            var targetCellInfo = ScannerParser.GetCellInfoByCode(this.model, this.columns, this.rows, barcode);
                             if (!TestResultView.nameTables.ContainsKey(targetCellInfo.OvenName))
                             {
                                 MsgBoxHelper2.Error($"鑰佸寲鐐� [{targetCellInfo.OvenName}] 涓嶅瓨鍦紝璇锋鏌ラ厤缃�");
                                 return;
                             }
+                            var sourceTable = TestResultView.tables[this.ovenIndex];
+                            if (sourceTable.title != targetCellInfo.OvenName)
+                            {
+                                MsgBoxHelper2.Error($"璇峰垏鎹㈣嚦 [{targetCellInfo.OvenName}] 鍖烘壂鐮侊紝褰撳墠涓� [{sourceTable.title}] 鍖猴紒");
+                                return;
+                            }
+
+                            var oven = TestResultView.nameTables[targetCellInfo.OvenName];
+                            if (oven.cells.Length < targetCellInfo.Index + 1)
+                            {
+                                MsgBoxHelper2.Error($"绌翠綅鍙� [{barcode}] 瓒呭嚭绱㈠紩 {targetCellInfo.Index}");
+                                return;
+                            }
+
+                            this.targetCellInfo = targetCellInfo;
                             positionText.Text = barcode;
                             //positionText.Focus();
                             //snrText.Text = "";
@@ -229,13 +244,14 @@
                     var EnableMes = ParameterManager.GetCommonParameterByName<bool>("EnableMes", false);
                     if (ParamSetting.CustomerCode == "LIXUN" && EnableMes)
                     {
-                        var table = TestResultView.tables[this.ovenIndex];
+                        var table = TestResultView.nameTables[targetCellInfo.OvenName];
+                        // TestResultView.tables[this.ovenIndex]
                         string currentPn = table.CbProduct.Text;
 
                         /// 妫�鏌ユ牸寮�
                         if (!SNValidator.ValidateSN(currentPn, snr, out string msg))
                         {
-                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                             MsgBoxHelper2.Error($"妫�鏌ヤ骇鍝佹潯鐮佸紓甯革細{msg}");
                             snrText.Text = string.Empty;
                             snrText.Focus();
@@ -246,7 +262,7 @@
                         string stationName = ProductManager.GetParameterByProductAndName(currentPn, "MES绔欎綅")?.Value;
                         if (string.IsNullOrEmpty(stationName))
                         {
-                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                             MsgBoxHelper2.Error($"妫�鏌ヤ骇鍝佹潯鐮佸紓甯革紝褰撳墠浜у搧[{currentPn}]鏈缃弬鏁癕ES绔欎綅");
                             snrText.Text = string.Empty;
                             snrText.Focus();
@@ -256,10 +272,10 @@
                         /// 妫�鏌N
                         if (PNUtil.GetPN(ParamSetting.MesAddress, stationName, snr, out string pn, out msg))
                         {
-                            
+
                             if (pn != currentPn)
                             {
-                                TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                                table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                                 MsgBoxHelper2.Error($"褰撳墠娴嬭瘯鏂欏彿涓� [{currentPn}]锛屾壂鐮佷骇鍝佹枡鍙蜂负 [{pn}] 涓嶅厑璁告祴璇�");
                                 snrText.Text = string.Empty;
                                 snrText.Focus();
@@ -268,7 +284,7 @@
                         }
                         else
                         {
-                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                             MsgBoxHelper2.Error($"妫�鏌ヤ骇鍝佹潯鐮佸紓甯革細{msg}");
                             snrText.Text = string.Empty;
                             snrText.Focus();
@@ -280,7 +296,7 @@
                         {
                             if (needCheckIn != true)
                             {
-                                TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                                table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                                 MsgBoxHelper2.Error($"鏉$爜[{snr}]宸ュ簭涓嶅湪鏈珯锛歿msg}");
                                 snrText.Text = string.Empty;
                                 snrText.Focus();
@@ -289,7 +305,7 @@
                         }
                         else
                         {
-                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
                             MsgBoxHelper2.Error($"鏉$爜[{snr}]CheckIn澶辫触锛歿msg}");
                             snrText.Text = string.Empty;
                             snrText.Focus();
@@ -399,11 +415,11 @@
                     }
                     else
                     {
-                        if (ParamSetting.CustomerCode != "LIXUN")
-                        {
-                            snrText.Focus();
-                            return;
-                        }
+                        //if (ParamSetting.CustomerCode != "LIXUN")
+                        //{
+                        //    snrText.Focus();
+                        //    return;
+                        //}
                         string barcode = positionText.Text;
                         try
                         {
@@ -416,10 +432,21 @@
                                 targetCellInfo = null;
                                 return;
                             }
+
+                            var sourceTable = TestResultView.tables[this.ovenIndex];
+                            if (sourceTable.title != targetCellInfo.OvenName)
+                            {
+                                MsgBoxHelper2.Error($"璇峰垏鎹㈣嚦 [{targetCellInfo.OvenName}] 鍖烘壂鐮侊紝褰撳墠涓� [{sourceTable.title}] 鍖猴紒");
+                                positionText.Text = string.Empty;
+                                positionText.Focus();
+                                targetCellInfo = null;
+                                return;
+                            }
+
                             var oven = TestResultView.nameTables[targetCellInfo.OvenName];
                             if (oven.cells.Length < targetCellInfo.Index + 1)
                             {
-                                MsgBoxHelper2.Error($"绌翠綅涓嬫爣 [{targetCellInfo.Index}] 瓒呭嚭绱㈠紩");
+                                MsgBoxHelper2.Error($"绌翠綅鍙� [{barcode}] 瓒呭嚭绱㈠紩 {targetCellInfo.Index}");
                                 positionText.Text = string.Empty;
                                 positionText.Focus();
                                 targetCellInfo = null;

--
Gitblit v1.9.1