lu
10 天以前 878aad490fc15b11d63fb4fa7ab7ada260f66310
DevApp/Gs.DevApp/DevFrm/Work/Frm_Work09.cs
@@ -15,8 +15,8 @@
{
    public partial class Frm_Work09 : DevExpress.XtraEditors.XtraForm
    {
        string _strType = "";
        string _webServiceName = "WorkWeight/";
        string value = string.Empty;
        /// <summary>
        /// 串口类
        /// </summary>
@@ -25,9 +25,11 @@
        /// 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)
            {
@@ -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,
@@ -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;