diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs
index f3d2050..87292e7 100644
--- a/AppData/ComLib.cs
+++ b/AppData/ComLib.cs
@@ -195,6 +195,16 @@ namespace AppData
public static string redMachUnloadCount = "NKC:SERV:MACH_UNLOAD:COUNT";
public static string redMachUnloadForce = "NKC:SERV:MACH_UNLOAD:FORCERELOAD";
+
+ ///
+ /// chaive redis x cache conteggio coda PJQ
+ ///
+ public static string redQueueCount = "NKC:SERV:PJQ";
+ ///
+ /// chaive redis x cache conteggio coda PJQ composta da tante code
+ ///
+ public static string redQueueCountSet = "NKC:SERV:PJQCOUNT";
+
#endregion
#region definizione classi impiegate con PROD
diff --git a/AppData/DataLayer.cs b/AppData/DataLayer.cs
index 0acf848..3323c67 100644
--- a/AppData/DataLayer.cs
+++ b/AppData/DataLayer.cs
@@ -264,6 +264,9 @@ namespace AppData
if (checkDoc(tipoDoc, keyParam))
{
answ = reportPrinter.obj.stampaCartellino(tipoDoc, keyParam, printer, true);
+ // svuoto code redis salvate..
+ memLayer.ML.redFlushKey(ComLib.redQueueCount);
+ memLayer.ML.redFlushKey(ComLib.redQueueCountSet);
if (answ)
{
logger.lg.scriviLog(string.Format(" | {0} | stampato UDC {1} | stampante {2} | tipo {3}", clientIp, keyParam, printer, tipoDoc), tipoLog.INFO);
diff --git a/Jenkinsfile b/Jenkinsfile
index 6739e6e..1f6313b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -11,7 +11,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=327']) {
+ withEnv(['NEXT_BUILD_NUMBER=328']) {
// 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/Controllers/PrintQueueController.cs b/NKC_WF/Controllers/PrintQueueController.cs
index a38740a..e206093 100644
--- a/NKC_WF/Controllers/PrintQueueController.cs
+++ b/NKC_WF/Controllers/PrintQueueController.cs
@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
+using System.Linq;
using System.Web.Http;
using System.Web.Http.ModelBinding;
@@ -16,11 +17,7 @@ namespace NKC_WF.Controllers
#region classi gestione PJQ
///
- /// chaive redis x cache conteggio coda PJQ
- ///
- internal static string redQueueCount = "NKC:SERV:PJQ";
- ///
- /// Conteggio elementi in attesa stsampa da DB
+ /// Conteggio elementi in attesa stampa da DB
///
protected int countWaitingDb
{
@@ -37,6 +34,24 @@ namespace NKC_WF.Controllers
}
}
///
+ /// 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]
///
///
@@ -145,7 +160,7 @@ namespace NKC_WF.Controllers
{
// restituisco...
int answ = 0;
- string redVal = memLayer.ML.getRSV(redQueueCount);
+ string redVal = memLayer.ML.getRSV(ComLib.redQueueCount);
// cerco in redis se ci sia chiave..
if (!string.IsNullOrEmpty(redVal))
{
@@ -154,11 +169,11 @@ namespace NKC_WF.Controllers
}
else
{
- // chiudo gli zombie (stampe non chiuse)...
- DataLayer.man.taPJQ.chiudiZoombie(DateTime.Now.AddMilliseconds(-memLayer.ML.CRI("zombieMsTime")));
// recupero da db e salvo
answ = countWaitingDb;
- memLayer.ML.setRSV(redQueueCount, answ.ToString(), memLayer.ML.CRI("cacheQueueSec"));
+ 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;
}
@@ -195,6 +210,37 @@ namespace NKC_WF.Controllers
return answ;
}
+
+ ///
+ /// Restituisce numero jobs aperti (stato = 0...), se 0 = NESSUNO
+ /// GET: api/PrintQueue/GetCount/|queue01|queue02|queue03|
+ ///
+ /// 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
@@ -225,7 +271,9 @@ namespace NKC_WF.Controllers
int.TryParse(printAnsw.ticketNum, out idxPJQ);
DataLayer.man.taPJQ.updateStato(idxPJQ, printAnsw.newStatus);
// resetto conteggio in redis...
- memLayer.ML.setRSV(redQueueCount, countWaitingDb.ToString(), memLayer.ML.CRI("cacheQueueSec"));
+ memLayer.ML.setRSV(ComLib.redQueueCount, countWaitingDb.ToString(), memLayer.ML.CRI("cacheQueueSec"));
+ // svuoto code redis salvate..
+ memLayer.ML.redFlushKey(ComLib.redQueueCountSet);
answ = "OK";
}
}
diff --git a/NKC_WF/Web.config b/NKC_WF/Web.config
index b9bacb7..af03bc1 100644
--- a/NKC_WF/Web.config
+++ b/NKC_WF/Web.config
@@ -403,6 +403,13 @@
+
+
+
+
+
+
+