From fe2aa4880d5c9fd88088ad0ed81ebaca05629f5f Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 02 十一月 2026 17:59:45 +0800
Subject: [PATCH] feat: 集成CAN驱动/模拟器 + 仪器仪表注册/硬件调试模块
---
Plugin.TestResult/Scanner.xaml.cs | 97 ++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 85 insertions(+), 12 deletions(-)
diff --git a/Plugin.TestResult/Scanner.xaml.cs b/Plugin.TestResult/Scanner.xaml.cs
index 991d647..aeba0b8 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;
@@ -157,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 = "";
@@ -228,13 +244,38 @@
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.nameTables[targetCellInfo.OvenName];
+ // 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;
+ table.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))
+ {
+ table.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 _);
+ table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
MsgBoxHelper2.Error($"褰撳墠娴嬭瘯鏂欏彿涓� [{currentPn}]锛屾壂鐮佷骇鍝佹枡鍙蜂负 [{pn}] 涓嶅厑璁告祴璇�");
snrText.Text = string.Empty;
snrText.Focus();
@@ -243,8 +284,29 @@
}
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();
+ return;
+ }
+
+ /// 妫�鏌ュ伐搴�
+ if (PNUtil.CheckIn(ViewControl.Logger, ParamSetting.MesAddress, stationName, snr, out bool needCheckIn, out msg))
+ {
+ if (needCheckIn != true)
+ {
+ table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+ MsgBoxHelper2.Error($"鏉$爜[{snr}]宸ュ簭涓嶅湪鏈珯锛歿msg}");
+ snrText.Text = string.Empty;
+ snrText.Focus();
+ return;
+ }
+ }
+ else
+ {
+ table.GetSingleCell(targetCellInfo.Index).LightRed(true, out _);
+ MsgBoxHelper2.Error($"鏉$爜[{snr}]CheckIn澶辫触锛歿msg}");
snrText.Text = string.Empty;
snrText.Focus();
return;
@@ -353,11 +415,11 @@
}
else
{
- if (ParamSetting.CustomerCode != "LIXUN")
- {
- snrText.Focus();
- return;
- }
+ //if (ParamSetting.CustomerCode != "LIXUN")
+ //{
+ // snrText.Focus();
+ // return;
+ //}
string barcode = positionText.Text;
try
{
@@ -370,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