feat: Add cut method and material shape to saved reports
Include cutting tool name and material shape in the text report output. This provides better context when reviewing saved cut lists. Changes: - BinFileSaver: Add CutMethod and MaterialShape properties - ResultsForm: Pass cut method and material to file saver - IMainView: Extend ShowResults with additional parameters - MainFormPresenter: Use document name for save filename if available Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,16 @@ namespace CutList.Core
|
|||||||
|
|
||||||
public bool OpenFileAfterSave { get; set; }
|
public bool OpenFileAfterSave { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The cutting method/tool used (e.g., "Miter Saw", "Table Saw").
|
||||||
|
/// </summary>
|
||||||
|
public string? CutMethod { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The material shape (e.g., "Round Tube", "Square Tube", "Flat Bar").
|
||||||
|
/// </summary>
|
||||||
|
public string? MaterialShape { get; set; }
|
||||||
|
|
||||||
public BinFileSaver(IEnumerable<Bin> bins)
|
public BinFileSaver(IEnumerable<Bin> bins)
|
||||||
{
|
{
|
||||||
_bins = bins ?? throw new ArgumentNullException(nameof(bins));
|
_bins = bins ?? throw new ArgumentNullException(nameof(bins));
|
||||||
@@ -74,10 +84,24 @@ namespace CutList.Core
|
|||||||
var totalItems = _bins.Sum(b => b.Items.Count);
|
var totalItems = _bins.Sum(b => b.Items.Count);
|
||||||
|
|
||||||
writer.WriteLine("CUT LIST");
|
writer.WriteLine("CUT LIST");
|
||||||
writer.WriteLine($"Date: {DateTime.Now:g}");
|
WriteSeparator(writer, '=');
|
||||||
writer.WriteLine($"Total stock bars needed: {totalBars}");
|
|
||||||
writer.WriteLine($"Total pieces to cut: {totalItems}");
|
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
|
WriteAlignedLine(writer, "Date", DateTime.Now.ToString("g"));
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(CutMethod))
|
||||||
|
WriteAlignedLine(writer, "Cut Method", CutMethod);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(MaterialShape))
|
||||||
|
WriteAlignedLine(writer, "Material", MaterialShape);
|
||||||
|
|
||||||
|
WriteAlignedLine(writer, "Stock Bars Needed", totalBars.ToString());
|
||||||
|
WriteAlignedLine(writer, "Total Pieces", totalItems.ToString());
|
||||||
|
writer.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void WriteAlignedLine(TextWriter writer, string label, string value, int labelWidth = 20)
|
||||||
|
{
|
||||||
|
writer.WriteLine($" {label.PadRight(labelWidth)} {value}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteBinSummary(TextWriter writer, Bin bin, int id)
|
private void WriteBinSummary(TextWriter writer, Bin bin, int id)
|
||||||
@@ -85,8 +109,9 @@ namespace CutList.Core
|
|||||||
var stockLength = FormatHelper.ConvertToMixedFraction(bin.Length);
|
var stockLength = FormatHelper.ConvertToMixedFraction(bin.Length);
|
||||||
var dropLength = FormatHelper.ConvertToMixedFraction(bin.RemainingLength);
|
var dropLength = FormatHelper.ConvertToMixedFraction(bin.RemainingLength);
|
||||||
|
|
||||||
writer.WriteLine(new string('─', 50));
|
WriteSeparator(writer);
|
||||||
writer.WriteLine($"BAR #{id} - Start with {stockLength}\" stock");
|
|
||||||
|
writer.WriteLine($"BAR #{id} - Length: {stockLength}\"");
|
||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
writer.WriteLine(" Cut these pieces:");
|
writer.WriteLine(" Cut these pieces:");
|
||||||
|
|
||||||
@@ -97,6 +122,11 @@ namespace CutList.Core
|
|||||||
writer.WriteLine();
|
writer.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void WriteSeparator(TextWriter writer, char c = '─', int length = 50)
|
||||||
|
{
|
||||||
|
writer.WriteLine(new string(c, length));
|
||||||
|
}
|
||||||
|
|
||||||
private void WriteBinItems(TextWriter writer, Bin bin)
|
private void WriteBinItems(TextWriter writer, Bin bin)
|
||||||
{
|
{
|
||||||
var groups = bin.Items
|
var groups = bin.Items
|
||||||
@@ -128,14 +158,14 @@ namespace CutList.Core
|
|||||||
|
|
||||||
string fmt(double v) => FormatHelper.ConvertToMixedFraction(v);
|
string fmt(double v) => FormatHelper.ConvertToMixedFraction(v);
|
||||||
|
|
||||||
writer.WriteLine(new string('═', 50));
|
WriteSeparator(writer, '=');
|
||||||
writer.WriteLine("SUMMARY");
|
writer.WriteLine("SUMMARY");
|
||||||
writer.WriteLine($" Stock bars needed: {totalBars}");
|
writer.WriteLine();
|
||||||
writer.WriteLine($" Total pieces to cut: {totalItems}");
|
WriteAlignedLine(writer, "Stock Bars Needed", totalBars.ToString());
|
||||||
writer.WriteLine($" Total material used: {fmt(totalStock)}\"");
|
WriteAlignedLine(writer, "Total Pieces", totalItems.ToString());
|
||||||
writer.WriteLine($" Total drop/waste: {fmt(totalDrop)}\"");
|
WriteAlignedLine(writer, "Total Material Used", $"{fmt(totalStock)}\"");
|
||||||
writer.WriteLine(new string('═', 50));
|
WriteAlignedLine(writer, "Total Drop/Waste", $"{fmt(totalDrop)}\"");
|
||||||
|
WriteSeparator(writer, '=');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
340
CutList/Forms/ResultsForm.Designer.cs
generated
340
CutList/Forms/ResultsForm.Designer.cs
generated
@@ -28,237 +28,233 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
components = new System.ComponentModel.Container();
|
||||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();
|
||||||
this.dataGridView1 = new System.Windows.Forms.DataGridView();
|
dataGridView1 = new DataGridView();
|
||||||
this.countDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
countDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.spacingDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
spacingDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
lengthDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.usedLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
usedLengthDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.remainingLengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
remainingLengthDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.utilizationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
utilizationDataGridViewTextBoxColumn = new DataGridViewTextBoxColumn();
|
||||||
this.binBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
binBindingSource = new BindingSource(components);
|
||||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
splitContainer1 = new SplitContainer();
|
||||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
splitContainer2 = new SplitContainer();
|
||||||
this.dataGridView2 = new System.Windows.Forms.DataGridView();
|
dataGridView2 = new DataGridView();
|
||||||
this.binLayoutView1 = new CutList.Controls.BinLayoutView();
|
binLayoutView1 = new CutList.Controls.BinLayoutView();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
label1 = new Label();
|
||||||
this.uIItemBindingSource = new System.Windows.Forms.BindingSource(this.components);
|
uIItemBindingSource = new BindingSource(components);
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
saveToolStripMenuItem = new ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView1).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)binBindingSource).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)splitContainer1).BeginInit();
|
||||||
this.splitContainer1.Panel1.SuspendLayout();
|
splitContainer1.Panel1.SuspendLayout();
|
||||||
this.splitContainer1.Panel2.SuspendLayout();
|
splitContainer1.Panel2.SuspendLayout();
|
||||||
this.splitContainer1.SuspendLayout();
|
splitContainer1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)splitContainer2).BeginInit();
|
||||||
this.splitContainer2.Panel1.SuspendLayout();
|
splitContainer2.Panel1.SuspendLayout();
|
||||||
this.splitContainer2.Panel2.SuspendLayout();
|
splitContainer2.Panel2.SuspendLayout();
|
||||||
this.splitContainer2.SuspendLayout();
|
splitContainer2.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView2).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)uIItemBindingSource).BeginInit();
|
||||||
this.menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dataGridView1
|
// dataGridView1
|
||||||
//
|
//
|
||||||
this.dataGridView1.AutoGenerateColumns = false;
|
dataGridView1.AutoGenerateColumns = false;
|
||||||
this.dataGridView1.BackgroundColor = System.Drawing.Color.White;
|
dataGridView1.BackgroundColor = Color.White;
|
||||||
this.dataGridView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
dataGridView1.BorderStyle = BorderStyle.None;
|
||||||
this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
dataGridView1.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
||||||
this.dataGridView1.ColumnHeadersHeight = 30;
|
dataGridView1.ColumnHeadersHeight = 30;
|
||||||
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
dataGridView1.Columns.AddRange(new DataGridViewColumn[] { countDataGridViewTextBoxColumn, spacingDataGridViewTextBoxColumn, lengthDataGridViewTextBoxColumn, usedLengthDataGridViewTextBoxColumn, remainingLengthDataGridViewTextBoxColumn, utilizationDataGridViewTextBoxColumn });
|
||||||
this.countDataGridViewTextBoxColumn,
|
dataGridView1.DataSource = binBindingSource;
|
||||||
this.spacingDataGridViewTextBoxColumn,
|
dataGridView1.Dock = DockStyle.Fill;
|
||||||
this.lengthDataGridViewTextBoxColumn,
|
dataGridView1.GridColor = Color.FromArgb(224, 224, 224);
|
||||||
this.usedLengthDataGridViewTextBoxColumn,
|
dataGridView1.Location = new Point(0, 0);
|
||||||
this.remainingLengthDataGridViewTextBoxColumn,
|
dataGridView1.Name = "dataGridView1";
|
||||||
this.utilizationDataGridViewTextBoxColumn});
|
dataGridView1.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
||||||
this.dataGridView1.DataSource = this.binBindingSource;
|
dataGridView1.Size = new Size(959, 469);
|
||||||
this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
dataGridView1.TabIndex = 0;
|
||||||
this.dataGridView1.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
dataGridView1.RowEnter += dataGridView1_RowEnter;
|
||||||
this.dataGridView1.Location = new System.Drawing.Point(0, 0);
|
//
|
||||||
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, 253);
|
|
||||||
this.dataGridView1.TabIndex = 0;
|
|
||||||
this.dataGridView1.RowEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_RowEnter);
|
|
||||||
//
|
|
||||||
// countDataGridViewTextBoxColumn
|
// countDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.countDataGridViewTextBoxColumn.DataPropertyName = "Count";
|
countDataGridViewTextBoxColumn.DataPropertyName = "Count";
|
||||||
this.countDataGridViewTextBoxColumn.HeaderText = "Count";
|
countDataGridViewTextBoxColumn.HeaderText = "Count";
|
||||||
this.countDataGridViewTextBoxColumn.Name = "countDataGridViewTextBoxColumn";
|
countDataGridViewTextBoxColumn.Name = "countDataGridViewTextBoxColumn";
|
||||||
this.countDataGridViewTextBoxColumn.Width = 60;
|
countDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
//
|
countDataGridViewTextBoxColumn.Width = 60;
|
||||||
|
//
|
||||||
// spacingDataGridViewTextBoxColumn
|
// spacingDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.spacingDataGridViewTextBoxColumn.DataPropertyName = "Spacing";
|
spacingDataGridViewTextBoxColumn.DataPropertyName = "Spacing";
|
||||||
this.spacingDataGridViewTextBoxColumn.HeaderText = "Spacing";
|
spacingDataGridViewTextBoxColumn.HeaderText = "Spacing";
|
||||||
this.spacingDataGridViewTextBoxColumn.Name = "spacingDataGridViewTextBoxColumn";
|
spacingDataGridViewTextBoxColumn.Name = "spacingDataGridViewTextBoxColumn";
|
||||||
|
spacingDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// lengthDataGridViewTextBoxColumn
|
// lengthDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
|
lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
|
||||||
this.lengthDataGridViewTextBoxColumn.HeaderText = "Length";
|
lengthDataGridViewTextBoxColumn.HeaderText = "Length";
|
||||||
this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
|
lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
|
||||||
|
lengthDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// usedLengthDataGridViewTextBoxColumn
|
// usedLengthDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.usedLengthDataGridViewTextBoxColumn.DataPropertyName = "UsedLength";
|
usedLengthDataGridViewTextBoxColumn.DataPropertyName = "UsedLength";
|
||||||
this.usedLengthDataGridViewTextBoxColumn.HeaderText = "Used Length";
|
usedLengthDataGridViewTextBoxColumn.HeaderText = "Used Length";
|
||||||
this.usedLengthDataGridViewTextBoxColumn.Name = "usedLengthDataGridViewTextBoxColumn";
|
usedLengthDataGridViewTextBoxColumn.Name = "usedLengthDataGridViewTextBoxColumn";
|
||||||
this.usedLengthDataGridViewTextBoxColumn.ReadOnly = true;
|
usedLengthDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// remainingLengthDataGridViewTextBoxColumn
|
// remainingLengthDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.remainingLengthDataGridViewTextBoxColumn.DataPropertyName = "RemainingLength";
|
remainingLengthDataGridViewTextBoxColumn.DataPropertyName = "RemainingLength";
|
||||||
this.remainingLengthDataGridViewTextBoxColumn.HeaderText = "Remaining Length";
|
remainingLengthDataGridViewTextBoxColumn.HeaderText = "Remaining Length";
|
||||||
this.remainingLengthDataGridViewTextBoxColumn.Name = "remainingLengthDataGridViewTextBoxColumn";
|
remainingLengthDataGridViewTextBoxColumn.Name = "remainingLengthDataGridViewTextBoxColumn";
|
||||||
this.remainingLengthDataGridViewTextBoxColumn.ReadOnly = true;
|
remainingLengthDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
this.remainingLengthDataGridViewTextBoxColumn.Width = 150;
|
remainingLengthDataGridViewTextBoxColumn.Width = 150;
|
||||||
//
|
//
|
||||||
// utilizationDataGridViewTextBoxColumn
|
// utilizationDataGridViewTextBoxColumn
|
||||||
//
|
//
|
||||||
this.utilizationDataGridViewTextBoxColumn.DataPropertyName = "Utilization";
|
utilizationDataGridViewTextBoxColumn.DataPropertyName = "Utilization";
|
||||||
dataGridViewCellStyle1.Format = "P2";
|
dataGridViewCellStyle1.Format = "P2";
|
||||||
this.utilizationDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
|
utilizationDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
|
||||||
this.utilizationDataGridViewTextBoxColumn.HeaderText = "Utilization";
|
utilizationDataGridViewTextBoxColumn.HeaderText = "Utilization";
|
||||||
this.utilizationDataGridViewTextBoxColumn.Name = "utilizationDataGridViewTextBoxColumn";
|
utilizationDataGridViewTextBoxColumn.Name = "utilizationDataGridViewTextBoxColumn";
|
||||||
this.utilizationDataGridViewTextBoxColumn.ReadOnly = true;
|
utilizationDataGridViewTextBoxColumn.ReadOnly = true;
|
||||||
//
|
//
|
||||||
// binBindingSource
|
// binBindingSource
|
||||||
//
|
//
|
||||||
this.binBindingSource.DataSource = typeof(CutList.Core.BinGroup);
|
binBindingSource.DataSource = typeof(Core.BinGroup);
|
||||||
//
|
//
|
||||||
// splitContainer1
|
// splitContainer1
|
||||||
//
|
//
|
||||||
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
|
splitContainer1.Dock = DockStyle.Fill;
|
||||||
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
|
splitContainer1.FixedPanel = FixedPanel.Panel2;
|
||||||
this.splitContainer1.Location = new System.Drawing.Point(0, 24);
|
splitContainer1.Location = new Point(0, 24);
|
||||||
this.splitContainer1.Name = "splitContainer1";
|
splitContainer1.Name = "splitContainer1";
|
||||||
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
splitContainer1.Orientation = Orientation.Horizontal;
|
||||||
//
|
//
|
||||||
// splitContainer1.Panel1
|
// splitContainer1.Panel1
|
||||||
//
|
//
|
||||||
this.splitContainer1.Panel1.Controls.Add(this.dataGridView1);
|
splitContainer1.Panel1.Controls.Add(dataGridView1);
|
||||||
//
|
//
|
||||||
// splitContainer1.Panel2
|
// splitContainer1.Panel2
|
||||||
//
|
//
|
||||||
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
|
splitContainer1.Panel2.Controls.Add(splitContainer2);
|
||||||
this.splitContainer1.Panel2.Controls.Add(this.label1);
|
splitContainer1.Panel2.Controls.Add(label1);
|
||||||
this.splitContainer1.Size = new System.Drawing.Size(994, 507);
|
splitContainer1.Size = new Size(959, 723);
|
||||||
this.splitContainer1.SplitterDistance = 253;
|
splitContainer1.SplitterDistance = 469;
|
||||||
this.splitContainer1.TabIndex = 2;
|
splitContainer1.TabIndex = 2;
|
||||||
//
|
//
|
||||||
// splitContainer2
|
// splitContainer2
|
||||||
//
|
//
|
||||||
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
|
splitContainer2.Dock = DockStyle.Fill;
|
||||||
this.splitContainer2.Location = new System.Drawing.Point(0, 34);
|
splitContainer2.Location = new Point(0, 34);
|
||||||
this.splitContainer2.Name = "splitContainer2";
|
splitContainer2.Name = "splitContainer2";
|
||||||
//
|
//
|
||||||
// splitContainer2.Panel1
|
// splitContainer2.Panel1
|
||||||
//
|
//
|
||||||
this.splitContainer2.Panel1.Controls.Add(this.dataGridView2);
|
splitContainer2.Panel1.Controls.Add(dataGridView2);
|
||||||
//
|
//
|
||||||
// splitContainer2.Panel2
|
// splitContainer2.Panel2
|
||||||
//
|
//
|
||||||
this.splitContainer2.Panel2.Controls.Add(this.binLayoutView1);
|
splitContainer2.Panel2.Controls.Add(binLayoutView1);
|
||||||
this.splitContainer2.Size = new System.Drawing.Size(994, 216);
|
splitContainer2.Size = new Size(959, 216);
|
||||||
this.splitContainer2.SplitterDistance = 276;
|
splitContainer2.SplitterDistance = 266;
|
||||||
this.splitContainer2.TabIndex = 1;
|
splitContainer2.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// dataGridView2
|
// dataGridView2
|
||||||
//
|
//
|
||||||
this.dataGridView2.BackgroundColor = System.Drawing.Color.White;
|
dataGridView2.BackgroundColor = Color.White;
|
||||||
this.dataGridView2.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
dataGridView2.BorderStyle = BorderStyle.None;
|
||||||
this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
dataGridView2.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
||||||
this.dataGridView2.ColumnHeadersHeight = 30;
|
dataGridView2.ColumnHeadersHeight = 30;
|
||||||
this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill;
|
dataGridView2.Dock = DockStyle.Fill;
|
||||||
this.dataGridView2.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
dataGridView2.GridColor = Color.FromArgb(224, 224, 224);
|
||||||
this.dataGridView2.Location = new System.Drawing.Point(0, 0);
|
dataGridView2.Location = new Point(0, 0);
|
||||||
this.dataGridView2.Name = "dataGridView2";
|
dataGridView2.Name = "dataGridView2";
|
||||||
this.dataGridView2.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
|
dataGridView2.RowHeadersBorderStyle = DataGridViewHeaderBorderStyle.Single;
|
||||||
this.dataGridView2.RowTemplate.Height = 25;
|
dataGridView2.Size = new Size(266, 216);
|
||||||
this.dataGridView2.Size = new System.Drawing.Size(276, 216);
|
dataGridView2.TabIndex = 1;
|
||||||
this.dataGridView2.TabIndex = 1;
|
|
||||||
//
|
//
|
||||||
// binLayoutView1
|
// binLayoutView1
|
||||||
//
|
//
|
||||||
this.binLayoutView1.BackColor = System.Drawing.Color.White;
|
binLayoutView1.BackColor = Color.White;
|
||||||
this.binLayoutView1.Bin = null;
|
binLayoutView1.Bin = null;
|
||||||
this.binLayoutView1.Dock = System.Windows.Forms.DockStyle.Fill;
|
binLayoutView1.BinBackgroundColor = Color.Pink;
|
||||||
this.binLayoutView1.Location = new System.Drawing.Point(0, 0);
|
binLayoutView1.Dock = DockStyle.Fill;
|
||||||
this.binLayoutView1.Name = "binLayoutView1";
|
binLayoutView1.ItemBackgroundColor = Color.White;
|
||||||
this.binLayoutView1.Size = new System.Drawing.Size(714, 216);
|
binLayoutView1.ItemBorderColor = Color.Blue;
|
||||||
this.binLayoutView1.TabIndex = 1;
|
binLayoutView1.Location = new Point(0, 0);
|
||||||
this.binLayoutView1.Text = "class11";
|
binLayoutView1.Name = "binLayoutView1";
|
||||||
|
binLayoutView1.Size = new Size(689, 216);
|
||||||
|
binLayoutView1.TabIndex = 1;
|
||||||
|
binLayoutView1.Text = "class11";
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.BackColor = System.Drawing.Color.LightSlateGray;
|
label1.BackColor = Color.LightSlateGray;
|
||||||
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
|
label1.Dock = DockStyle.Top;
|
||||||
this.label1.Font = new System.Drawing.Font("Segoe UI", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
label1.Font = new Font("Segoe UI", 14.25F, FontStyle.Bold, GraphicsUnit.Point, 0);
|
||||||
this.label1.ForeColor = System.Drawing.Color.White;
|
label1.ForeColor = Color.White;
|
||||||
this.label1.Location = new System.Drawing.Point(0, 0);
|
label1.Location = new Point(0, 0);
|
||||||
this.label1.Name = "label1";
|
label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(994, 34);
|
label1.Size = new Size(959, 34);
|
||||||
this.label1.TabIndex = 2;
|
label1.TabIndex = 2;
|
||||||
this.label1.Text = "Items";
|
label1.Text = "Items";
|
||||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
label1.TextAlign = ContentAlignment.MiddleCenter;
|
||||||
//
|
//
|
||||||
// uIItemBindingSource
|
// uIItemBindingSource
|
||||||
//
|
//
|
||||||
this.uIItemBindingSource.DataSource = typeof(CutList.Models.PartInputItem);
|
uIItemBindingSource.DataSource = typeof(Models.PartInputItem);
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
menuStrip1.Items.AddRange(new ToolStripItem[] { saveToolStripMenuItem });
|
||||||
this.saveToolStripMenuItem});
|
menuStrip1.Location = new Point(0, 0);
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
menuStrip1.Size = new Size(959, 24);
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(994, 24);
|
menuStrip1.TabIndex = 5;
|
||||||
this.menuStrip1.TabIndex = 5;
|
menuStrip1.Text = "menuStrip1";
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
|
||||||
//
|
//
|
||||||
// saveToolStripMenuItem
|
// saveToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
|
saveToolStripMenuItem.Size = new Size(43, 20);
|
||||||
this.saveToolStripMenuItem.Text = "Save";
|
saveToolStripMenuItem.Text = "Save";
|
||||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
saveToolStripMenuItem.Click += saveToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// ResultsForm
|
// ResultsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
AutoScaleMode = AutoScaleMode.None;
|
||||||
this.ClientSize = new System.Drawing.Size(994, 531);
|
ClientSize = new Size(959, 747);
|
||||||
this.Controls.Add(this.splitContainer1);
|
Controls.Add(splitContainer1);
|
||||||
this.Controls.Add(this.menuStrip1);
|
Controls.Add(menuStrip1);
|
||||||
this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
Font = new Font("Segoe UI", 9.75F, FontStyle.Regular, GraphicsUnit.Point, 0);
|
||||||
this.Name = "ResultsForm";
|
Name = "ResultsForm";
|
||||||
this.ShowIcon = false;
|
ShowIcon = false;
|
||||||
this.ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
StartPosition = FormStartPosition.CenterParent;
|
||||||
this.Text = "Results";
|
Text = "Results";
|
||||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
((System.ComponentModel.ISupportInitialize)dataGridView1).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
|
((System.ComponentModel.ISupportInitialize)binBindingSource).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.binBindingSource)).EndInit();
|
splitContainer1.Panel1.ResumeLayout(false);
|
||||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
splitContainer1.Panel2.ResumeLayout(false);
|
||||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)splitContainer1).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
splitContainer1.ResumeLayout(false);
|
||||||
this.splitContainer1.ResumeLayout(false);
|
splitContainer2.Panel1.ResumeLayout(false);
|
||||||
this.splitContainer2.Panel1.ResumeLayout(false);
|
splitContainer2.Panel2.ResumeLayout(false);
|
||||||
this.splitContainer2.Panel2.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)splitContainer2).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit();
|
splitContainer2.ResumeLayout(false);
|
||||||
this.splitContainer2.ResumeLayout(false);
|
((System.ComponentModel.ISupportInitialize)dataGridView2).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView2)).EndInit();
|
((System.ComponentModel.ISupportInitialize)uIItemBindingSource).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.uIItemBindingSource)).EndInit();
|
menuStrip1.ResumeLayout(false);
|
||||||
this.menuStrip1.ResumeLayout(false);
|
menuStrip1.PerformLayout();
|
||||||
this.menuStrip1.PerformLayout();
|
ResumeLayout(false);
|
||||||
this.ResumeLayout(false);
|
PerformLayout();
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,15 +5,19 @@ namespace CutList.Forms
|
|||||||
public partial class ResultsForm : Form
|
public partial class ResultsForm : Form
|
||||||
{
|
{
|
||||||
private string filename;
|
private string filename;
|
||||||
|
private string cutMethod;
|
||||||
|
private string? materialShape;
|
||||||
private List<Bin> _originalBins = new List<Bin>();
|
private List<Bin> _originalBins = new List<Bin>();
|
||||||
|
|
||||||
public ResultsForm(string filename)
|
public ResultsForm(string filename, string cutMethod, string? materialShape = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
dataGridView1.DrawRowNumbers();
|
dataGridView1.DrawRowNumbers();
|
||||||
dataGridView2.DrawRowNumbers();
|
dataGridView2.DrawRowNumbers();
|
||||||
|
|
||||||
this.filename = filename;
|
this.filename = filename;
|
||||||
|
this.cutMethod = cutMethod;
|
||||||
|
this.materialShape = materialShape;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
|
private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
|
||||||
@@ -48,7 +52,11 @@ namespace CutList.Forms
|
|||||||
|
|
||||||
public void Save(string filepath)
|
public void Save(string filepath)
|
||||||
{
|
{
|
||||||
var writer = new BinFileSaver(_originalBins);
|
var writer = new BinFileSaver(_originalBins)
|
||||||
|
{
|
||||||
|
CutMethod = cutMethod,
|
||||||
|
MaterialShape = materialShape
|
||||||
|
};
|
||||||
writer.SaveBinsToFile(filepath);
|
writer.SaveBinsToFile(filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<root>
|
<root>
|
||||||
<!--
|
<!--
|
||||||
Microsoft ResX Schema
|
Microsoft ResX Schema
|
||||||
|
|
||||||
Version 2.0
|
Version 2.0
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
The primary goals of this format is to allow a simple XML format
|
||||||
that is mostly human readable. The generation and parsing of the
|
that is mostly human readable. The generation and parsing of the
|
||||||
various data types are done through the TypeConverter classes
|
various data types are done through the TypeConverter classes
|
||||||
associated with the data types.
|
associated with the data types.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
... ado.net/XML headers & schema ...
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
<resheader name="version">2.0</resheader>
|
<resheader name="version">2.0</resheader>
|
||||||
@@ -26,36 +26,36 @@
|
|||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
<comment>This is a comment</comment>
|
<comment>This is a comment</comment>
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
There are any number of "resheader" rows that contain simple
|
||||||
name/value pairs.
|
name/value pairs.
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
text/value conversion through the TypeConverter architecture.
|
text/value conversion through the TypeConverter architecture.
|
||||||
Classes that don't support this are serialized and stored with the
|
Classes that don't support this are serialized and stored with the
|
||||||
mimetype set.
|
mimetype set.
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
The mimetype is used for serialized objects, and tells the
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
read any of the formats listed below.
|
read any of the formats listed below.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
value : The object must be serialized with
|
value : The object must be serialized with
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
value : The object must be serialized into a byte array
|
value : The object must be serialized into a byte array
|
||||||
: using a System.ComponentModel.TypeConverter
|
: using a System.ComponentModel.TypeConverter
|
||||||
: and then encoded with base64 encoding.
|
: and then encoded with base64 encoding.
|
||||||
-->
|
-->
|
||||||
|
|||||||
@@ -25,6 +25,11 @@ namespace CutList.Presenters
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Tool SelectedTool { get; }
|
Tool SelectedTool { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the currently selected material shape from the view.
|
||||||
|
/// </summary>
|
||||||
|
string? SelectedMaterialShape { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Displays an error message to the user.
|
/// Displays an error message to the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -77,7 +82,11 @@ namespace CutList.Presenters
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shows the results form with the packing results.
|
/// Shows the results form with the packing results.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ShowResults(List<Bin> bins, string fileName);
|
/// <param name="bins">The packed bins to display</param>
|
||||||
|
/// <param name="fileName">Default filename for saving</param>
|
||||||
|
/// <param name="cutMethod">The cutting method/tool name</param>
|
||||||
|
/// <param name="materialShape">The material shape (optional)</param>
|
||||||
|
void ShowResults(List<Bin> bins, string fileName, string cutMethod, string? materialShape = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the enabled state of the run button.
|
/// Updates the enabled state of the run button.
|
||||||
|
|||||||
@@ -133,7 +133,9 @@ namespace CutList.Presenters
|
|||||||
}
|
}
|
||||||
|
|
||||||
var fileName = GetResultsSaveName();
|
var fileName = GetResultsSaveName();
|
||||||
_view.ShowResults(packResult.Value.Bins.ToList(), fileName);
|
var cutMethod = cutTool?.Name ?? "Unknown";
|
||||||
|
var materialShape = _view.SelectedMaterialShape;
|
||||||
|
_view.ShowResults(packResult.Value.Bins.ToList(), fileName, cutMethod, materialShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -244,11 +246,14 @@ namespace CutList.Presenters
|
|||||||
|
|
||||||
private string GetResultsSaveName()
|
private string GetResultsSaveName()
|
||||||
{
|
{
|
||||||
var today = DateTime.Today;
|
// Use document name if available, otherwise generate one
|
||||||
var year = today.Year.ToString();
|
if (!string.IsNullOrEmpty(_currentDocument.LastFilePath))
|
||||||
var month = today.Month.ToString().PadLeft(2, '0');
|
{
|
||||||
var day = today.Day.ToString().PadLeft(2, '0');
|
var docName = Path.GetFileNameWithoutExtension(_currentDocument.LastFilePath);
|
||||||
return $"Cut List {year}-{month}-{day}";
|
return docName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"CutList_{_documentCounter}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user