diff --git a/AppData/Enum.cs b/AppData/Enum.cs index b2b5b7c..09ed24d 100644 --- a/AppData/Enum.cs +++ b/AppData/Enum.cs @@ -6,12 +6,12 @@ using System.Threading.Tasks; namespace AppData { - public enum StatType - { - BATCH =1, - BUNK, - SHEET, - CART, - BIN - } + public enum StatType + { + BATCH = 1, + BUNK, + SHEET, + CART, + BIN + } } diff --git a/Jenkinsfile b/Jenkinsfile index a04bcfa..db3a690 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=334']) { + withEnv(['NEXT_BUILD_NUMBER=335']) { // env.versionNumber = VersionNumber(versionNumberString : '1.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.versionNumberBeta = VersionNumber(versionNumberString : '1.1.${BUILD_DATE_FORMATTED, "yyMM"}-beta.${BUILDS_ALL_TIME}', projectStartDate : '2019-07-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') diff --git a/NKC_WF/BaseUserControl.cs b/NKC_WF/BaseUserControl.cs index 29ecf80..d1acd09 100644 --- a/NKC_WF/BaseUserControl.cs +++ b/NKC_WF/BaseUserControl.cs @@ -100,22 +100,6 @@ namespace NKC_WF public string currIpAddress() { string userip = Request.UserHostAddress; - //if (Request.UserHostAddress != null) - //{ - // Int64 macinfo = new Int64(); - // string macSrc = macinfo.ToString("X"); - // if (macSrc == "0") - // { - // if (userip == "127.0.0.1") - // { - // Response.Write("visited Localhost!"); - // } - // else - // { - // lblIPAdd.Text = userip; - // } - // } - //} return userip; } /// @@ -130,5 +114,43 @@ namespace NKC_WF string answ = $"{baseUrl}{payload}"; return answ; } + /// + /// Calcola il rapporto tra 2 valori + /// + /// + /// + /// + public double getRatio(object _dividendo, object _divisore) + { + double ratio = 0; + double dividendo = 0; + double divisore = 1; + double.TryParse(_dividendo.ToString(), out dividendo); + double.TryParse(_divisore.ToString(), out divisore); + ratio = dividendo / divisore; + return ratio; + } + /// + /// determina CSS x colore testo da perc svuotamento... + /// + /// + /// + public string getCssByRatio(double ratio) + { + string answ = "text-dark"; + if (ratio == 0) + { + answ = "text-danger"; + } + else if (ratio == 1) + { + answ = "text-success"; + } + else + { + answ = "text-warning"; + } + return answ; + } } } \ No newline at end of file diff --git a/NKC_WF/Controllers/PrintQueueController.cs b/NKC_WF/Controllers/PrintQueueController.cs index a10d87b..4649137 100644 --- a/NKC_WF/Controllers/PrintQueueController.cs +++ b/NKC_WF/Controllers/PrintQueueController.cs @@ -8,7 +8,6 @@ using System.Data; using System.IO; using System.Linq; using System.Web.Http; -using System.Web.Http.ModelBinding; namespace NKC_WF.Controllers { @@ -210,37 +209,6 @@ namespace NKC_WF.Controllers return answ; } - - /// - /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO - /// GET: api/PrintQueue?queueList=|queueOffline| - /// - /// Elenco code delimitate da |..| - /// - //[HttpGet] - //[Route("count")] - public int GetCount(string queueList) - { - // restituisco... - int answ = 0; - string redVal = memLayer.ML.getRSV($"{ComLib.redQueueCountSet}:{queueList}"); - // cerco in redis se ci sia chiave.. - if (!string.IsNullOrEmpty(redVal)) - { - // recupero - int.TryParse(redVal, out answ); - } - else - { - // recupero da db e salvo - answ = countWaitingDbQueueMult(queueList); - memLayer.ML.setRSV($"{ComLib.redQueueCountSet}:{queueList}", answ.ToString(), memLayer.ML.CRI("cacheQueueSec")); - // chiudo gli zombie (stampe non chiuse)... - DataLayer.man.taPJQ.chiudiZoombie(DateTime.Now.AddMilliseconds(-memLayer.ML.CRI("zombieMsTime"))); - } - return answ; - } - /// /// Processa una chiamata POST per l'invio in blocco del risultato dell'elaborazione /// POST: api/PrintQueue diff --git a/NKC_WF/Controllers/PrintQueueLenController.cs b/NKC_WF/Controllers/PrintQueueLenController.cs new file mode 100644 index 0000000..3e45914 --- /dev/null +++ b/NKC_WF/Controllers/PrintQueueLenController.cs @@ -0,0 +1,213 @@ +using AppData; +using Newtonsoft.Json; +using NKC_SDK; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.Web.Http; + +namespace NKC_WF.Controllers +{ + public class PrintQueueLenController : ApiController + { + #region classi gestione PJQ + + /// + /// Conteggio elementi in attesa stampa da DB + /// + protected int countWaitingDb + { + get + { + int answ = 0; + // resetto conteggio in redis... + DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getWaiting(); + if (tabPJQ != null) + { + answ = tabPJQ.Count; + } + return answ; + } + } + /// + /// Conteggio elementi in attesa stampa da DB che fanno parte di un SET di queue + /// + protected int countWaitingDbQueueMult(string queueSet) + { + int answ = 0; + // resetto conteggio in redis... + DS_Report.PrintJobQueueDataTable tabPJQ = DataLayer.man.taPJQ.getWaiting(); + if (tabPJQ != null) + { + var selQueue = tabPJQ.Where(x => queueSet.Contains($"|{x.prtName}|")).ToList(); + if (selQueue != null) + { + answ = selQueue.Count; + } + } + return answ; + } + /// + /// Carica i dati richiesti dal report dalla StoredProcedure (filtrando quindi...) e restituisce Dictionary [nome RDS / tab RDS] + /// + /// + /// cod UDC + /// tabella dati + private Dictionary caricaDati(reportRichiesto tipoReport, string keyParam) + { + int intIdx = 0; + Dictionary answ = new Dictionary(); + DataTable tab = new DataTable(); + // FIXME TODO... + string qrCodeBaseUrl = ""; + string imagePath = ""; //"http://seriate.steamware.net:8083/NKC/PartsImg/"; + switch (tipoReport) + { + case reportRichiesto.binPost: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepBin.GetData(intIdx, true, imagePath, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocBin"), tab); + break; + case reportRichiesto.binPre: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepBin.GetData(intIdx, false, imagePath, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocBin"), tab); + break; + case reportRichiesto.bunkGroup: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepBunkGroup.GetData(intIdx, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocBunkGroup"), tab); + break; + case reportRichiesto.bunkList: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepBunkList.GetData(intIdx, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocBunkList"), tab); + break; + case reportRichiesto.cart: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepCart.GetData(intIdx, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocCart"), tab); + break; + case reportRichiesto.offline: + case reportRichiesto.part: + int.TryParse(keyParam, out intIdx); + tab = (DataTable)DataLayer.man.taRepPart.GetData(intIdx, qrCodeBaseUrl); + answ.Add(memLayer.ML.cdv("ReportDS_DocPart"), tab); + break; + default: + break; + } + tab.Dispose(); + return answ; + } + + /// + /// Calcola report da tipo + nome coda... + /// + /// + /// + /// + protected reportRichiesto reportByTipo(string tipo, string queueName) + { + reportRichiesto report = reportRichiesto.bunkGroup; + switch (tipo) + { + case "docStack": + if (queueName == "queueBunkDetail") + { + report = reportRichiesto.bunkList; + } + else + { + report = reportRichiesto.bunkGroup; + } + break; + case "docBinPre": + report = reportRichiesto.binPre; + break; + case "docBinPost": + report = reportRichiesto.binPost; + break; + case "docCart": + report = reportRichiesto.cart; + break; + case "docPart": + report = reportRichiesto.part; + break; + case "docOffline": + report = reportRichiesto.offline; + break; + default: + break; + } + return report; + } + + #endregion + + #region REST api call + + /// + /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO + /// GET: api/PrintQueue + /// + /// + public int Get() + { + // restituisco... + int answ = 0; + string redVal = memLayer.ML.getRSV(ComLib.redQueueCount); + // cerco in redis se ci sia chiave.. + if (!string.IsNullOrEmpty(redVal)) + { + // recupero + int.TryParse(redVal, out answ); + } + else + { + // recupero da db e salvo + answ = countWaitingDb; + memLayer.ML.setRSV(ComLib.redQueueCount, answ.ToString(), memLayer.ML.CRI("cacheQueueSec")); + // chiudo gli zombie (stampe non chiuse)... + DataLayer.man.taPJQ.chiudiZoombie(DateTime.Now.AddMilliseconds(-memLayer.ML.CRI("zombieMsTime"))); + } + return answ; + } + + + + /// + /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO + /// GET: api/PrintQueue?queueList=|queueOffline| + /// + /// Elenco code delimitate da |..| + /// + public int Get(string queueList) + { + // restituisco... + int answ = 0; + string redVal = memLayer.ML.getRSV($"{ComLib.redQueueCountSet}:{queueList}"); + // cerco in redis se ci sia chiave.. + if (!string.IsNullOrEmpty(redVal)) + { + // recupero + int.TryParse(redVal, out answ); + } + else + { + // recupero da db e salvo + answ = countWaitingDbQueueMult(queueList); + memLayer.ML.setRSV($"{ComLib.redQueueCountSet}:{queueList}", answ.ToString(), memLayer.ML.CRI("cacheQueueSec")); + // chiudo gli zombie (stampe non chiuse)... + DataLayer.man.taPJQ.chiudiZoombie(DateTime.Now.AddMilliseconds(-memLayer.ML.CRI("zombieMsTime"))); + } + return answ; + } + + + #endregion + } +} diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 0749357..befb1ab 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -637,6 +637,7 @@ + diff --git a/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs index 3b60ff3..dda3f22 100644 --- a/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_bins.ascx.cs @@ -95,44 +95,6 @@ namespace NKC_WF.WebUserControls grView.DataBind(); } /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// /// Dimensione QRCode /// public int qrSize diff --git a/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs index c8728c2..e86f8a3 100644 --- a/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_carts.ascx.cs @@ -111,44 +111,6 @@ namespace NKC_WF.WebUserControls grView.DataBind(); } /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// /// Alla selezione mando in stampa il singolo record /// /// diff --git a/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs b/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs index 8ae1eb2..0c79380 100644 --- a/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_MU_stats.ascx.cs @@ -57,43 +57,5 @@ namespace NKC_WF.WebUserControls cmp_MU_singleStatCart.titleCss = "bg-success"; } - /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } } } \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs b/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs index c9e7697..2a89b9e 100644 --- a/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_paint_bins.ascx.cs @@ -138,44 +138,6 @@ namespace NKC_WF.WebUserControls grView.DataBind(); } /// - /// Calcola il rapporto tra 2 valori - /// - /// - /// - /// - public double getRatio(object _dividendo, object _divisore) - { - double ratio = 0; - double dividendo = 0; - double divisore = 1; - double.TryParse(_dividendo.ToString(), out dividendo); - double.TryParse(_divisore.ToString(), out divisore); - ratio = dividendo / divisore; - return ratio; - } - /// - /// determina CSS x colore testo da perc svuotamento... - /// - /// - /// - public string getCssByRatio(double ratio) - { - string answ = "text-dark"; - if (ratio == 0) - { - answ = "text-danger"; - } - else if (ratio == 1) - { - answ = "text-success"; - } - else - { - answ = "text-warning"; - } - return answ; - } - /// /// Dimensione QRCode /// public int qrSize