diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs index e58c807..7b1774b 100644 --- a/AppData/ComLib.cs +++ b/AppData/ComLib.cs @@ -204,10 +204,6 @@ namespace AppData /// Programmed = 0, /// - /// Presente / letto su PROD e pronto su scissor lift - /// - Present, - /// /// Stampa in corso /// Printing, @@ -224,9 +220,17 @@ namespace AppData /// Machined, /// + /// In fase di scaricamento + /// + Unloading, + /// /// Completato / scaricato da macchina (anche su tavola di scarico) /// - Out + Unloaded, + /// + /// Presente / letto su PROD e pronto su scissor lift + /// + Present } /// /// dati del materiale @@ -258,11 +262,11 @@ namespace AppData /// /// Data inizio processing /// - public DateTime DtStart { get; set; } + public DateTime? DtStart { get; set; } /// /// Data fine processing /// - public DateTime DtEnd { get; set; } + public DateTime? DtEnd { get; set; } /// /// Tempo di lavorazione in minuti decimali /// @@ -275,7 +279,7 @@ namespace AppData { try { - answ = DtEnd.Subtract(DtStart).TotalMinutes; + answ = ((DateTime)DtEnd).Subtract((DateTime)DtStart).TotalMinutes; } catch { } @@ -318,9 +322,9 @@ namespace AppData } /// - /// Classe che rappresenta gli stack da lavorare + /// Classe che rappresenta i BUNK da lavorare /// - public class WStack + public class WBunk { /// /// Identificativo univoco stack @@ -381,7 +385,7 @@ namespace AppData /// /// Elenco degli Stack da lavorare /// - public List StackList { get; set; } + public List StackList { get; set; } /// /// Numero di Stack da lavorare /// @@ -778,6 +782,92 @@ namespace AppData { return null; } + /// + /// Restituisce il PRIMO bunk secondo criterio: + /// - posizione = 5 (ho letto da webApp il BUNK e preso in carico) + /// - NumSheet > NumSheetUnload + /// - Ordinato per StackIndex (crescente) x avere il più VECCHIO + /// + /// + public static WBunk prodGetFirstBunk() + { + WBunk answ = null; + // vado sul DB e leggo ... + DS_App.StackListDataTable tabBunks = DataLayer.man.taSTL.getLoaded(); + // controllo di averne almeno 1... + if (tabBunks.Count > 0) + { + DS_App.StackListRow currBunk = tabBunks[0]; + // calcolo attributi oggetti + CStatus currSt = CStatus.Programmed; + if (currBunk.Position == 5) + { + currSt = CStatus.Running; + } + else + { + currSt = CStatus.Done; + } + List elSheet = new List(); + // recupero gli sheets di questo stack... + DS_App.SheetListDataTable tabSheets = DataLayer.man.taSHL.getByStack(currBunk.StackID); + DateTime dataStart = DateTime.Now; + Panel currPanel; + foreach (var item in tabSheets) + { + // converto i workData + WorkData wdPrint = new WorkData() + { + DtStart = item.IsPrntStartNull() ? null : (DateTime?)item.PrntStart, + DtEnd = item.IsPrntEndNull() ? null : (DateTime?)item.PrntEnd, + ProgramPath = item.PrintFilePath + }; + WorkData wdMachining = new WorkData() + { + DtStart = item.IsWrkStartNull() ? null : (DateTime?)item.WrkStart, + DtEnd = item.IsWrkEndNull() ? null : (DateTime?)item.WrkEnd, + ProgramPath = item.CncFilePath + }; + WorkData wdUnload = new WorkData() + { + DtStart = item.IsUnlStartNull() ? null : (DateTime?)item.UnlStart, + DtEnd = item.IsUnlEndNull() ? null : (DateTime?)item.UnlEnd + }; + MaterialData material = new MaterialData() + { + MaterialId = item.MatID, + MaterialDescription = item.MatDesc, + MaterialPN = item.MatExtCode.ToString() + }; + PStatus currPnlStatus = PStatus.Programmed; + Enum.TryParse(item.ShStatus.ToString(), out currPnlStatus); + currPanel = new Panel() + { + Printing = wdPrint, + Machining = wdMachining, + Unloading = wdUnload, + Material = material, + PanelId = item.StackID, + Status = currPnlStatus + }; + elSheet.Add(currPanel); + if (!item.IsPrntStartNull()) + { + dataStart = item.PrntStart < dataStart ? item.PrntStart : dataStart; + } + } + // compongo il bunk... + answ = new WBunk() + { + StackId = currBunk.StackID, + Status = currSt, + DataMatrix = currBunk.StackDtmx, + PanelsList = elSheet, + DtStart = dataStart + }; + } + return answ; + } /// /// Valore dello Stack correntemente in processing per ML (MachineLoad) diff --git a/AppData/DS_App.Designer.cs b/AppData/DS_App.Designer.cs index 78e619f..14e7da9 100644 --- a/AppData/DS_App.Designer.cs +++ b/AppData/DS_App.Designer.cs @@ -7712,7 +7712,7 @@ namespace AppData.DS_AppTableAdapters { [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] private void InitCommandCollection() { - this._commandCollection = new global::System.Data.SqlClient.SqlCommand[7]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[8]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; this._commandCollection[0].CommandText = "SELECT *\r\nFROM v_StackList"; @@ -7743,17 +7743,22 @@ namespace AppData.DS_AppTableAdapters { this._commandCollection[4].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[5] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[5].Connection = this.Connection; - this._commandCollection[5].CommandText = "dbo.stp_Stacks_getNextByBatch"; + this._commandCollection[5].CommandText = "dbo.stp_Stacks_getLoaded"; this._commandCollection[5].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[5].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._commandCollection[6] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[6].Connection = this.Connection; - this._commandCollection[6].CommandText = "dbo.stp_Stacks_updatePos"; + this._commandCollection[6].CommandText = "dbo.stp_Stacks_getNextByBatch"; this._commandCollection[6].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@StackID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); - this._commandCollection[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Position", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[6].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[7] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[7].Connection = this.Connection; + this._commandCollection[7].CommandText = "dbo.stp_Stacks_updatePos"; + this._commandCollection[7].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[7].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@RETURN_VALUE", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.ReturnValue, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[7].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@StackID", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[7].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Position", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -7852,8 +7857,19 @@ namespace AppData.DS_AppTableAdapters { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] - public virtual DS_App.StackListDataTable getNextByBatch(global::System.Nullable BatchID) { + public virtual DS_App.StackListDataTable getLoaded() { this.Adapter.SelectCommand = this.CommandCollection[5]; + DS_App.StackListDataTable dataTable = new DS_App.StackListDataTable(); + this.Adapter.Fill(dataTable); + return dataTable; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] + [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] + [global::System.ComponentModel.DataObjectMethodAttribute(global::System.ComponentModel.DataObjectMethodType.Select, false)] + public virtual DS_App.StackListDataTable getNextByBatch(global::System.Nullable BatchID) { + this.Adapter.SelectCommand = this.CommandCollection[6]; if ((BatchID.HasValue == true)) { this.Adapter.SelectCommand.Parameters[1].Value = ((int)(BatchID.Value)); } @@ -7869,7 +7885,7 @@ namespace AppData.DS_AppTableAdapters { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int updatePos(global::System.Nullable StackID, global::System.Nullable Position) { - global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[6]; + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[7]; if ((StackID.HasValue == true)) { command.Parameters[1].Value = ((int)(StackID.Value)); } diff --git a/AppData/DS_App.xsd b/AppData/DS_App.xsd index 74da239..7ddbaf5 100644 --- a/AppData/DS_App.xsd +++ b/AppData/DS_App.xsd @@ -174,6 +174,16 @@ FROM v_StackList + + + + dbo.stp_Stacks_getLoaded + + + + + + @@ -1077,7 +1087,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1109,7 +1119,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1131,7 +1141,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1186,7 +1196,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1258,7 +1268,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1266,7 +1276,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1327,7 +1337,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1360,7 +1370,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1376,7 +1386,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1392,7 +1402,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1416,7 +1426,7 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - + @@ -1475,10 +1485,10 @@ SELECT OrdID, ItemID FROM OffOrd2Item WHERE (ItemID = @ItemID) AND (OrdID = @Ord - - - - + + + + \ No newline at end of file diff --git a/AppData/DS_App.xss b/AppData/DS_App.xss index eaf66aa..5bd62c1 100644 --- a/AppData/DS_App.xss +++ b/AppData/DS_App.xss @@ -4,14 +4,14 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + - + diff --git a/NKC_WF/Utility.aspx.cs b/NKC_WF/Utility.aspx.cs index 1e58614..1ebe37e 100644 --- a/NKC_WF/Utility.aspx.cs +++ b/NKC_WF/Utility.aspx.cs @@ -44,9 +44,9 @@ namespace NKC_WF protected void lbtMakeSim_Click(object sender, EventArgs e) { // creazione degli stack e dei pannelli... - List stackList = new List(); + List stackList = new List(); List panelList; - ComLib.WStack currStack; + ComLib.WBunk currStack; ComLib.Panel currPanel; ComLib.MaterialData currMaterial; ComLib.WorkData currPrintData; @@ -88,7 +88,7 @@ namespace NKC_WF panelList.Add(currPanel); } - currStack = new ComLib.WStack() + currStack = new ComLib.WBunk() { DataMatrix = $"DM{txtCodTakt.Text}.{i}", StackId = i, diff --git a/RedisExample/App.config b/RedisExample/App.config index a819cb4..ca911f8 100644 --- a/RedisExample/App.config +++ b/RedisExample/App.config @@ -10,7 +10,15 @@ + + + + diff --git a/RedisExample/Form1.vb b/RedisExample/Form1.vb index b4df1fa..f70d630 100644 --- a/RedisExample/Form1.vb +++ b/RedisExample/Form1.vb @@ -19,6 +19,10 @@ Public Class Form1 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click ' caricamento del NEXT STACK da redis (come oggetto) + Dim getFirstBunk = ComLib.prodGetFirstBunk() + ' ho un bunk coi suoi pannelli... + + Label1.Text = $"Trovato il bunk {getFirstBunk.StackId} costituito da {getFirstBunk.PanelsList.Count} pannelli" End Sub