diff --git a/AppData/DS_App.Designer.cs b/AppData/DS_App.Designer.cs index d06ea67..be3583f 100644 --- a/AppData/DS_App.Designer.cs +++ b/AppData/DS_App.Designer.cs @@ -44453,8 +44453,8 @@ SELECT BatchID, SheetIndex, MatID, WorkArea, TotalArea, NumParts, NumPainted FRO this._adapter.DeleteCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_BatchID", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BatchID", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); this._adapter.InsertCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.InsertCommand.Connection = this.Connection; - this._adapter.InsertCommand.CommandText = @"INSERT INTO [BatchStats] ([BatchID], [Takt], [AvgYeld], [TotalArea], [NumMat], [NumSheets], [NumModel], [NumKit], [NumParts], [NumPainted]) VALUES (@BatchID, @Takt, @AvgYeld, @TotalArea, @NumMat, @NumSheets, @NumModel, @NumKit, @NumParts, @NumPainted); -SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted FROM BatchStats WHERE (BatchID = @BatchID)"; + this._adapter.InsertCommand.CommandText = @"INSERT INTO [BatchStats] ([BatchID], [Takt], [AvgYeld], [TotalArea], [NumMat], [NumSheets], [NumModel], [NumKit], [NumParts], [NumPainted], [PlaceCod]) VALUES (@BatchID, @Takt, @AvgYeld, @TotalArea, @NumMat, @NumSheets, @NumModel, @NumKit, @NumParts, @NumPainted, @PlaceCod); +SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted, PlaceCod FROM BatchStats WHERE (BatchID = @BatchID)"; this._adapter.InsertCommand.CommandType = global::System.Data.CommandType.Text; this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BatchID", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Takt", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Takt", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); @@ -44466,10 +44466,11 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumKit", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumKit", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumParts", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumParts", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumPainted", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumPainted", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._adapter.InsertCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PlaceCod", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PlaceCod", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand = new global::System.Data.SqlClient.SqlCommand(); this._adapter.UpdateCommand.Connection = this.Connection; - this._adapter.UpdateCommand.CommandText = @"UPDATE [BatchStats] SET [BatchID] = @BatchID, [Takt] = @Takt, [AvgYeld] = @AvgYeld, [TotalArea] = @TotalArea, [NumMat] = @NumMat, [NumSheets] = @NumSheets, [NumModel] = @NumModel, [NumKit] = @NumKit, [NumParts] = @NumParts, [NumPainted] = @NumPainted WHERE (([BatchID] = @Original_BatchID)); -SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted FROM BatchStats WHERE (BatchID = @BatchID)"; + this._adapter.UpdateCommand.CommandText = @"UPDATE [BatchStats] SET [BatchID] = @BatchID, [Takt] = @Takt, [AvgYeld] = @AvgYeld, [TotalArea] = @TotalArea, [NumMat] = @NumMat, [NumSheets] = @NumSheets, [NumModel] = @NumModel, [NumKit] = @NumKit, [NumParts] = @NumParts, [NumPainted] = @NumPainted, [PlaceCod] = @PlaceCod WHERE (([BatchID] = @Original_BatchID)); +SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted, PlaceCod FROM BatchStats WHERE (BatchID = @BatchID)"; this._adapter.UpdateCommand.CommandType = global::System.Data.CommandType.Text; this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@BatchID", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BatchID", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Takt", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "Takt", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); @@ -44481,6 +44482,7 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumKit", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumKit", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumParts", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumParts", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@NumPainted", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "NumPainted", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@PlaceCod", global::System.Data.SqlDbType.NVarChar, 0, global::System.Data.ParameterDirection.Input, 0, 0, "PlaceCod", global::System.Data.DataRowVersion.Current, false, null, "", "", "")); this._adapter.UpdateCommand.Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@Original_BatchID", global::System.Data.SqlDbType.Int, 0, global::System.Data.ParameterDirection.Input, 0, 0, "BatchID", global::System.Data.DataRowVersion.Original, false, null, "", "", "")); } @@ -44494,17 +44496,24 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N [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[2]; + this._commandCollection = new global::System.Data.SqlClient.SqlCommand[3]; this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[0].Connection = this.Connection; - this._commandCollection[0].CommandText = "SELECT * FROM BatchStats"; + this._commandCollection[0].CommandText = "SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, Nu" + + "mParts, NumPainted FROM BatchStats"; this._commandCollection[0].CommandType = global::System.Data.CommandType.Text; this._commandCollection[1] = new global::System.Data.SqlClient.SqlCommand(); this._commandCollection[1].Connection = this.Connection; - this._commandCollection[1].CommandText = "dbo.stp_BatchStat_refresh"; + this._commandCollection[1].CommandText = "dbo.stp_BatchStat_getLast"; this._commandCollection[1].CommandType = global::System.Data.CommandType.StoredProcedure; this._commandCollection[1].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[1].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[1].Parameters.Add(new global::System.Data.SqlClient.SqlParameter("@ShowMax", global::System.Data.SqlDbType.Int, 4, global::System.Data.ParameterDirection.Input, 10, 0, null, global::System.Data.DataRowVersion.Current, false, null, "", "", "")); + this._commandCollection[2] = new global::System.Data.SqlClient.SqlCommand(); + this._commandCollection[2].Connection = this.Connection; + this._commandCollection[2].CommandText = "dbo.stp_BatchStat_refresh"; + this._commandCollection[2].CommandType = global::System.Data.CommandType.StoredProcedure; + this._commandCollection[2].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[2].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, "", "", "")); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] @@ -44531,6 +44540,23 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N 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.BatchStatsDataTable getLast(global::System.Nullable ShowMax) { + this.Adapter.SelectCommand = this.CommandCollection[1]; + if ((ShowMax.HasValue == true)) { + this.Adapter.SelectCommand.Parameters[1].Value = ((int)(ShowMax.Value)); + } + else { + this.Adapter.SelectCommand.Parameters[1].Value = global::System.DBNull.Value; + } + DS_App.BatchStatsDataTable dataTable = new DS_App.BatchStatsDataTable(); + 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")] @@ -44564,7 +44590,7 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "16.0.0.0")] [global::System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")] public virtual int refresh(global::System.Nullable BatchID) { - global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[1]; + global::System.Data.SqlClient.SqlCommand command = this.CommandCollection[2]; if ((BatchID.HasValue == true)) { command.Parameters[1].Value = ((int)(BatchID.Value)); } diff --git a/AppData/DS_App.xsd b/AppData/DS_App.xsd index da84aab..5ce354c 100644 --- a/AppData/DS_App.xsd +++ b/AppData/DS_App.xsd @@ -266,7 +266,7 @@ FROM v_BatchList - + dbo.stp_Batch_invalidateRunning @@ -276,7 +276,7 @@ FROM v_BatchList - + dbo.stp_Batch_makeDescendantByKey @@ -288,7 +288,7 @@ FROM v_BatchList - + dbo.stp_Batch_redoPartValid @@ -299,7 +299,7 @@ FROM v_BatchList - + dbo.stp_Batch_refuseNesting @@ -311,7 +311,7 @@ FROM v_BatchList - + dbo.stp_Batch_resetAllNesting @@ -322,7 +322,7 @@ FROM v_BatchList - + dbo.stp_Batch_resetPartUnValid @@ -332,7 +332,7 @@ FROM v_BatchList - + dbo.stp_zzz_resetProdCall @@ -342,7 +342,7 @@ FROM v_BatchList - + dbo.stp_Batch_resetTree @@ -353,7 +353,7 @@ FROM v_BatchList - + dbo.stp_Batch_updatePlaceCod @@ -365,7 +365,7 @@ FROM v_BatchList - + dbo.stp_Batch_updateSchedPrior @@ -377,7 +377,7 @@ FROM v_BatchList - + dbo.stp_Batch_updateStatus @@ -3794,8 +3794,8 @@ SELECT BatchID, SheetIndex, MatID, WorkArea, TotalArea, NumParts, NumPainted FRO - INSERT INTO [BatchStats] ([BatchID], [Takt], [AvgYeld], [TotalArea], [NumMat], [NumSheets], [NumModel], [NumKit], [NumParts], [NumPainted]) VALUES (@BatchID, @Takt, @AvgYeld, @TotalArea, @NumMat, @NumSheets, @NumModel, @NumKit, @NumParts, @NumPainted); -SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted FROM BatchStats WHERE (BatchID = @BatchID) + INSERT INTO [BatchStats] ([BatchID], [Takt], [AvgYeld], [TotalArea], [NumMat], [NumSheets], [NumModel], [NumKit], [NumParts], [NumPainted], [PlaceCod]) VALUES (@BatchID, @Takt, @AvgYeld, @TotalArea, @NumMat, @NumSheets, @NumModel, @NumKit, @NumParts, @NumPainted, @PlaceCod); +SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted, PlaceCod FROM BatchStats WHERE (BatchID = @BatchID) @@ -3807,19 +3807,20 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N + - SELECT * FROM BatchStats + SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted FROM BatchStats - UPDATE [BatchStats] SET [BatchID] = @BatchID, [Takt] = @Takt, [AvgYeld] = @AvgYeld, [TotalArea] = @TotalArea, [NumMat] = @NumMat, [NumSheets] = @NumSheets, [NumModel] = @NumModel, [NumKit] = @NumKit, [NumParts] = @NumParts, [NumPainted] = @NumPainted WHERE (([BatchID] = @Original_BatchID)); -SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted FROM BatchStats WHERE (BatchID = @BatchID) + UPDATE [BatchStats] SET [BatchID] = @BatchID, [Takt] = @Takt, [AvgYeld] = @AvgYeld, [TotalArea] = @TotalArea, [NumMat] = @NumMat, [NumSheets] = @NumSheets, [NumModel] = @NumModel, [NumKit] = @NumKit, [NumParts] = @NumParts, [NumPainted] = @NumPainted, [PlaceCod] = @PlaceCod WHERE (([BatchID] = @Original_BatchID)); +SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, NumParts, NumPainted, PlaceCod FROM BatchStats WHERE (BatchID = @BatchID) @@ -3831,6 +3832,7 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N + @@ -3850,6 +3852,17 @@ SELECT BatchID, Takt, AvgYeld, TotalArea, NumMat, NumSheets, NumModel, NumKit, N + + + + dbo.stp_BatchStat_getLast + + + + + + + diff --git a/AppData/DS_App.xss b/AppData/DS_App.xss index 8521ad0..02572d0 100644 --- a/AppData/DS_App.xss +++ b/AppData/DS_App.xss @@ -4,7 +4,7 @@ Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. --> - + @@ -48,8 +48,8 @@ - - + + diff --git a/AppData/Enum.cs b/AppData/Enum.cs index d8c81ae..3f5555f 100644 --- a/AppData/Enum.cs +++ b/AppData/Enum.cs @@ -17,6 +17,29 @@ namespace AppData danger } + public enum ReportType + { + /// + /// Non definito + /// + ND = 0, + + /// + /// Statistiche Batch (PRE) + /// + BatchStats, + + /// + /// Report previsione scarico batch (num pezzi/sheet) + /// + BatchUnloadPreview, + + /// + /// Report produttività giornaliera (POST) + /// + DailyReport + } + public enum Stations { LINE = 0, diff --git a/AppData/Objects.cs b/AppData/Objects.cs index b9e6a10..be8972e 100644 --- a/AppData/Objects.cs +++ b/AppData/Objects.cs @@ -16,6 +16,16 @@ namespace AppData #endregion Public Properties } + public class chartJsTVal + { + #region Public Properties + + public string x { get; set; } + public decimal y { get; set; } + + #endregion Public Properties + } + public class chartJsXY { #region Public Properties diff --git a/NKC_WF/Controllers/BatchStatsController.cs b/NKC_WF/Controllers/BatchStatsController.cs new file mode 100644 index 0000000..6a25154 --- /dev/null +++ b/NKC_WF/Controllers/BatchStatsController.cs @@ -0,0 +1,140 @@ +using AppData; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Web; +using System.Web.Http; + +namespace NKC_WF.Controllers +{ + public class BatchStatsController : ApiController + { + #region Protected Fields + + protected string dateFormat = "yyyyMMdd"; + + /// + /// oggetto static/singleton per fare chiamate sul datalayer + /// + protected DataLayer DLMan = new DataLayer(); + + #endregion Protected Fields + + #region Private Methods + + /// + /// Metodo effettivo recupero dati + /// + /// + /// + private List getDataFilt(int id) + { + List answ = new List(); + var tabDati = DLMan.taBStats.getLast(id); + // ciclo + foreach (var item in tabDati.OrderBy(x => x.Takt)) + { + // prendo valore default = NumParts + answ.Add(new chartJsTVal() { x = item.Takt, y = item.NumParts }); + } + // restituisco + return answ; + } + + /// + /// Metodo effettivo recupero dati + /// + /// + /// + /// + private List getDataFilt(int id, string PlotType) + { + List answ = new List(); + var tabDati = DLMan.taBStats.getLast(id); + DateTime startTime = DateTime.Now.AddYears(1); + // ciclo + foreach (var item in tabDati.OrderBy(x => x.Takt)) + { + //// converto in data il valore takt... primi 8 char + //DateTime dataRif = DateTime.Today; + //DateTime.TryParseExact(item.Takt.Substring(0, 8), dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dataRif); + decimal value = 0; + switch (PlotType) + { + case "Yeld": + value = item.AvgYeld * 100; + break; + + case "NumMat": + value = item.NumMat; + break; + + case "NumSheets": + value = item.NumSheets; + break; + + case "NumModel": + value = item.NumModel; + break; + + case "NumKit": + value = item.NumKit; + break; + + case "NumPainted": + value = item.NumPainted; + break; + + case "NumParts": + default: + value = item.NumParts; + break; + } + answ.Add(new chartJsTVal() { x = item.Takt, y = value }); + } + // restituisco + return answ; + } + + #endregion Private Methods + + #region Public Methods + + // GET api/TempRil + public string Get() + { + return "NA"; + } + + /// + /// Recupero dati x ultimi batch stats + /// GET api/BatchStats/5 + /// + /// NUmLast + /// + public List Get(int id) + { + DateTime dtRif = DateTime.Today; + // restituisco oggetto! + return getDataFilt(id); + } + + /// + /// Recupero dati x statistiche ultimi batch + /// GET api/BatchStats/50 + /// + /// Num record da recuperare DESC + /// Tipo di grafico + /// + public List Get(int id, string PlotType) + { + List answ = new List(); + answ = getDataFilt(id, PlotType); + // restituisco oggetto! + return answ; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 47aa535..07f1304 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -481,10 +481,13 @@ + + + @@ -547,6 +550,7 @@ + @@ -679,6 +683,7 @@ + @@ -1139,6 +1144,20 @@ cmp_batchList.ascx + + cmp_BatchStatsList.ascx + ASPXCodeBehind + + + cmp_BatchStatsList.ascx + + + cmp_BatchStatsPlot.ascx + ASPXCodeBehind + + + cmp_BatchStatsPlot.ascx + cmp_binDetIRK.ascx ASPXCodeBehind @@ -1167,6 +1186,13 @@ cmp_cartDetIRK.ascx + + cmp_dailyStats.ascx + ASPXCodeBehind + + + cmp_dailyStats.ascx + cmp_devUtils.ascx ASPXCodeBehind @@ -1622,6 +1648,13 @@ cmp_partMIA_byPLID.ascx + + cmp_reportSelector.ascx + ASPXCodeBehind + + + cmp_reportSelector.ascx + cmp_scrapList.ascx ASPXCodeBehind diff --git a/NKC_WF/Web.config b/NKC_WF/Web.config index aeda972..2e8cd5e 100644 --- a/NKC_WF/Web.config +++ b/NKC_WF/Web.config @@ -1,460 +1,467 @@ - + - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx new file mode 100644 index 0000000..6d6105d --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx @@ -0,0 +1,65 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_BatchStatsList.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_BatchStatsList" %> + +<%@ Register Src="~/WebUserControls/cmp_numRow.ascx" TagPrefix="uc1" TagName="cmp_numRow" %> +<%@ Register Src="~/WebUserControls/cmp_BatchStatsPlot.ascx" TagPrefix="uc1" TagName="cmp_BatchStatsPlot" %> + +
+
+ +
+
+
+
+ <%: traduci("BatchPreviewStats") %> +
+
+ <%: traduci("PlotGraph") %> + + + + + + + + + + +  |  + <%: traduci("ShowLast") %>: + +  |  + +
+
+
+
+ + + + + + + <%: traduci("NoRecord") %> + + + + + + + + + + + + + + + + + + + + + +
+
\ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs new file mode 100644 index 0000000..c9c9b40 --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.cs @@ -0,0 +1,342 @@ +using AppData; +using NKC_SDK; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.WebUserControls +{ + public partial class cmp_BatchStatsList : BaseUserControl + { + #region Protected Properties + + /// + /// BatchId selezionato + /// + protected int BatchIdSel + { + get + { + int answ = 0; + if (grView.SelectedValue != null) + { + int.TryParse(grView.SelectedValue.ToString(), out answ); + } + return answ; + } + } + + /// + /// Status corrente del batch + /// + protected BatchStatus CurrBatchStatus + { + get + { + return ComLib.BStatus(BatchIdSel); + } + } + + protected int currSelRow + { + get + { + return grView.SelectedIndex; + } + set + { + grView.SelectedIndex = value; + } + } + + protected int ShowLast + { + get + { + int answ = 100; + int.TryParse(txtNumShow.Text, out answ); + return answ; + } + set + { + txtNumShow.Text = $"{value}"; + } + } + + #endregion Protected Properties + + #region Public Properties + + /// + /// modalità funzionamento controllo + /// + public BatchListMode listMode { get; set; } = BatchListMode.Standard; + + #endregion Public Properties + + #region Private Methods + + private void Cmp_batchDetail_eh_doRefresh(object sender, EventArgs e) + { + resetSelezione(); + } + + private void Cmp_numRow_eh_doRefresh(object sender, EventArgs e) + { + // recupero num righe ed aggiorno... + grView.PageSize = cmp_numRow.numRow; + grView.DataBind(); + } + + private void resetSelezione() + { + grView.SelectedIndex = -1; + grView.DataBind(); + raiseReset(); + } + + private void updateGraph() + { + cmp_BatchStatsPlot.PlotType = ddlType.SelectedValue; + cmp_BatchStatsPlot.ShowLast = ShowLast; + cmp_BatchStatsPlot.Legend = traduci($"rep_{ddlType.SelectedValue}"); + } + + #endregion Private Methods + + #region Protected Methods + + protected void chkPlotGraph_CheckedChanged(object sender, EventArgs e) + { + doUpdate(); + } + + protected void chkShowSplit_CheckedChanged(object sender, EventArgs e) + { + // deseleziono... + resetSelezione(); + } + + protected void ddlPlaces_SelectedIndexChanged(object sender, EventArgs e) + { + } + + protected void ddlStatus_SelectedIndexChanged(object sender, EventArgs e) + { + } + + protected void ddlType_SelectedIndexChanged(object sender, EventArgs e) + { + doUpdate(); + } + + protected void grView_PageIndexChanged(object sender, EventArgs e) + { + } + + protected void lbRedoEval_Click(object sender, EventArgs e) + { + LinkButton lbt = (LinkButton)sender; + if (!string.IsNullOrEmpty(lbt.CommandArgument)) + { + // eseguo richiesta reset + DLMan.taBL.redoPartValid(lbt.CommandArgument); + // eventualmente mando primo batch da validare... + bool newValidSent = ComLib.sendFirstValidationBatch(); + // refresh! + resetSelezione(); + } + } + + /// + /// comando reset + /// + /// + /// + protected void lbtReset_Click(object sender, EventArgs e) + { + resetSelezione(); + } + + /// + /// Caricamento pagina + /// + /// + /// + protected void Page_Load(object sender, EventArgs e) + { + if (!Page.IsPostBack) + { + cmp_numRow.numRow = 10; + grView.PageSize = cmp_numRow.numRow; + divGraph.Visible = false; + ddlType.Visible = false; + } + cmp_numRow.eh_doRefresh += Cmp_numRow_eh_doRefresh; + } + + protected void txtNumShow_TextChanged(object sender, EventArgs e) + { + doUpdate(); + } + + #endregion Protected Methods + + #region Public Methods + + /// + /// Converte il codice stato in effettivo campo + /// + /// + /// + public string BStatus(object _status) + { + string answ = ComLib.BatchStatusDescr(_status); + return answ; + } + + /// + /// Codice CSS in base a status... + /// + /// + /// + public string cssByStatus(object _status) + { + string answ = "text-muted"; + int status = -1; + int.TryParse(_status.ToString(), out status); + switch (status) + { + case 1: + answ = "font-weight-bold text-info"; + break; + + case 2: + answ = "font-weight-bold text-primary"; + break; + + case 3: + answ = "font-weight-bold text-warning"; + break; + + case 4: + answ = "font-weight-bold text-danger"; + break; + + case 5: + answ = "font-weight-bold text-success"; + break; + + case 6: + answ = "font-weight-bold text-secondary"; + break; + + default: + break; + } + return answ; + } + + /// + /// Codice CSS in base a BatchType... + /// + /// + /// + public string cssIconByType(object _BatchType) + { + string answ = "fa fa-circle-thin"; + int status = -1; + int.TryParse(_BatchType.ToString(), out status); + switch (status) + { + case 0: + answ = "fa fa-file-text-o"; + break; + + case 1: + answ = "fa fa-file-text"; + break; + + case 2: + answ = "fa fa-scissors"; + break; + + default: + break; + } + return answ; + } + + public void doUpdate() + { + divGraph.Visible = chkPlotGraph.Checked; + ddlType.Visible = chkPlotGraph.Checked; + if (chkPlotGraph.Checked) + { + updateGraph(); + } + grView.DataBind(); + } + + /// + /// Determina se sia visibile previewin base a BatchType... + /// + /// + /// + public bool hasPreviewByType(object _BatchType) + { + bool answ = false; + int status = -1; + int.TryParse(_BatchType.ToString(), out status); + switch (status) + { + case 0: + case 2: + answ = true; + break; + + case 1: + default: + answ = false; + break; + } + return answ; + } + + /// + /// Verifica se sia visualizzabile preview dato stato + /// + /// + /// + public bool isPreviewVisible(object _status) + { + bool answ = false; + int status = -1; + int.TryParse(_status.ToString(), out status); + // solo stati 4 (nesting done), 5 (approvato), 6 (eliminazione logica) + if (status > 3 && status < 7) + { + answ = true; + } + return answ; + } + + /// + /// Tooltip in base a BatchType... + /// + /// + /// + public string tooltipByType(object _BatchType) + { + string answ = "-"; + + answ = traduci($"tooltipBatchType_{_BatchType}"); + return answ; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.designer.cs new file mode 100644 index 0000000..d2d57e9 --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsList.ascx.designer.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.WebUserControls +{ + + + public partial class cmp_BatchStatsList + { + + /// + /// divGraph control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divGraph; + + /// + /// cmp_BatchStatsPlot control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_BatchStatsPlot cmp_BatchStatsPlot; + + /// + /// chkPlotGraph control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox chkPlotGraph; + + /// + /// ddlType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList ddlType; + + /// + /// txtNumShow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox txtNumShow; + + /// + /// cmp_numRow control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::NKC_WF.WebUserControls.cmp_numRow cmp_numRow; + + /// + /// grView control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.GridView grView; + + /// + /// ods control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.ObjectDataSource ods; + } +} diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx new file mode 100644 index 0000000..d823053 --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx @@ -0,0 +1,87 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_BatchStatsPlot.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_BatchStatsPlot" %> + +<%--https://www.chartjs.org/--%> + +
+
+

Batch Stats Plot

+
+
+ + + + +
+
+ \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs new file mode 100644 index 0000000..8f7422f --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.WebUserControls +{ + public partial class cmp_BatchStatsPlot : System.Web.UI.UserControl + { + #region Public Properties + + public string Legend + { + get + { + return hfLegend.Value; + } + set + { + hfLegend.Value = value; + } + } + + public string PlotType + { + get + { + return hfPlotType.Value; + } + set + { + hfPlotType.Value = value; + } + } + + public int ShowLast + { + get + { + int answ = 0; + int.TryParse(hfShowLast.Value, out answ); + return answ; + } + set + { + hfShowLast.Value = $"{value}"; + } + } + + #endregion Public Properties + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.designer.cs b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.designer.cs new file mode 100644 index 0000000..27d6072 --- /dev/null +++ b/NKC_WF/WebUserControls/cmp_BatchStatsPlot.ascx.designer.cs @@ -0,0 +1,44 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.WebUserControls +{ + + + public partial class cmp_BatchStatsPlot + { + + /// + /// hfShowLast control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfShowLast; + + /// + /// hfPlotType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfPlotType; + + /// + /// hfLegend control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.HiddenField hfLegend; + } +} diff --git a/NKC_WF/WebUserControls/cmp_SheetsStats.ascx b/NKC_WF/WebUserControls/cmp_SheetsStats.ascx index e6cd530..d3c56b4 100644 --- a/NKC_WF/WebUserControls/cmp_SheetsStats.ascx +++ b/NKC_WF/WebUserControls/cmp_SheetsStats.ascx @@ -2,21 +2,16 @@ <%--https://www.chartjs.org/--%> -
-
+
+

Unload Part Plan (<%: hfBatchId.Value %>)

-
-
-
- - - -
-
+
+ + +
-