Exemplo n.º 1
0
        public void UpdateGraphData(Data.UDPData data)
        {
            if (this.zedGraphControl1.InvokeRequired)
            {
                Action <Data.UDPData> action = new Action <Data.UDPData>(UpdateGraphData);
                this.Invoke(action, data);
                return;
            }

            double x = (double)DateTime.Now.ToOADate();

            m_JiaSuDuXlist.Add(x, data.JIASUDU_X);
            m_JiaSuDuYlist.Add(x, data.JIASUDU_Y);
            m_JiaSuDuZlist.Add(x, data.JIASUDU_Z);
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();
            if (m_JiaSuDuXlist.Count >= 10)
            {
                m_JiaSuDuXlist.RemoveAt(0);
            }
            if (m_JiaSuDuYlist.Count >= 10)
            {
                m_JiaSuDuYlist.RemoveAt(0);
            }
            if (m_JiaSuDuZlist.Count >= 10)
            {
                m_JiaSuDuZlist.RemoveAt(0);
            }
        }
Exemplo n.º 2
0
        private async void OperateQJDatagram(VCParamsDatagramModel data)
        {
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    Data.UDPData UDPData = new Data.UDPData();

                    UDPData.DeviceID = "QJ" + data.DeviceID;

                    UDPData.QINGJIAO_X = data.QingQiao[0, 0];
                    UDPData.QINGJIAO_Y = data.QingQiao[0, 1];

                    UDPData.Time = data.Time;

                    UDPData.Temprature = data.Temprature;

                    try
                    {
                        m_DataGridViewerWnd.m_QingJiao_DataViewWnd.UpdateListView(UDPData);

                        if (MapDataColorAdjustHandler != null)
                        {
                            object ID = UDPData.DeviceID;
                            MapDataColorAdjustHandler(ID);
                        }
                    }
                    catch (Exception) { }
                });
            }
            catch (Exception) { }
        }
Exemplo n.º 3
0
        private async void OperateSZDatagram(VCParamsDatagramModel data)
        {
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    Data.UDPData UDPData = new Data.UDPData();

                    UDPData.DeviceID = "SZ" + data.DeviceID;

                    //UDPData.ZHENDONG = data.ZHENDONG[0];

                    UDPData.CHENJIANG = data.CHENJIANG[0];

                    UDPData.Time = data.Time;

                    //UDPData.Temprature = data.Temprature;

                    try
                    {
                        m_DataGridViewerWnd.m_ShuiZhun_DataViewWnd.UpdateListView(UDPData);

                        if (MapDataColorAdjustHandler != null)
                        {
                            object ID = UDPData.DeviceID;
                            MapDataColorAdjustHandler(ID);
                        }
                    }
                    catch (Exception) { }
                });
            }
            catch (Exception) { }
        }
        public void UpdateGraphData(Data.UDPData data)
        {
            if (this.zedGraphControl1.InvokeRequired)
            {
                Action <Data.UDPData> action = new Action <Data.UDPData>(UpdateGraphData);
                this.Invoke(action, data);
                return;
            }

            double x = (double)DateTime.Now.ToOADate();

            m_CHENJIANGlist.Add(x, data.CHENJIANG);
            //m_ZHENDONGlist.Add(x, data.ZHENDONG);
            this.zedGraphControl1.AxisChange();
            this.zedGraphControl1.Refresh();
            if (m_CHENJIANGlist.Count >= 10)
            {
                m_CHENJIANGlist.RemoveAt(0);
            }
            //if (m_ZHENDONGlist.Count >= 10)
            //{
            //    m_ZHENDONGlist.RemoveAt(0);
            //}
        }
Exemplo n.º 5
0
        public void UpdateListView(Data.UDPData data)
        {
            if (this.加速计listResult.InvokeRequired)
            {
                Action <Data.UDPData> action = new Action <Data.UDPData>(UpdateListView);
                this.Invoke(action, data);
                return;
            }

            int indexOfFirstNotUse = -1;

            for (int i = 0; i < UserHelper.JIASUDUDataList.Count; ++i)
            {
                if (UserHelper.JIASUDUDataList[i].Key == data.DeviceID)
                {
                    indexOfFirstNotUse = i;
                    break;
                }
            }


            if (indexOfFirstNotUse == -1)
            {
                return;
            }

            string NOID = UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.strNOID;
            float  X初始值 = UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_OX;
            float  Y初始值 = UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_OY;
            float  Z初始值 = UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_OZ;

            float X测试值 = data.JIASUDU_X;
            float Y测试值 = data.JIASUDU_Y;
            float Z测试值 = data.JIASUDU_Z;

            float X单次变化量 = data.JIASUDU_X - UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TX;
            float Y单次变化量 = data.JIASUDU_Y - UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TY;
            float Z单次变化量 = data.JIASUDU_Z - UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TZ;

            float X累计变化量 = data.JIASUDU_X - X初始值;
            float Y累计变化量 = data.JIASUDU_Y - Y初始值;
            float Z累计变化量 = data.JIASUDU_Z - Z初始值;

            UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TX = data.JIASUDU_X;
            UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TY = data.JIASUDU_Y;
            UserHelper.JIASUDUDataList[indexOfFirstNotUse].Value.JIASUDU_TZ = data.JIASUDU_Z;

            this.加速计listResult.Items.Add(new ListViewItem(
                                             new string[]
            {
                _NextJSIndex.ToString(),
                NOID,
                X初始值.ToString(),
                Y初始值.ToString(),
                Z初始值.ToString(),
                X测试值.ToString(),
                Y测试值.ToString(),
                Z测试值.ToString(),
                X单次变化量.ToString(),
                Y单次变化量.ToString(),
                Z单次变化量.ToString(),
                X累计变化量.ToString(),
                Y累计变化量.ToString(),
                Z累计变化量.ToString(),
                data.Time.ToString()
            })
            {
                BackColor = (0 == _NextJSIndex % 2) ? System.Drawing.Color.LightGray : System.Drawing.Color.Green
            });


            if (this.加速计listResult.Items.Count == 100)
            {
                this.加速计listResult.Items.RemoveAt(0);
            }

            try
            {
                //构造insert语句
                string sql = "INSERT INTO SensorJSData (ID,NOID,X初始值,Y初始值,Z初始值,X测试值,Y测试值,Z测试值,X单次变化量,Y单次变化量,Z单次变化量,X累计变化量,Y累计变化量,Z累计变化量,TIME) VALUES(@ID,@NOID,@X初始值,@Y初始值,@Z初始值,@X测试值,@Y测试值,@Z测试值,@X单次变化量,@Y单次变化量,@Z单次变化量,@X累计变化量,@Y累计变化量,@Z累计变化量,@TIME)";
                //构造sql语句的参数
                MySqlParameter[] ps = //使用数组初始化器
                {
                    new MySqlParameter("@ID",     _NextJSIndex),
                    new MySqlParameter("@NOID",   NOID),
                    new MySqlParameter("@X初始值",   X初始值),
                    new MySqlParameter("@Y初始值",   Y初始值),
                    new MySqlParameter("@Z初始值",   Z初始值),
                    new MySqlParameter("@X测试值",   X测试值),
                    new MySqlParameter("@Y测试值",   Y测试值),
                    new MySqlParameter("@Z测试值",   Z测试值),
                    new MySqlParameter("@X单次变化量", X单次变化量),
                    new MySqlParameter("@Y单次变化量", Y单次变化量),
                    new MySqlParameter("@Z单次变化量", Z单次变化量),
                    new MySqlParameter("@X累计变化量", X累计变化量),
                    new MySqlParameter("@Y累计变化量", Y累计变化量),
                    new MySqlParameter("@Z累计变化量", Z累计变化量),
                    new MySqlParameter("@TIME",   data.Time)
                };
                //执行插入操作
                int index = MySQLDB.GetMySQLDB().ExecuteNonQuery(sql, ps);

                //添加操作
                if (index > 0)
                {
                    //MessageBox.Show("添加成功!");
                    _NextJSIndex++;
                }
                else
                {
                    //MessageBox.Show("添加失败,请稍候重试");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "注册失败", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 6
0
        public void UpdateListView(Data.UDPData data)
        {
            if (this.水准仪listResult.InvokeRequired)
            {
                Action <Data.UDPData> action = new Action <Data.UDPData>(UpdateListView);
                this.Invoke(action, data);
                return;
            }

            int indexOfFirstNotUse = -1;

            for (int i = 0; i < UserHelper.ShuiZhunDataList.Count; ++i)
            {
                if (UserHelper.ShuiZhunDataList[i].Key == data.DeviceID)
                {
                    indexOfFirstNotUse = i;
                    break;
                }
            }

            if (indexOfFirstNotUse == -1)
            {
                return;
            }

            string NOID = UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.strNOID;
            //float 振动初始值 = UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.ZHENDONGO;
            float 沉降初始值 = UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.CHENJIANGO;

            //float 振动测试值 = data.ZHENDONG - UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.ZHENDONGT;
            float 沉降测试值 = data.CHENJIANG - UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.CHENJIANGT;

            //float 振动单次变化量 = data.ZHENDONG;
            float 沉降单次变化量 = data.CHENJIANG;

            //float 振动累计变化量 = data.ZHENDONG - 振动初始值;
            float 沉降累计变化量 = data.CHENJIANG - 沉降初始值;

            //UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.ZHENDONGT = data.ZHENDONG;
            UserHelper.ShuiZhunDataList[indexOfFirstNotUse].Value.CHENJIANGT = data.CHENJIANG;

            this.水准仪listResult.Items.Add(new ListViewItem(
                                             new string[]
            {
                _NextSZIndex.ToString(),
                NOID.ToString(),
                //振动初始值.ToString(),
                沉降初始值.ToString(),
                //振动测试值.ToString(),
                沉降测试值.ToString(),
                //振动单次变化量.ToString(),
                沉降单次变化量.ToString(),
                //振动累计变化量.ToString(),
                沉降累计变化量.ToString(),
                data.Time.ToString()
            })
            {
                BackColor = (0 == _NextSZIndex % 2) ? System.Drawing.Color.LightGray : System.Drawing.Color.Green
            });

            if (this.水准仪listResult.Items.Count == 100)
            {
                this.水准仪listResult.Items.RemoveAt(0);
            }

            try
            {
                //构造insert语句
                string sql = "INSERT INTO SensorSZData (ID,NOID,沉降初始值,沉降测试值,沉降单次变化量,沉降累计变化量,TIME) VALUES(@ID,@NOID,@沉降初始值,@沉降测试值,@沉降单次变化量,@沉降累计变化量,@TIME)";
                //构造sql语句的参数
                MySqlParameter[] ps = //使用数组初始化器
                {
                    new MySqlParameter("@ID",      _NextSZIndex),
                    new MySqlParameter("@NOID",    NOID),
                    new MySqlParameter("@沉降初始值",   沉降初始值),
                    new MySqlParameter("@沉降测试值",   沉降测试值),
                    new MySqlParameter("@沉降单次变化量", 沉降单次变化量),
                    new MySqlParameter("@沉降累计变化量", 沉降累计变化量),
                    new MySqlParameter("@TIME",    data.Time)
                };
                //执行插入操作
                int index = MySQLDB.GetMySQLDB().ExecuteNonQuery(sql, ps);

                //添加操作
                if (index > 0)
                {
                    //MessageBox.Show("添加成功!");
                    _NextSZIndex++;
                }
                else
                {
                    //MessageBox.Show("添加失败,请稍候重试");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "注册失败", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 7
0
 public void UpdateListView(Data.UDPData data)
 {
     m_ShuiZhunDataGridWnd.UpdateListView(data);
     m_ShuiZhunDataGraphWnd.UpdateGraphData(data);
     //m_TempratureMeterWnd.UpdateValueChanged(data.Temprature);
 }