| | |
| | | { |
| | | public partial class Frm_Work09 : DevExpress.XtraEditors.XtraForm |
| | | { |
| | | string _strType = ""; |
| | | string _webServiceName = "WorkWeight/"; |
| | | string value = string.Empty; |
| | | /// <summary> |
| | | /// 串口类 |
| | | /// </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) |
| | |
| | | } |
| | | }; |
| | | GetComList(); |
| | | this.comLine.getSuppler(""); |
| | | if (this._strType == QcSeason.产线称重.ToString()) |
| | | { |
| | | this.comLine.getSuppler(""); |
| | | } |
| | | gvMx1.OptionsFind.ShowSearchNavButtons = false; |
| | | gvMx1.OptionsView.ShowAutoFilterRow = false; |
| | | gvMx1.OptionsView.ShowGroupPanel = false; |
| | |
| | | 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) |
| | | { |
| | |
| | | if (i > 0) |
| | | { |
| | | _tmpStr = Sp.ReadExisting(); |
| | | // Thread.Sleep(1000); |
| | | // Thread.Sleep(1000); |
| | | LogHelper.Debug(this.ToString(), $"监听到数据,字节长度:{i.ToString()},{_tmpStr}"); |
| | | this.BeginInvoke(new Action(() => |
| | | { |
| | |
| | | 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); |
| | | })); |
| | | } |
| | |
| | | /// <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, |
| | |
| | | /// <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; |