| | |
| | | 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; |
| | |
| | | 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 _); |
| | |
| | | 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, "产品码格式异常"); |