private void timer3_Tick(object sender, EventArgs e) { if (obj != null) { RuKouLiuLiangLeiJi += obj.getInletFlow(); ChuKouLiuLiangLeiJi += obj.getOutletFlow(); } this.textBoxEx4.Text = Convert.ToString(RuKouLiuLiangLeiJi); this.textBoxEx5.Text = Convert.ToString(ChuKouLiuLiangLeiJi); this.textBoxEx6.Text = Convert.ToString(RuKouLiuLiangLeiJi - ChuKouLiuLiangLeiJi); //更新累积值 }
private void timer1_Tick(object sender, EventArgs e) { obj = u.GetOilFromDB(i); // Console.WriteLine(obj.toString()); //ucNumTextBox2.Num = Convert.ToDecimal(obj.getDepthOfTheDrillBit());//钻头深度 //ucNumTextBox3.Num = Convert.ToDecimal(obj.getInletFlowlog());//出口流量 //ucNumTextBox4.Num = Convert.ToDecimal(obj.getInletDensitylog());//入口密度 ucNumTextBox11.Num = Convert.ToDecimal(obj.getMeasurementOfBackPressure()); //回压测量,对应测量回压 ucTextBoxEx1.InputText = Convert.ToString(obj.getOutletFlowlog()); //出口流量 ucTextBoxEx3.InputText = Convert.ToString(obj.getLayTime()); //迟到时间 ucTextBoxEx2.InputText = Convert.ToString(obj.getOutletDensitylog()); //出口密度 ucNumTextBox7.Num = Convert.ToDecimal(obj.getStandpipePressurelog()); //立管压力,对应立压log textBoxEx7.Text = Convert.ToString(obj.getWellMouthAdjustment() - Convert.ToDouble(ucNumTextBox9.Num)); //压力差值 textBoxEx8.Text = Convert.ToString(obj.getOutletFlow() - Convert.ToDouble(this.ucNumTextBox3.Num)); //流量差值 u.SetOilToDB(obj); i++; this.label28.Text = (20 + obj.getDateTime().Substring(0, 8)); // this.label29.Text = (20 + obj.getDateTime().Substring(0, 8)); this.cartesianChart2.Series[0].Values.Add(Convert.ToDouble(this.ucNumTextBox3.Num));//获得入口流量 if (this.cartesianChart2.Series[0].Values.Count >= 1200) { this.cartesianChart2.Series[0].Values.RemoveAt(0); } this.cartesianChart2.Series[1].Values.Add(Convert.ToDouble((Convert.ToDouble(obj.getOutletFlow())).ToString("F2")));//获得出口流量 if (this.cartesianChart2.Series[1].Values.Count >= 1200) { this.cartesianChart2.Series[1].Values.RemoveAt(0); } List <String> newList = new List <string>(this.cartesianChart2.AxisX[0].Labels); String JianGeString = obj.getDateTime().Substring(9, 5); //获取需要放置分割线的时间节点 newList.Add(JianGeString); //获取时间,HH:MM if (newList.Count >= 1200) { newList.RemoveAt(0); } this.cartesianChart2.AxisX[0].Labels = newList.ToArray(); this.cartesianChart1.AxisX[0].Labels = newList.ToArray(); this.cartesianChart1.Series[0].Values.Add(Convert.ToDouble(obj.getWellMouthAdjustment()));//测量值,获取井口调节压力 if (this.cartesianChart1.Series[0].Values.Count >= 1200) { this.cartesianChart1.Series[0].Values.RemoveAt(0); } //回压设置 this.cartesianChart1.Series[1].Values.Add(Convert.ToDouble(ucNumTextBox9.Num)); if (this.cartesianChart1.Series[1].Values.Count >= 1200) { this.cartesianChart1.Series[1].Values.RemoveAt(0); } JianGe++;//代表输入了一条数据 //每十条数据添加一条线 if (JianGe == ConstJianGe) { JianGe = 0; this.cartesianChart1.AxisX[0].Separator = new Separator { Step = ConstJianGe, }; this.cartesianChart2.AxisX[0].Separator = new Separator { Step = ConstJianGe, }; } //再写一个计时器,用来更新累计值 }