OrderManagement : Finish button, Show finished orders check box, ver. 3.0.14

This commit is contained in:
Milan Hanajik 2023-06-24 16:40:36 +02:00
parent 2ec8683b27
commit 30f9ea19dd
9 changed files with 144 additions and 40 deletions

View File

@ -26,6 +26,7 @@ namespace OrderManagement
public string Language; /// User interface language used as CultureInfo(..) constructor argument
public bool IsUserLoginRequired; /// true = require user login on program start-up
public bool IsShowPredefinedOrders; /// true = show predefined orders with nr. <= 1000
public bool IsShowFinishedOrders; /// true = show finished orders
public string TracingDBConnString; /// Connection string to MySQL database with production tracing records
public string UsersDBConnString; /// Connection string to MySQL database with authorized users
public string[] SapNumberHistory; /// SAP number history
@ -45,6 +46,7 @@ namespace OrderManagement
Language = "EN";
IsUserLoginRequired = false;
IsShowPredefinedOrders = false;
IsShowFinishedOrders = false;
#if DEBUG
TracingDBConnString = "SERVER=localhost; DATABASE=nanjingshared; UID=root; PASSWORD=kraken; CHARSET=utf8;";
#else

View File

@ -32,12 +32,13 @@
this.settingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.listViewEx1 = new Common.Forms.ListViewEx();
this.copyButton = new System.Windows.Forms.Button();
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.copyButton = new System.Windows.Forms.Button();
this.finishButton = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
@ -75,6 +76,7 @@
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.finishButton);
this.splitContainer1.Panel2.Controls.Add(this.copyButton);
this.splitContainer1.Panel2.Controls.Add(this.printButton);
this.splitContainer1.Panel2.Controls.Add(this.addButton);
@ -92,6 +94,7 @@
this.listViewEx1.DoubleClickActivation = false;
this.listViewEx1.FullRowSelect = true;
this.listViewEx1.GridLines = true;
this.listViewEx1.HideSelection = false;
this.listViewEx1.Location = new System.Drawing.Point(0, 0);
this.listViewEx1.Name = "listViewEx1";
this.listViewEx1.Size = new System.Drawing.Size(1214, 481);
@ -101,10 +104,21 @@
this.listViewEx1.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(this.listViewEx1_ColumnClick);
this.listViewEx1.DoubleClick += new System.EventHandler(this.listViewEx1_DoubleClick);
//
// copyButton
//
this.copyButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.copyButton.Location = new System.Drawing.Point(23, 223);
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);
//
// printButton
//
this.printButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.printButton.Location = new System.Drawing.Point(23, 290);
this.printButton.Location = new System.Drawing.Point(23, 335);
this.printButton.Name = "printButton";
this.printButton.Size = new System.Drawing.Size(85, 40);
this.printButton.TabIndex = 6;
@ -148,7 +162,7 @@
// deleteButton
//
this.deleteButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.deleteButton.Location = new System.Drawing.Point(23, 223);
this.deleteButton.Location = new System.Drawing.Point(23, 268);
this.deleteButton.Name = "deleteButton";
this.deleteButton.Size = new System.Drawing.Size(85, 40);
this.deleteButton.TabIndex = 5;
@ -156,16 +170,16 @@
this.deleteButton.UseVisualStyleBackColor = true;
this.deleteButton.Click += new System.EventHandler(this.deleteButton_Click);
//
// copyButton
// finishButton
//
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);
this.finishButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.finishButton.Location = new System.Drawing.Point(23, 178);
this.finishButton.Name = "finishButton";
this.finishButton.Size = new System.Drawing.Size(85, 40);
this.finishButton.TabIndex = 8;
this.finishButton.Text = "Finish";
this.finishButton.UseVisualStyleBackColor = true;
this.finishButton.Click += new System.EventHandler(this.finishButton_Click);
//
// OrderManagementDlg
//
@ -203,6 +217,7 @@
private Common.Forms.ListViewEx listViewEx1;
private System.Windows.Forms.Button printButton;
private System.Windows.Forms.Button copyButton;
private System.Windows.Forms.Button finishButton;
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -10,6 +10,7 @@ using Common;
using SharedDatabase.Entities;
using OrderManagement.Resources;
using Common.Forms;
using SharedDatabase;
namespace OrderManagement
{
@ -92,6 +93,8 @@ namespace OrderManagement
{
Order,
State,
Pieces,
CurrentPcs,
Workflow,
Procedure,
Variant,
@ -101,7 +104,6 @@ namespace OrderManagement
ModuleParam,
LaserMarking,
Packing,
Pieces,
SNPrefix,
SNFirst,
SNDigitsCount,
@ -115,8 +117,10 @@ namespace OrderManagement
void InitializeColumns(ListView lv)
{
lv.Columns.Add(new ColumnHeader { Text = Strings.Order, Width = 65 });
lv.Columns.Add(new ColumnHeader { Text = Strings.State, Width = 65 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Order, Width = 70 });
lv.Columns.Add(new ColumnHeader { Text = Strings.State, Width = 60 });
lv.Columns.Add(new ColumnHeader { Text = "Target", Width = 50 });
lv.Columns.Add(new ColumnHeader { Text = "Produced", Width = 60 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Workflow, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Test_procedure, Width = 200 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Variant_code, Width = 150 });
@ -126,7 +130,6 @@ namespace OrderManagement
lv.Columns.Add(new ColumnHeader { Text = Strings.Module_parameter, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Laser_marking, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Packing, Width = 100 });
lv.Columns.Add(new ColumnHeader { Text = Strings.Pieces_count, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.SN + " " + Strings.prefix, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.SN + " " + Strings.first, Width = 80 });
lv.Columns.Add(new ColumnHeader { Text = Strings.SN + " " + Strings.digits_count, Width = 80 });
@ -141,6 +144,8 @@ namespace OrderManagement
{
ListViewItem lvi = new ListViewItem(o.POName);
lvi.SubItems.Add(((OrderState)o.POState).ToString());
lvi.SubItems.Add(o.PiecesCount.ToString());
lvi.SubItems.Add(o.CurrentPcsCount.ToString());
lvi.SubItems.Add(o.Workflow);
lvi.SubItems.Add(o.TestProcedure);
lvi.SubItems.Add(o.VariantCode);
@ -150,7 +155,6 @@ namespace OrderManagement
lvi.SubItems.Add(o.ModuleParam);
lvi.SubItems.Add(o.LaserMarking);
lvi.SubItems.Add(o.Packing);
lvi.SubItems.Add(o.PiecesCount.ToString());
lvi.SubItems.Add(o.SNPrefix);
lvi.SubItems.Add(o.SNFirst.ToString(string.Format("D{0}", o.SNDigitsCount)));
lvi.SubItems.Add(o.SNDigitsCount.ToString());
@ -168,6 +172,8 @@ namespace OrderManagement
int i = 0;
lvi.SubItems[i++].Text = o.POName;
lvi.SubItems[i++].Text = ((OrderState)o.POState).ToString();
lvi.SubItems[i++].Text = o.PiecesCount.ToString();
lvi.SubItems[i++].Text = o.CurrentPcsCount.ToString();
lvi.SubItems[i++].Text = o.Workflow;
lvi.SubItems[i++].Text = o.TestProcedure;
lvi.SubItems[i++].Text = o.VariantCode;
@ -177,7 +183,6 @@ namespace OrderManagement
lvi.SubItems[i++].Text = o.ModuleParam;
lvi.SubItems[i++].Text = o.LaserMarking;
lvi.SubItems[i++].Text = o.Packing;
lvi.SubItems[i++].Text = o.PiecesCount.ToString();
lvi.SubItems[i++].Text = o.SNPrefix;
lvi.SubItems[i++].Text = o.SNFirst.ToString(string.Format("D{0}", o.SNDigitsCount));
lvi.SubItems[i++].Text = o.SNDigitsCount.ToString();
@ -288,6 +293,46 @@ namespace OrderManagement
}
}
private void finishButton_Click(object sender, EventArgs e)
{
if (listViewEx1.SelectedItems.Count != 1 || !(listViewEx1.SelectedItems[0].Tag is OrderInfo)) return;
OrderInfo order = listViewEx1.SelectedItems[0].Tag as OrderInfo;
if (order.POState == (sbyte)OrderState.Active && order.CurrentPcsCount >= order.PiecesCount)
{
ISession session = null;
try
{
session = sessionFactory.OpenSession();
var selectedOrders = session.QueryOver<OrderInfo>()
.Where(x => x.Id == order.Id)
.List();
if (selectedOrders.Count == 1)
{
selectedOrders[0].POState = (sbyte)OrderState.Finished;
session.SaveOrUpdate(selectedOrders[0]);
session.Flush();
order.POState = (sbyte)OrderState.Finished;
UpdateRow(listViewEx1.SelectedItems[0], order);
}
}
catch (Exception ex)
{
MessageBox.Show("Changing production order state failed: {0}", ex.Message);
}
finally
{
if (session != null && session.IsOpen) session.Close();
}
}
else
{
MessageBox.Show(Strings.You_can_only_finish_completed_production_orders);
}
}
private void copyButton_Click(object sender, EventArgs e)
{
if (listViewEx1.SelectedItems.Count != 1 || !(listViewEx1.SelectedItems[0].Tag is OrderInfo)) return;

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2021-2022 Sensus Slovensko a.s.
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Collections.Generic;
@ -14,6 +14,7 @@ using Common;
using SharedDatabase;
using SharedDatabase.Entities;
using OrderManagement.Resources;
using System.Linq;
namespace OrderManagement
{
@ -186,7 +187,16 @@ namespace OrderManagement
ISession session = sessionFactory.OpenSession();
listOfOrders = session.QueryOver<OrderInfo>().List();
if (LocalSettings.IsShowFinishedOrders)
{
listOfOrders = session.QueryOver<OrderInfo>().List();
}
else
{
listOfOrders = session.QueryOver<OrderInfo>()
.Where(x => x.POState != (sbyte)OrderState.Finished)
.List();
}
listOfWorkflows = session.QueryOver<Process>()
.Where(x => x.ReleaseStatus != ReleaseStatus.Deactivated)

View File

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OrderManagement")]
[assembly: AssemblyCopyright("Copyright © 2021-2022")]
[assembly: AssemblyCopyright("Copyright © 2021-2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@ -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.13.0")]
[assembly: AssemblyFileVersion("3.0.13.0")]
[assembly: AssemblyVersion("3.0.14.0")]
[assembly: AssemblyFileVersion("3.0.14.0")]

View File

@ -19,7 +19,7 @@ namespace OrderManagement.Resources {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
@ -637,7 +637,7 @@ namespace OrderManagement.Resources {
}
/// <summary>
/// Looks up a localized string similar to You can only delete &apos;New&apos; porduction orders.
/// Looks up a localized string similar to You can only delete &apos;New&apos; production orders.
/// </summary>
internal static string You_can_only_delete_New_porduction_orders {
get {
@ -646,12 +646,21 @@ namespace OrderManagement.Resources {
}
/// <summary>
/// Looks up a localized string similar to You can only edit &apos;New&apos; porduction orders.
/// Looks up a localized string similar to You can only edit &apos;New&apos; production orders.
/// </summary>
internal static string You_can_only_edit_New_porduction_orders {
get {
return ResourceManager.GetString("You_can_only_edit_New_porduction_orders", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You can only finish completed production orders.
/// </summary>
internal static string You_can_only_finish_completed_production_orders {
get {
return ResourceManager.GetString("You_can_only_finish_completed_production_orders", resourceCulture);
}
}
}
}

View File

@ -223,10 +223,10 @@
<value>S/N</value>
</data>
<data name="You_can_only_edit_New_porduction_orders" xml:space="preserve">
<value>You can only edit 'New' porduction orders</value>
<value>You can only edit 'New' production orders</value>
</data>
<data name="You_can_only_delete_New_porduction_orders" xml:space="preserve">
<value>You can only delete 'New' porduction orders</value>
<value>You can only delete 'New' production orders</value>
</data>
<data name="Laser_marking" xml:space="preserve">
<value>Laser marking</value>
@ -315,4 +315,7 @@
<data name="Print" xml:space="preserve">
<value>Print</value>
</data>
<data name="You_can_only_finish_completed_production_orders" xml:space="preserve">
<value>You can only finish completed production orders</value>
</data>
</root>

View File

@ -29,6 +29,7 @@
private void InitializeComponent()
{
this.commonGroupBox = new System.Windows.Forms.GroupBox();
this.showPredefinedOrdersCheckBox = new System.Windows.Forms.CheckBox();
this.loginRequiredCheckBox = new System.Windows.Forms.CheckBox();
this.languageComboBox = new System.Windows.Forms.ComboBox();
this.languageLabel = new System.Windows.Forms.Label();
@ -38,7 +39,7 @@
this.usersDBConnStringTextBox = new System.Windows.Forms.TextBox();
this.saveButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.showPredefinedOrdersCheckBox = new System.Windows.Forms.CheckBox();
this.showFinishedOrdersCheckBox = new System.Windows.Forms.CheckBox();
this.commonGroupBox.SuspendLayout();
this.connStrForTracingGroupBox.SuspendLayout();
this.connStrForUsersGroupBox.SuspendLayout();
@ -46,6 +47,7 @@
//
// commonGroupBox
//
this.commonGroupBox.Controls.Add(this.showFinishedOrdersCheckBox);
this.commonGroupBox.Controls.Add(this.showPredefinedOrdersCheckBox);
this.commonGroupBox.Controls.Add(this.loginRequiredCheckBox);
this.commonGroupBox.Controls.Add(this.languageComboBox);
@ -56,10 +58,20 @@
this.commonGroupBox.TabIndex = 16;
this.commonGroupBox.TabStop = false;
//
// showPredefinedOrdersCheckBox
//
this.showPredefinedOrdersCheckBox.AutoSize = true;
this.showPredefinedOrdersCheckBox.Location = new System.Drawing.Point(22, 67);
this.showPredefinedOrdersCheckBox.Name = "showPredefinedOrdersCheckBox";
this.showPredefinedOrdersCheckBox.Size = new System.Drawing.Size(138, 17);
this.showPredefinedOrdersCheckBox.TabIndex = 3;
this.showPredefinedOrdersCheckBox.Text = "Show predefined orders";
this.showPredefinedOrdersCheckBox.UseVisualStyleBackColor = true;
//
// loginRequiredCheckBox
//
this.loginRequiredCheckBox.AutoSize = true;
this.loginRequiredCheckBox.Location = new System.Drawing.Point(22, 55);
this.loginRequiredCheckBox.Location = new System.Drawing.Point(22, 45);
this.loginRequiredCheckBox.Name = "loginRequiredCheckBox";
this.loginRequiredCheckBox.Size = new System.Drawing.Size(114, 17);
this.loginRequiredCheckBox.TabIndex = 2;
@ -139,15 +151,15 @@
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// showPredefinedOrdersCheckBox
// showFinishedOrdersCheckBox
//
this.showPredefinedOrdersCheckBox.AutoSize = true;
this.showPredefinedOrdersCheckBox.Location = new System.Drawing.Point(22, 82);
this.showPredefinedOrdersCheckBox.Name = "showPredefinedOrdersCheckBox";
this.showPredefinedOrdersCheckBox.Size = new System.Drawing.Size(138, 17);
this.showPredefinedOrdersCheckBox.TabIndex = 3;
this.showPredefinedOrdersCheckBox.Text = "Show predefined orders";
this.showPredefinedOrdersCheckBox.UseVisualStyleBackColor = true;
this.showFinishedOrdersCheckBox.AutoSize = true;
this.showFinishedOrdersCheckBox.Location = new System.Drawing.Point(22, 89);
this.showFinishedOrdersCheckBox.Name = "showFinishedOrdersCheckBox";
this.showFinishedOrdersCheckBox.Size = new System.Drawing.Size(124, 17);
this.showFinishedOrdersCheckBox.TabIndex = 4;
this.showFinishedOrdersCheckBox.Text = "Show finished orders";
this.showFinishedOrdersCheckBox.UseVisualStyleBackColor = true;
//
// SettingsDlg
//
@ -188,5 +200,6 @@
private System.Windows.Forms.Button saveButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.CheckBox showPredefinedOrdersCheckBox;
private System.Windows.Forms.CheckBox showFinishedOrdersCheckBox;
}
}

View File

@ -1,5 +1,5 @@
///
/// Copyright (c) 2021 Sensus Slovensko a.s.
/// Copyright (c) 2021-2023 Sensus Slovensko a.s.
///
using System;
using System.Windows.Forms;
@ -48,6 +48,7 @@ namespace OrderManagement
loginRequiredCheckBox.Checked = ls.IsUserLoginRequired;
showPredefinedOrdersCheckBox.Checked = ls.IsShowPredefinedOrders;
showFinishedOrdersCheckBox.Checked = ls.IsShowFinishedOrders;
tracingDBConnStringTextBox.Text = ls.TracingDBConnString;
usersDBConnStringTextBox.Text = ls.UsersDBConnString;
@ -95,6 +96,12 @@ namespace OrderManagement
isDifferent = true;
}
if (ls.IsShowFinishedOrders != showFinishedOrdersCheckBox.Checked)
{
ls.IsShowFinishedOrders = showFinishedOrdersCheckBox.Checked;
isDifferent = true;
}
if (ls.TracingDBConnString != tracingDBConnStringTextBox.Text)
{
ls.TracingDBConnString = tracingDBConnStringTextBox.Text;