Commit 9dfb8d89 LN

点料记录查询

1 个父辈 96d6b947
......@@ -36,6 +36,7 @@
this.Column_Code = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Width = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Height = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_Count = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column_ImageName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.txtCode = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
......@@ -45,6 +46,8 @@
this.label3 = new System.Windows.Forms.Label();
this.dtpStartTime = new System.Windows.Forms.DateTimePicker();
this.label2 = new System.Windows.Forms.Label();
this.btnExport = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.groupBox1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
......@@ -55,6 +58,7 @@
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.btnExport);
this.groupBox1.Controls.Add(this.panel2);
this.groupBox1.Controls.Add(this.txtCode);
this.groupBox1.Controls.Add(this.label1);
......@@ -67,7 +71,7 @@
this.groupBox1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(5, 6);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(1059, 586);
this.groupBox1.Size = new System.Drawing.Size(1164, 586);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "查看点料记录";
......@@ -79,7 +83,7 @@
this.panel2.Controls.Add(this.dataGridView1);
this.panel2.Location = new System.Drawing.Point(8, 31);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(777, 548);
this.panel2.Size = new System.Drawing.Size(864, 548);
this.panel2.TabIndex = 18;
//
// dataGridView1
......@@ -90,6 +94,7 @@
this.Column_Code,
this.Column_Width,
this.Column_Height,
this.Column_Count,
this.Column_ImageName});
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
......@@ -97,7 +102,7 @@
this.dataGridView1.ReadOnly = true;
this.dataGridView1.RowTemplate.Height = 23;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(777, 548);
this.dataGridView1.Size = new System.Drawing.Size(864, 548);
this.dataGridView1.TabIndex = 0;
//
// Column_Num
......@@ -128,6 +133,12 @@
this.Column_Height.ReadOnly = true;
this.Column_Height.Width = 80;
//
// Column_Count
//
this.Column_Count.HeaderText = "数量";
this.Column_Count.Name = "Column_Count";
this.Column_Count.ReadOnly = true;
//
// Column_ImageName
//
this.Column_ImageName.HeaderText = "图片名称";
......@@ -137,7 +148,7 @@
//
// txtCode
//
this.txtCode.Location = new System.Drawing.Point(866, 142);
this.txtCode.Location = new System.Drawing.Point(963, 140);
this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(172, 26);
this.txtCode.TabIndex = 17;
......@@ -145,7 +156,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(820, 145);
this.label1.Location = new System.Drawing.Point(913, 143);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 20);
this.label1.TabIndex = 16;
......@@ -154,7 +165,7 @@
// btnBack
//
this.btnBack.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnBack.Location = new System.Drawing.Point(884, 264);
this.btnBack.Location = new System.Drawing.Point(981, 304);
this.btnBack.Name = "btnBack";
this.btnBack.Size = new System.Drawing.Size(114, 35);
this.btnBack.TabIndex = 15;
......@@ -165,7 +176,7 @@
// btnSearch
//
this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnSearch.Location = new System.Drawing.Point(884, 200);
this.btnSearch.Location = new System.Drawing.Point(981, 198);
this.btnSearch.Name = "btnSearch";
this.btnSearch.Size = new System.Drawing.Size(114, 35);
this.btnSearch.TabIndex = 7;
......@@ -177,7 +188,7 @@
//
this.dtpEndTime.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dtpEndTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpEndTime.Location = new System.Drawing.Point(866, 91);
this.dtpEndTime.Location = new System.Drawing.Point(963, 89);
this.dtpEndTime.Name = "dtpEndTime";
this.dtpEndTime.Size = new System.Drawing.Size(172, 26);
this.dtpEndTime.TabIndex = 5;
......@@ -185,7 +196,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(796, 94);
this.label3.Location = new System.Drawing.Point(885, 92);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(68, 20);
this.label3.TabIndex = 4;
......@@ -195,7 +206,7 @@
//
this.dtpStartTime.CustomFormat = "yyyy-MM-dd HH:mm:ss";
this.dtpStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
this.dtpStartTime.Location = new System.Drawing.Point(866, 40);
this.dtpStartTime.Location = new System.Drawing.Point(963, 38);
this.dtpStartTime.Name = "dtpStartTime";
this.dtpStartTime.Size = new System.Drawing.Size(172, 26);
this.dtpStartTime.TabIndex = 3;
......@@ -203,16 +214,27 @@
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(796, 43);
this.label2.Location = new System.Drawing.Point(885, 41);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(68, 20);
this.label2.TabIndex = 1;
this.label2.Text = "开始时间:";
//
// btnExport
//
this.btnExport.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExport.Location = new System.Drawing.Point(981, 250);
this.btnExport.Name = "btnExport";
this.btnExport.Size = new System.Drawing.Size(114, 35);
this.btnExport.TabIndex = 19;
this.btnExport.Text = "导出列表数据";
this.btnExport.UseVisualStyleBackColor = true;
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
//
// FrmAnalyze
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1070, 598);
this.ClientSize = new System.Drawing.Size(1175, 598);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "FrmAnalyze";
......@@ -244,6 +266,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Code;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Width;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Height;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_Count;
private System.Windows.Forms.DataGridViewTextBoxColumn Column_ImageName;
private System.Windows.Forms.Button btnExport;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
}
}
\ No newline at end of file
......@@ -53,21 +53,20 @@ namespace OnlineStore.AutoCountClient
if (startTime < DateTime.Now.AddDays(-30))
{
MessageBox.Show("只能查询近30天的日志!");
MessageBox.Show("请输入正确的时间(只能查询近30天的日志)");
dtpStartTime.Focus();
return;
}
if (endTime > DateTime.Now)
}
if (startTime> endTime)
{
MessageBox.Show("只能查询近今天之前的日志!");
MessageBox.Show("请输入正确的时间(开始时间必须小于结束时间)");
dtpEndTime.Focus();
return;
}
PreStartTime = startTime;
PreEndTime = endTime;
string code = txtCode.Text.Trim();
lastList = new List<XRayHistory>();
string[][] array = null;
bool result = RobotManager.robot.sQLite.Select(code, startTime.ToString(), endTime.ToString(), out array);
LogUtil.error("查数据【" + code + "】【" + startTime.ToString() + "】【" + endTime.ToString() + "】结果:" + result + "," + RobotManager.robot.sQLite.ErrInfo);
......@@ -76,11 +75,15 @@ namespace OnlineStore.AutoCountClient
LogUtil.info("共查询到【" + array.Length + "】行数据");
this.dataGridView1.Rows.Clear();
int index = 1;
foreach (string[] a in array)
{
DataGridViewRow view = new DataGridViewRow();
view.CreateCells(dataGridView1);
for(int i = 0; i < a.Length; i++)
view.Cells[0].Value = index;
lastList.Add(new XRayHistory(index, a[0], a[1], a[2], a[3], a[4]));
for (int i = 1; i < a.Length; i++)
{
view.Cells[i].Value = a[i];
}
......@@ -96,6 +99,7 @@ namespace OnlineStore.AutoCountClient
//view.Cells[9].Value = point.WeldTemp;
dataGridView1.Rows.Add(view);
index++;
}
}
}
......@@ -103,19 +107,72 @@ namespace OnlineStore.AutoCountClient
{
this.Close();
}
private List<XRayHistory> lastList = new List<XRayHistory>();
private void btnExport_Click(object sender, EventArgs e)
{
if (lastList.Count > 0)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = "";
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
sfd.FileName = "点料记录" + "-" + DateTime.Now.ToString("yyyy:MM:dd:HH:mm").Replace(":", "");
sfd.Filter = @"csv|*.csv";
DialogResult result = sfd.ShowDialog();
if (result.Equals(DialogResult.OK))
{
string filePath = sfd.FileName;
{
if (File.Exists(filePath))
{
File.Delete(filePath);
}
List<string> list = new List<string>();
list.Add("编号,条码,高度,宽度,数量,图片文件名");
foreach(XRayHistory obj in lastList)
{
list.Add(obj.ToCSVStr());
}
File.WriteAllLines(filePath, list.ToArray<string>(), Encoding.GetEncoding("gbk"));
MessageBox.Show("成功导出程序到文件:" + "\r\n" + filePath);
}
}
}
else
{
MessageBox.Show("暂无数据可导出");
}
}
}
public class XRayHistory
{
public XRayHistory(int num,string code, string h, string w, string c, string fname)
{
this.Code = code;
this.Height = h;
this.Width = w;
this.Count = c;
this.FileName = fname;
}
public int Num = 0;
public string Code = "";
public int Height = 0;
public string Height = "";
public int Width = 0;
public string Width = "";
public int Count = 0;
public string Count = "";
public string FileName = "";
public string ToCSVStr()
{
return Num+","+ Code + "," + Height + "," + Width + "," + Count + "," + FileName + ",";
}
}
}
......@@ -129,9 +129,33 @@
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Num.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Code.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Width.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Height.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_Count.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Column_ImageName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="saveFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!