From ef52fd6fd07508883dce4eb002acda59f0169e59 Mon Sep 17 00:00:00 2001
From: alielie <alielie@git.com>
Date: 星期四, 23 四月 2026 10:19:33 +0800
Subject: [PATCH] 优化;

---
 Plugin.TestResult/Scanner.xaml.cs |   52 +++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 49 insertions(+), 3 deletions(-)

diff --git a/Plugin.TestResult/Scanner.xaml.cs b/Plugin.TestResult/Scanner.xaml.cs
index 991d647..48bf1c5 100644
--- a/Plugin.TestResult/Scanner.xaml.cs
+++ b/Plugin.TestResult/Scanner.xaml.cs
@@ -4,6 +4,7 @@
 using HMI.UI.Util;
 using HMI.Util;
 using Panuon.WPF.UI;
+using Plugin.TestResult.Lixun;
 using Plugin.TestResult.Model;
 using Plugin.TestResult.Util;
 using Plugin.TestResult_WPF.Model;
@@ -228,10 +229,34 @@
                     var EnableMes = ParameterManager.GetCommonParameterByName<bool>("EnableMes", false);
                     if (ParamSetting.CustomerCode == "LIXUN" && EnableMes)
                     {
-                        if (PNUtil.GetPN(ParamSetting.MesAddress, snr, out string pn, out string msg))
+                        var table = TestResultView.tables[this.ovenIndex];
+                        string currentPn = table.CbProduct.Text;
+
+                        /// 妫�鏌ユ牸寮�
+                        if (!SNValidator.ValidateSN(currentPn, snr, out string msg))
                         {
-                            var table = TestResultView.tables[this.ovenIndex];
-                            string currentPn = table.CbProduct.Text;
+                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            MsgBoxHelper2.Error($"妫�鏌ヤ骇鍝佹潯鐮佸紓甯革細{msg}");
+                            snrText.Text = string.Empty;
+                            snrText.Focus();
+                            return;
+                        }
+
+                        /// 鑾峰彇绔欏悕
+                        string stationName = ProductManager.GetParameterByProductAndName(currentPn, "MES绔欎綅")?.Value;
+                        if (string.IsNullOrEmpty(stationName))
+                        {
+                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            MsgBoxHelper2.Error($"妫�鏌ヤ骇鍝佹潯鐮佸紓甯革紝褰撳墠浜у搧[{currentPn}]鏈缃弬鏁癕ES绔欎綅");
+                            snrText.Text = string.Empty;
+                            snrText.Focus();
+                            return;
+                        }
+
+                        /// 妫�鏌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 _);
@@ -249,6 +274,27 @@
                             snrText.Focus();
                             return;
                         }
+
+                        /// 妫�鏌ュ伐搴�
+                        if (PNUtil.CheckIn(ViewControl.Logger, ParamSetting.MesAddress, stationName, snr, out bool needCheckIn, out msg))
+                        {
+                            if (needCheckIn != true)
+                            {
+                                TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                                MsgBoxHelper2.Error($"鏉$爜[{snr}]宸ュ簭涓嶅湪鏈珯锛歿msg}");
+                                snrText.Text = string.Empty;
+                                snrText.Focus();
+                                return;
+                            }
+                        }
+                        else
+                        {
+                            TestResultView.tables[this.ovenIndex].GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+                            MsgBoxHelper2.Error($"鏉$爜[{snr}]CheckIn澶辫触锛歿msg}");
+                            snrText.Text = string.Empty;
+                            snrText.Focus();
+                            return;
+                        }
                     }
                     //var _ = ScannerParser.GetCellInfoByCode(this.model, this.columns, this.rows, snr);
                     //ToastHelper.Warning(this, "浜у搧鐮佹牸寮忓紓甯�");

--
Gitblit v1.9.1