1.初始化项目。保险起见bin目录完整提交 2.基于现场代码为调整过的初始项目(此次提交还未解决代码差异问题)
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.DataVisualization.Charting;
|
||||
|
||||
namespace AGVSystem
|
||||
{
|
||||
// Token: 0x02000020 RID: 32
|
||||
public partial class frmchangefind : Form
|
||||
{
|
||||
// Token: 0x060001CC RID: 460 RVA: 0x0004C7A0 File Offset: 0x0004A9A0
|
||||
public frmchangefind(string str)
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Text = str;
|
||||
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: 0x060001CD RID: 461 RVA: 0x0004C838 File Offset: 0x0004AA38
|
||||
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: 0x060001CE RID: 462 RVA: 0x0004C940 File Offset: 0x0004AB40
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
string 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 充电位置,time_long 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 flag = this.cmb_linelist.Text != "";
|
||||
if (flag)
|
||||
{
|
||||
text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0];
|
||||
}
|
||||
bool flag2 = this.cmb_agv.Text != "";
|
||||
if (flag2)
|
||||
{
|
||||
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";
|
||||
bool flag3 = this.ds.Tables[0].Rows.Count > 0;
|
||||
if (flag3)
|
||||
{
|
||||
text = string.Concat(new string[]
|
||||
{
|
||||
"SELECT agvinfo.id as '设备编号', COUNT(*) 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 flag4 = this.cmb_linelist.Text != "";
|
||||
if (flag4)
|
||||
{
|
||||
text = text + " and Assembly_Line.id= " + this.cmb_linelist.Text.Split(new char[]
|
||||
{
|
||||
'.'
|
||||
})[0];
|
||||
}
|
||||
bool flag5 = this.cmb_agv.Text != "";
|
||||
if (flag5)
|
||||
{
|
||||
text = text + " and AgvInfo.Internal_ID= " + this.cmb_agv.Text;
|
||||
}
|
||||
text += " group by agvinfo.id ";
|
||||
text += " order by agvinfo.id";
|
||||
DataSet dataSet = this.db.connDt(text);
|
||||
List<string> list = new List<string>();
|
||||
List<int> list2 = new List<int>();
|
||||
foreach (object obj in dataSet.Tables[0].Rows)
|
||||
{
|
||||
DataRow dataRow = (DataRow)obj;
|
||||
list.Add(dataRow[0].ToString() + "号");
|
||||
list2.Add((int)Convert.ToInt16(dataRow[1].ToString()));
|
||||
}
|
||||
this.chart1.Series[0].Points.DataBindXY(list, new IEnumerable[]
|
||||
{
|
||||
list2
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001CF RID: 463 RVA: 0x0004CC68 File Offset: 0x0004AE68
|
||||
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: 0x060001D0 RID: 464 RVA: 0x0004CDB8 File Offset: 0x0004AFB8
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
bool flag = this.dataGridView1.RowCount > 0;
|
||||
if (flag)
|
||||
{
|
||||
this.SaveAs();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060001D1 RID: 465 RVA: 0x0004CDE0 File Offset: 0x0004AFE0
|
||||
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: 0x060001D2 RID: 466 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: 0x0400059C RID: 1436
|
||||
private ClsDBConn_sql db = new ClsDBConn_sql();
|
||||
|
||||
// Token: 0x0400059D RID: 1437
|
||||
private DataSet ds = new DataSet();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user