From ae28c33700e413d5acf60d1e48bbc9870bdef5a5 Mon Sep 17 00:00:00 2001 From: cdk <2441919651@qq.com> Date: 星期五, 15 八月 2025 11:27:34 +0800 Subject: [PATCH] Merge branch 'master' of http://git.gs-mes.com:8080/r/~tjx/GsMesClient --- DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs | 47 +++++++++++++++++++++++++++++++---------------- 1 files changed, 31 insertions(+), 16 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs index 884842b..10f7707 100644 --- a/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs +++ b/DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs @@ -15,19 +15,21 @@ { public partial class Frm_Work09 : DevExpress.XtraEditors.XtraForm { + string _strType = ""; string _webServiceName = "WorkWeight/"; - string value = string.Empty; /// <summary> /// 涓插彛绫� /// </summary> private SerialPort Sp = new SerialPort(); /// <summary> - /// 瀹氭椂鍒锋柊 + /// gridview瀹氭椂鍒锋柊 /// </summary> System.Timers.Timer timer = new System.Timers.Timer(10000); - public Frm_Work09() + public Frm_Work09(string strType) { InitializeComponent(); + this._strType = strType; + this.Text = _strType + ":" + this.Text; this.FormClosing += (s, e) => { if (Sp.IsOpen) @@ -39,7 +41,10 @@ } }; GetComList(); - this.comLine.getSuppler(""); + if (this._strType == QcSeason.浜х嚎绉伴噸.ToString()) + { + this.comLine.getSuppler(""); + } gvMx1.OptionsFind.ShowSearchNavButtons = false; gvMx1.OptionsView.ShowAutoFilterRow = false; gvMx1.OptionsView.ShowGroupPanel = false; @@ -87,17 +92,20 @@ private void btnStart_Click(object sender, EventArgs e) { Sp.DataReceived -= new SerialDataReceivedEventHandler(Sp_DataReceived); - string _comLine = comLine.GetId(); string _cmbSerialPortNum = cmbSerialPortNum.Text.Trim(); string _cmbBaudRate = cmbBaudRate.Text.Trim(); string _comSjw = comSjw.Text.Trim(); string _comStopBits = comStopBits.Text.Trim(); string _comParity = comParity.Text.Trim(); - if (string.IsNullOrEmpty(_comLine)) + if (this._strType == QcSeason.浜х嚎绉伴噸.ToString()) { - Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨绾夸綋"); - this.comLine.Focus(); - return; + string _comLine = comLine.GetId(); + if (string.IsNullOrEmpty(_comLine)) + { + Gs.DevApp.ToolBox.MsgHelper.ShowError("璇烽�夋嫨绾夸綋"); + this.comLine.Focus(); + return; + } } if (cmbSerialPortNum.SelectedIndex < 0) { @@ -166,7 +174,7 @@ } catch (Exception exe) { - LogHelper.Debug(this.ToString(), "鎵撳紑澶辫触:" + exe.Message); + LogHelper.Debug(this.ToString(), "鎵撳紑涓插彛閫氫俊澶辫触:" + exe.Message); Gs.DevApp.ToolBox.MsgHelper.ShowError("鎵撳紑澶辫触" + exe.Message); } } @@ -185,7 +193,7 @@ if (i > 0) { _tmpStr = Sp.ReadExisting(); - // Thread.Sleep(1000); + // Thread.Sleep(1000); LogHelper.Debug(this.ToString(), $"鐩戝惉鍒版暟鎹紝瀛楄妭闀垮害:{i.ToString()}锛寋_tmpStr}"); this.BeginInvoke(new Action(() => { @@ -206,9 +214,9 @@ LogHelper.Debug(this.ToString(), "_tmpStr涓嶅寘鍚噸閲�+锛岄��鍑轰笂鎶�"); return; } - string[] _ary=_tmpStr.Split('+'); + string[] _ary = _tmpStr.Split('+'); string abc = _ary.Last();//ST,GS, - txtNum.Text = (abc.Trim().Replace("k", "").Replace("g", "").Replace("S","").Replace("T","").Replace("G","").Replace(",","")); + txtNum.Text = (abc.Trim().Replace("k", "").Replace("g", "").Replace("S", "").Replace("T", "").Replace("G", "").Replace(",", "")); addModel(txtNum.Text, _tmpStr); })); } @@ -242,7 +250,13 @@ /// <param name="_realWeightTxt">鍘熷瓙涓�</param> private void addModel(string _realWeight, string _realWeightTxt) { - string _lineId = comLine.GetId(); + string _lineId = ""; + if (this._strType == QcSeason.浜х嚎绉伴噸.ToString()) + { + _lineId = comLine.GetId(); + } + else + _lineId = "0"; var _obj = new { lineId = _lineId, @@ -261,7 +275,7 @@ } catch (Exception ex) { - ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); + ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message); } } @@ -272,13 +286,14 @@ /// <param name="e"></param> private void OnTimedEvent(Object source, ElapsedEventArgs e) { + if (this._strType == QcSeason.iqc绉伴噸.ToString()) + return; var _obj = new { lineId = comLine.GetId(), }; try { - var lst = new List<string>(); var strReturn = UtilityHelper.HttpPost("", _webServiceName + "GetModelList", JsonConvert.SerializeObject(_obj), false); var dd = UtilityHelper.ReturnToList(strReturn); var dt = dd.rtnData; -- Gitblit v1.9.3