OrderManagement : Copy button, ver. 3.0.7

This commit is contained in:
Milan Hanajik 2021-12-10 07:57:32 +01:00
parent 68c3ccbef6
commit dfddc8a980
3 changed files with 73 additions and 13 deletions

View File

@ -32,11 +32,12 @@
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.listViewEx1 = new Common.Forms.ListViewEx();
this.printButton = new System.Windows.Forms.Button();
this.addButton = new System.Windows.Forms.Button();
this.editButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.deleteButton = new System.Windows.Forms.Button();
this.printButton = new System.Windows.Forms.Button();
this.copyButton = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@ -74,6 +75,7 @@
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.copyButton);
this.splitContainer1.Panel2.Controls.Add(this.printButton);
this.splitContainer1.Panel2.Controls.Add(this.addButton);
this.splitContainer1.Panel2.Controls.Add(this.editButton);
@ -99,6 +101,17 @@
this.listViewEx1.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx1_ColumnClick);
this.listViewEx1.DoubleClick += new System.EventHandler(this.listViewEx1_DoubleClick);
//
// printButton
//
this.printButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.printButton.Location = new System.Drawing.Point(23, 290);
this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(85, 40);
this.printButton.TabIndex = 6;
this.printButton.Text = "Print";
this.printButton.UseVisualStyleBackColor = true;
this.printButton.Click += new System.EventHandler(this.printButton_Click);
//
// addButton
//
this.addButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
@ -135,7 +148,7 @@
// deleteButton
//
this.deleteButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.deleteButton.Location = new System.Drawing.Point(23, 178);
this.deleteButton.Location = new System.Drawing.Point(23, 223);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(85, 40);
this.deleteButton.TabIndex = 5;
@ -143,16 +156,16 @@
this.deleteButton.UseVisualStyleBackColor = true;
this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click);
//
// printButton
// copyButton
//
this.printButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.printButton.Location = new System.Drawing.Point(23, 245);
this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(85, 40);
this.printButton.TabIndex = 6;
this.printButton.Text = "Print";
this.printButton.UseVisualStyleBackColor = true;
this.printButton.Click += new System.EventHandler(this.printButton_Click);
this.copyButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.copyButton.Location = new System.Drawing.Point(23, 178);
this.copyButton.Name = "copyButton";
this.copyButton.Size = new System.Drawing.Size(85, 40);
this.copyButton.TabIndex = 7;
this.copyButton.Text = "Copy";
this.copyButton.UseVisualStyleBackColor = true;
this.copyButton.Click += new System.EventHandler(this.copyButton_Click);
//
// OrderManagementDlg
//
@ -189,6 +202,7 @@
private System.Windows.Forms.Button deleteButton;
private Common.Forms.ListViewEx listViewEx1;
private System.Windows.Forms.Button printButton;
private System.Windows.Forms.Button copyButton;
}
}

View File

@ -256,6 +256,52 @@ namespace OrderManagement
}
}
private void copyButton_Click(object sender, EventArgs e)
{
if (listViewEx1.SelectedItems.Count != 1 || !(listViewEx1.SelectedItems[0].Tag is OrderInfo)) return;
OrderInfo oriOrder = listViewEx1.SelectedItems[0].Tag as OrderInfo;
///
/// Determine the next production order name
///
string candidatePOName = string.Empty;
int candidatePONr;
foreach (var o in listOfOrders)
{
if (string.Compare(candidatePOName, o.POName, StringComparison.InvariantCulture) < 0) candidatePOName = o.POName;
}
if (int.TryParse(candidatePOName, out candidatePONr))
{
candidatePONr++;
candidatePOName = candidatePONr.ToString(string.Format("D{0}", candidatePOName.Length));
}
///
/// Create and edit the order
///
OrderInfo newOrder = oriOrder.Clone() as OrderInfo;
newOrder.POName = candidatePOName;
newOrder.POState = (sbyte)OrderState.New;
newOrder.SNFirst = oriOrder.SNFirst + oriOrder.PiecesCount; /// TODO
newOrder.RAFirst = oriOrder.RAFirst + oriOrder.PiecesCount; /// TODO
newOrder.CurrentPcsCount = 0;
newOrder.CurrentSN = 0;
newOrder.CurrentRA = 0;
newOrder.BaseNr1 = 0;
newOrder.BaseNr2 = 0;
newOrder.BaseNr3 = 0;
newOrder.BaseNr4 = 0;
newOrder.BaseNr5 = 0;
newOrder.Remark = string.Format("Copy of order {0}", oriOrder.POName);
if (new EditOrderDlg(session, newOrder, listOfOrders, Program.LocalSettings.IsShowPredefinedOrders).ShowDialog()
== DialogResult.OK)
{
listOfOrders.Add(newOrder);
AddRow(listViewEx1, newOrder);
}
}
private void deleteButton_Click(object sender, EventArgs e)
{
if (listViewEx1.SelectedItems.Count != 1 || !(listViewEx1.SelectedItems[0].Tag is OrderInfo)) return;

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.0.6.0")]
[assembly: AssemblyFileVersion("3.0.6.0")]
[assembly: AssemblyVersion("3.0.7.0")]
[assembly: AssemblyFileVersion("3.0.7.0")]