using System; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Text; using System.Windows.Forms; namespace AGVSystem { // Token: 0x02000014 RID: 20 public partial class frmfind : Form { // Token: 0x06000111 RID: 273 RVA: 0x0001F618 File Offset: 0x0001D818 public frmfind(string str) { this.InitializeComponent(); this.Text = str; bool flag = str != "异常报警日志"; if (flag) { this.label4.Visible = false; this.cmb_gz.Visible = false; } base.WindowState = FormWindowState.Maximized; this.dateTimePicker2.Value = DateTime.Now; this.dateTimePicker1.Value = DateTime.Now.AddHours(-1.0); } // Token: 0x06000112 RID: 274 RVA: 0x0001F6C0 File Offset: 0x0001D8C0 private void frmfind_Load(object sender, EventArgs e) { this.ds = this.db.connDt("select CONVERT( VARCHAR(10),id) +' . '+ line_name as info from Assembly_Line order by id"); bool flag = this.ds.Tables.Count > 0; if (flag) { bool flag2 = this.ds.Tables[0].Rows.Count > 0; if (flag2) { this.cmb_linelist.Items.Add(""); foreach (object obj in this.ds.Tables[0].Rows) { DataRow dataRow = (DataRow)obj; this.cmb_linelist.Items.Add(dataRow[0].ToString()); } } } this.ds.Tables.Clear(); } // Token: 0x06000113 RID: 275 RVA: 0x0001F7C8 File Offset: 0x0001D9C8 private void button2_Click(object sender, EventArgs e) { string text = ""; bool flag = this.Text == "异常报警日志"; if (flag) { text = string.Concat(new string[] { "SELECT Dt as '发生时间',Assembly_Line.line_name as '所属线体' ,'* '+convert (nvarchar(10),agvinfo.id) +' / '+convert (nvarchar(10),AgvInfo.Internal_ID) as '设备编号' ,Warn_Log.[Type] as '故障类型' ,[Reset] as '故障恢复时间' FROM [Warn_Log],AgvInfo,Assembly_Line where Warn_Log.Agv_id = AgvInfo.ID and AgvInfo.Assembly_Line = Assembly_Line.id and Dt between '", this.dateTimePicker1.Value.ToString(), "' and '", this.dateTimePicker2.Value.ToString(), "' " }); bool flag2 = this.cmb_linelist.Text != ""; if (flag2) { text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[] { '.' })[0]; } bool flag3 = this.cmb_agv.Text != ""; if (flag3) { text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text; } bool flag4 = this.cmb_gz.Text != ""; if (flag4) { text = text + " and warn_log.type like '%" + this.cmb_gz.Text + "%'"; } text += " order by Assembly_Line.ID , dt"; } else { bool flag5 = this.Text == "地标读取日志"; if (flag5) { text = string.Concat(new string[] { "SELECT Dt as '读取时间',Assembly_Line.line_name as '所属线体' ,'* '+convert (nvarchar(10),agvinfo.id) +' / '+convert (nvarchar(10),AgvInfo.Internal_ID) as '设备编号' ,Location_Log.Loc_ID as '位置编号' , Location_Log.Value as 'plc发送值',[Loc_ID2] as 路径编号 ,[Value2] as plc路径值 FROM [Location_Log],AgvInfo,Assembly_Line where Location_Log.Agv_id = AgvInfo.ID and AgvInfo.Assembly_Line = Assembly_Line.id and Dt between '", this.dateTimePicker1.Value.ToString(), "' and '", this.dateTimePicker2.Value.ToString(), "' " }); bool flag6 = this.cmb_linelist.Text != ""; if (flag6) { text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[] { '.' })[0]; } bool flag7 = this.cmb_agv.Text != ""; if (flag7) { text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text; } text += " order by Assembly_Line.ID , dt"; } else { bool flag8 = this.Text == "AGV放行日志"; if (flag8) { text = string.Concat(new string[] { "SELECT Dt as '发生时间',Assembly_Line.line_name as '所属线体' ,'* '+convert (nvarchar(10),agvinfo.id) +' / '+convert (nvarchar(10),AgvInfo.Internal_ID) as '设备编号' ,go_Log.[Type] as '类型' ,go_log.Location as '位置编号' , go_log.plc_Value as 'plc发送值' FROM [go_Log] left join AgvInfo on go_Log.Agv_id = AgvInfo.ID and Dt between '", this.dateTimePicker1.Value.ToString(), "' and '", this.dateTimePicker2.Value.ToString(), "' " }); bool flag9 = this.cmb_agv.Text != ""; if (flag9) { text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text; } text += " right join Assembly_Line on AgvInfo.Assembly_Line = Assembly_Line.id "; bool flag10 = this.cmb_linelist.Text != ""; if (flag10) { text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[] { '.' })[0]; } text += " left join landmarkinfo on landmarkinfo.loc_id = go_log.location"; text += " order by Assembly_Line.ID , dt"; } else { bool flag11 = this.Text == "网络异常日志"; if (flag11) { text = string.Concat(new string[] { "SELECT Dt as '发生时间',Assembly_Line.line_name as '所属线体' ,'* '+convert (nvarchar(10),agvinfo.id) +' / '+convert (nvarchar(10),AgvInfo.Internal_ID) as '设备编号' ,net_Log.[Type] as '故障类型' FROM [net_Log],AgvInfo,Assembly_Line where net_Log.Agv_id = AgvInfo.ID and AgvInfo.Assembly_Line = Assembly_Line.id and Dt between '", this.dateTimePicker1.Value.ToString(), "' and '", this.dateTimePicker2.Value.ToString(), "' " }); bool flag12 = this.cmb_linelist.Text != ""; if (flag12) { text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[] { '.' })[0]; } bool flag13 = this.cmb_agv.Text != ""; if (flag13) { text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text; } text += " order by Assembly_Line.ID , dt"; } else { bool flag14 = this.Text == "充电记录"; if (flag14) { text = string.Concat(new string[] { "SELECT [Start_time] as 充电时间, '* '+convert (nvarchar(10),agvinfo.id) +' / '+convert (nvarchar(10),AgvInfo.Internal_ID) as '设备编号' , Assembly_Line.Line_name as 所属线体 ,[Location_ID] as 充电位置,[Unit] as 充电时长 FROM [Change_Log] , AgvInfo , Assembly_Line where [Change_Log].Agv_ID = AgvInfo.ID and AgvInfo.Assembly_Line = Assembly_Line.ID and [Start_time] between '", this.dateTimePicker1.Value.ToString(), "' and '", this.dateTimePicker2.Value.ToString(), "' " }); bool flag15 = this.cmb_linelist.Text != ""; if (flag15) { text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[] { '.' })[0]; } bool flag16 = this.cmb_agv.Text != ""; if (flag16) { text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text; } text += " order by Assembly_Line.ID , 充电时间"; } } } } } this.ds.Tables.Clear(); this.ds = this.db.connDt(text); this.dataGridView1.DataSource = this.ds.Tables[0]; this.dataGridView1.Columns[0].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss"; this.dataGridView1.Columns[0].Width = 200; this.dataGridView1.Columns[3].Width = 200; bool flag17 = this.Text == "异常报警日志"; if (flag17) { this.dataGridView1.Columns[4].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss"; this.dataGridView1.Columns[4].Width = 200; } } // Token: 0x06000114 RID: 276 RVA: 0x0001FDCC File Offset: 0x0001DFCC private void cmb_linelist_SelectedIndexChanged(object sender, EventArgs e) { bool flag = this.cmb_linelist.Text != ""; if (flag) { this.ds = this.db.connDt("select Internal_ID from AgvInfo where [Assembly_Line] =" + this.cmb_linelist.Text.Split(new char[] { '.' })[0] + " order by Internal_ID"); bool flag2 = this.ds.Tables.Count > 0; if (flag2) { bool flag3 = this.ds.Tables[0].Rows.Count > 0; if (flag3) { this.cmb_agv.Items.Clear(); this.cmb_agv.Items.Add(""); foreach (object obj in this.ds.Tables[0].Rows) { DataRow dataRow = (DataRow)obj; this.cmb_agv.Items.Add(dataRow[0].ToString()); } } } } } // Token: 0x06000115 RID: 277 RVA: 0x0001FF1C File Offset: 0x0001E11C private void button1_Click(object sender, EventArgs e) { bool flag = this.dataGridView1.RowCount > 0; if (flag) { this.SaveAs(); } } // Token: 0x06000116 RID: 278 RVA: 0x0001FF44 File Offset: 0x0001E144 private void SaveAs() { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Execl files (*.xls)|*.xls"; saveFileDialog.FilterIndex = 0; saveFileDialog.RestoreDirectory = true; saveFileDialog.CreatePrompt = true; saveFileDialog.Title = "Export Excel File To"; saveFileDialog.ShowDialog(); Stream stream; try { stream = saveFileDialog.OpenFile(); } catch { return; } StreamWriter streamWriter = new StreamWriter(stream, Encoding.GetEncoding(0)); string text = ""; try { for (int i = 0; i < this.dataGridView1.ColumnCount; i++) { bool flag = i > 0; if (flag) { text += "\t"; } text += this.dataGridView1.Columns[i].HeaderText; } streamWriter.WriteLine(text); for (int j = 0; j < this.dataGridView1.Rows.Count; j++) { string text2 = ""; for (int k = 0; k < this.dataGridView1.Columns.Count; k++) { bool flag2 = k > 0; if (flag2) { text2 += "\t"; } text2 += this.dataGridView1.Rows[j].Cells[k].Value.ToString(); } streamWriter.WriteLine(text2); } streamWriter.Close(); stream.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { streamWriter.Close(); stream.Close(); } } // Token: 0x06000117 RID: 279 RVA: 0x0000A0B4 File Offset: 0x000082B4 private void dataGridView1_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) { e.Row.HeaderCell.Value = string.Format("{0}", e.Row.Index + 1); } // Token: 0x0400020A RID: 522 private ClsDBConn_sql db = new ClsDBConn_sql(); // Token: 0x0400020B RID: 523 private DataSet ds = new DataSet(); } }