Save results
This commit is contained in:
@@ -202,34 +202,6 @@ namespace CutToLength.Forms
|
||||
return comboBox1.SelectedItem as Tool;
|
||||
}
|
||||
|
||||
private void SaveBins(string file, IEnumerable<Bin> bins)
|
||||
{
|
||||
var writer = new StreamWriter(file);
|
||||
writer.AutoFlush = true;
|
||||
|
||||
var max = bins.Max(b => b.Items.Max(i => i.Length.ToString().Length));
|
||||
var id = 1;
|
||||
|
||||
foreach (var bin in bins)
|
||||
{
|
||||
writer.WriteLine(id++.ToString() + ". " + bin.ToString());
|
||||
|
||||
var groups = bin.Items.GroupBy(i => i.Name);
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
writer.WriteLine(" {0} {1}\" - {2}", ("(" + group.Count() + ")").PadRight(5), group.First().Length.ToString().PadLeft(max + 2), group.Key);
|
||||
}
|
||||
|
||||
writer.WriteLine("---------------------------------------------------------------------");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
|
||||
Process.Start(file);
|
||||
}
|
||||
|
||||
private void toolStripButton1_Click(object sender, EventArgs e)
|
||||
{
|
||||
Open();
|
||||
|
||||
40
CutToLength/Forms/ResultsForm.Designer.cs
generated
40
CutToLength/Forms/ResultsForm.Designer.cs
generated
@@ -29,7 +29,7 @@
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
@@ -43,6 +43,8 @@
|
||||
this.binBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.binLayoutView1 = new CutToLength.Controls.BinLayoutView();
|
||||
this.uIItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
@@ -55,6 +57,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).BeginInit();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dataGridView1
|
||||
@@ -77,7 +80,7 @@
|
||||
this.dataGridView1.Name = "dataGridView1";
|
||||
this.dataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
||||
this.dataGridView1.RowTemplate.Height = 25;
|
||||
this.dataGridView1.Size = new System.Drawing.Size(994, 277);
|
||||
this.dataGridView1.Size = new System.Drawing.Size(994, 253);
|
||||
this.dataGridView1.TabIndex = 0;
|
||||
this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
|
||||
//
|
||||
@@ -85,7 +88,7 @@
|
||||
//
|
||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
|
||||
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
@@ -97,8 +100,8 @@
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
||||
this.splitContainer1.Panel2.Controls.Add(this.label1);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(994, 531);
|
||||
this.splitContainer1.SplitterDistance = 277;
|
||||
this.splitContainer1.Size = new System.Drawing.Size(994, 507);
|
||||
this.splitContainer1.SplitterDistance = 253;
|
||||
this.splitContainer1.TabIndex = 2;
|
||||
//
|
||||
// splitContainer2
|
||||
@@ -176,8 +179,8 @@
|
||||
// utilizationDataGridViewTextBoxColumn
|
||||
//
|
||||
this.utilizationDataGridViewTextBoxColumn.DataPropertyName = "Utilization";
|
||||
dataGridViewCellStyle3.Format = "P2";
|
||||
this.utilizationDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle3;
|
||||
dataGridViewCellStyle5.Format = "P2";
|
||||
this.utilizationDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle5;
|
||||
this.utilizationDataGridViewTextBoxColumn.HeaderText = "Utilization";
|
||||
this.utilizationDataGridViewTextBoxColumn.Name = "utilizationDataGridViewTextBoxColumn";
|
||||
this.utilizationDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
@@ -201,11 +204,29 @@
|
||||
//
|
||||
this.uIItemBindingSource.DataSource = typeof(CutToLength.UIItem);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.saveToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(994, 24);
|
||||
this.menuStrip1.TabIndex = 5;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
// ResultsForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.ClientSize = new System.Drawing.Size(994, 531);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Name = "ResultsForm";
|
||||
this.ShowIcon = false;
|
||||
@@ -224,7 +245,10 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).EndInit();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -243,5 +267,7 @@
|
||||
private System.Windows.Forms.SplitContainer splitContainer2;
|
||||
private System.Windows.Forms.DataGridView dataGridView2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -52,5 +54,55 @@ namespace CutToLength.Forms
|
||||
get { return dataGridView1.DataSource as List<Bin>; }
|
||||
set { dataGridView1.DataSource = value; }
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var s = new SaveFileDialog();
|
||||
|
||||
var today = DateTime.Today;
|
||||
var name = $"{today.Year}-{today.Month.ToString().PadLeft(2, '0')}-{today.Day.ToString().PadLeft(2, '0')} cut list.txt";
|
||||
|
||||
s.FileName = name;
|
||||
s.Filter = "Text File|*.txt";
|
||||
|
||||
if (s.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SaveBins(s.FileName);
|
||||
}
|
||||
|
||||
private void SaveBins(string file)
|
||||
{
|
||||
var writer = new StreamWriter(file);
|
||||
writer.AutoFlush = true;
|
||||
|
||||
var max = Bins.Max(b => b.Items.Max(i => i.Length.ToString().Length));
|
||||
var id = 1;
|
||||
|
||||
foreach (var bin in Bins)
|
||||
{
|
||||
writer.WriteLine(id++.ToString() + ". " + bin.ToString());
|
||||
|
||||
var groups = bin.Items.GroupBy(i => i.Name);
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var count = group.Count();
|
||||
var length = group.First().Length.ToString().PadLeft(max + 2);
|
||||
var name = group.Key;
|
||||
|
||||
writer.WriteLine($" {count}pcs @ {length}\" LG Tag:{name}");
|
||||
}
|
||||
|
||||
writer.WriteLine("---------------------------------------------------------------------");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
writer.Close();
|
||||
|
||||
Process.Start(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,13 @@
|
||||
<metadata name="binBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="binBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="uIItemBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>165, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>560, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
Reference in New Issue
Block a user