alielie
2026-04-16 1afe548ac40cc7f975917ef9bf2e156595cf81f3
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))
                        {
                            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}]未设置参数MES站位");
                            snrText.Text = string.Empty;
                            snrText.Focus();
                            return;
                        }
                        /// 检查PN
                        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, "产品码格式异常");