FrmAnalyze.cs
4.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
using MetroFramework.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TSA_V
{
public partial class FrmAnalyze : FrmBase
{
public FrmAnalyze()
{
InitializeComponent();
}
public static DateTime PreStartTime = new DateTime(0);
public static DateTime PreEndTime = new DateTime(0);
private void FrmAnalyze_Load(object sender, EventArgs e)
{
LoadCom();
if (PreStartTime.Ticks > 0 && PreEndTime.Ticks > 0)
{
dtpStartTime.Value = PreStartTime;
dtpEndTime.Value = PreEndTime;
}
else
{
DateTime time1 = DateTime.Now.AddDays(-4);
dtpStartTime.Value = new DateTime(time1.Year, time1.Month, time1.Day, 0, 0, 0);
DateTime time = DateTime.Now.AddDays(-1);
dtpEndTime.Value = new DateTime(time.Year, time.Month, time.Day, 23, 59, 59);
}
this.tempChat.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
this.tempChat.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
//tempChat.Series[0].Name = "";
}
private void LoadCom()
{
cmbBoardList.DataSource = null;
BoardInfo board = new BoardInfo();
board.boardId = 0;
board.boardName = "--所有--";
List<BoardInfo> list = new List<BoardInfo>(BoardManager.boardList);
list.Insert(0, board);
cmbBoardList.DataSource = list;
cmbBoardList.DisplayMember = "boardName";
cmbBoardList.ValueMember = "boardId";
cmbBoardList.SelectedIndex = 0;
}
private void LoadWrokType(BoardInfo board)
{
cmbWorkType.Items.Clear();
cmbWorkType.Items.Add("--所有--");
cmbWorkType.Items.Add("组装");
cmbWorkType.Items.Add("焊接");
cmbWorkType.Items.Add("检测");
cmbWorkType.SelectedIndex = 0;
}
private void btnSearch_Click(object sender, EventArgs e)
{
DateTime startTime = dtpStartTime.Value;
DateTime endTime = dtpEndTime.Value;
DateTime today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
//
if (startTime < DateTime.Now.AddDays(-30))
{
MessageBox.Show("只能查询近30天的日志!");
dtpStartTime.Focus();
return;
}
if (endTime > today)
{
MessageBox.Show("只能查询近今天之前的日志!");
dtpEndTime.Focus();
return;
}
if(cmbBoardList.SelectedItem==null){
MessageBox.Show("请选择电路板!");
return;
}
if(cmbWorkType.SelectedItem==null){
MessageBox.Show("请选择焊点!");
return;
}
PreStartTime = startTime;
PreEndTime = endTime;
tempChat.Series[0].Points.Clear();
tempChat.Series[1].Points.Clear();
tempChat.Series[2].Points.Clear();
tempChat.Series[3].Points.Clear();
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
}
private void cmbBoardList_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbBoardList.SelectedItem != null)
{
BoardInfo board = (BoardInfo)cmbBoardList.SelectedItem;
LoadWrokType(board);
}
}
private void btnBack_Click(object sender, EventArgs e)
{
this.Close();
}
}
}