diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs index 39bdaaf..ec32b7c 100644 --- a/AppData/ComLib.cs +++ b/AppData/ComLib.cs @@ -184,7 +184,7 @@ namespace AppData public static string redOutPath = "NKC:SERV:BREQ"; public static string redMsgCount = "NKC:SERV:BREQ:MCount"; public static string redMsgList = "NKC:SERV:BREQ:MList"; - public static string redMLCurrStack = "NKC:SERV:TAKT:CurrStack"; + public static string redMLCurrBunk = "NKC:SERV:TAKT:CurrBunk"; public static string redNestAnsw = "NKC:NEST:BANSW"; @@ -1165,25 +1165,121 @@ namespace AppData /// /// Chiave bunk corrente su redis /// - protected static string redCurrBunkTabKey() + /// + /// + protected static string redCurrBunkTabKey(string machine) { - return $"{redProdReq}:CurrBunks"; + string answ = ""; + if (string.IsNullOrEmpty(machine)) + { + answ = $"{redProdReq}:CurrBunks"; + } + else + { + answ = $"{redProdReq}:CurrBunks:{machine}"; + } + return answ; } /// - /// Chiave bunk corrente su redis + /// Chiave sheets correnti su redis /// - protected static string redCurrSheetTabKey() + /// + /// + protected static string redCurrSheetTabKey(string machine) { - return $"{redProdReq}:CurrSheets"; + string answ = ""; + if (string.IsNullOrEmpty(machine)) + { + answ = $"{redProdReq}:CurrSheets"; + } + else + { + answ = $"{redProdReq}:CurrSheets:{machine}"; + } + return answ; + } + /// + /// Chiave Bunk corrente su redis + /// + /// + /// + protected static string redCurrBunkId(string machine) + { + string answ = ""; + if (string.IsNullOrEmpty(machine)) + { + answ = $"{redProdReq}:CurrBunkID"; + } + else + { + answ = $"{redProdReq}:CurrBunkID:{machine}"; + } + return answ; + } + /// + /// Chiave Sheets corrente su redis + /// + /// + /// + protected static string redCurrSheetId(string machine) + { + string answ = ""; + if (string.IsNullOrEmpty(machine)) + { + answ = $"{redProdReq}:CurrSheetID"; + } + else + { + answ = $"{redProdReq}:CurrSheetID:{machine}"; + } + return answ; } /// /// Resetto in REDIS i dati di bunk (corrente e successivi) /// - public static void resetRedisBunkData() + public static void resetRedisBunkData(string machine) { + resetCurrBunk(); + resetCurrSheet(); + setCurrBunkId(machine, -2); + setCurrSheetId(machine, -2); redisFirstBunk = null; } /// + /// Cache redis del BunkID in lavorazione sulla macchina + /// + public static int getCurrBunkId(string macchina) + { + int answ = -1; + string rawData = memLayer.ML.getRSV(redCurrBunkId(macchina)); + int.TryParse(rawData, out answ); + return answ; + } + /// + /// Salvataggio in redis del BunkID in lavorazione sulla macchina + /// + public static void setCurrBunkId(string macchina, int BunkID) + { + memLayer.ML.setRSV(redCurrBunkId(macchina), BunkID.ToString()); + } + /// + /// Cache redis del SheetID in lavorazione sulla macchina + /// + public static int getCurrSheetId(string macchina) + { + int answ = -1; + string rawData = memLayer.ML.getRSV(redCurrSheetId(macchina)); + int.TryParse(rawData, out answ); + return answ; + } + /// + /// Salvataggio in redis del SheetID in lavorazione sulla macchina + /// + public static void setCurrSheetId(string macchina, int SheetID) + { + memLayer.ML.setRSV(redCurrBunkId(macchina), SheetID.ToString()); + } + /// /// Cache redis del PRIMO bunk da lavorare /// private static ProdBunk redisFirstBunk @@ -1436,20 +1532,20 @@ namespace AppData /// BUNK corrente (x ora copia di first, poi sarà quello SELEZIONATO tra quelli SELEZIONABILI) /// /// - public static DS_App.StackListRow getCurrBunk() + public static DS_App.StackListRow getCurrBunk(string machine = "WRK001") { DS_App.StackListRow answ = null; DS_App.StackListDataTable tabBunk = null; // cerco in cache.... - if (cachedCurrBunkTab != null) + if (getCurrBunkTab(machine) != null) { - tabBunk = cachedCurrBunkTab; + tabBunk = getCurrBunkTab(machine); } else { tabBunk = DataLayer.man.taSTL.getLoaded(); // salvo in redis - cachedCurrBunkTab = tabBunk; + setCurrBunkTab(machine, tabBunk); } if (tabBunk != null && tabBunk.Count > 0) { @@ -1457,31 +1553,46 @@ namespace AppData } return answ; } - - protected static DS_App.StackListDataTable cachedCurrBunkTab + /// + /// resetto curr bunk + /// + /// + public static void resetCurrBunk(string machine = "WRK001") { - get + // svuoto" + memLayer.ML.redFlushKey(redCurrBunkTabKey(machine)); + } + /// + /// lettura currBunk table da cache + /// + /// + /// + protected static DS_App.StackListDataTable getCurrBunkTab(string machine) + { + DS_App.StackListDataTable answ = null; + string rawData = memLayer.ML.getRSV(redCurrBunkTabKey(machine)); + if (!string.IsNullOrEmpty(rawData)) { - DS_App.StackListDataTable answ = null; - string rawData = memLayer.ML.getRSV(redCurrBunkTabKey()); - if (!string.IsNullOrEmpty(rawData)) + try { - try - { - // deserializzo... - answ = JsonConvert.DeserializeObject(rawData); - } - catch - { } + // deserializzo... + answ = JsonConvert.DeserializeObject(rawData); } - return answ; - } - set - { - string rawData = JsonConvert.SerializeObject(value); - // TTL 5 sec - memLayer.ML.setRSV(redCurrBunkTabKey(), rawData, 5); + catch + { } } + return answ; + } + /// + /// salvataggio inc ache currBunk table + /// + /// + /// + protected static void setCurrBunkTab(string machine, DS_App.StackListDataTable tabBunks) + { + string rawData = JsonConvert.SerializeObject(tabBunks); + // TTL 15 sec + memLayer.ML.setRSV(redCurrBunkTabKey(machine), rawData, 15); } /// @@ -1504,8 +1615,9 @@ namespace AppData /// Recupera lo sheet corrente da un BUNK come quello in status 5... /// /// + /// /// - public static DS_App.SheetListRow getCurrSheet(int BatchID) + public static DS_App.SheetListRow getCurrSheet(int BatchID, string machine) { DS_App.SheetListRow answ = null; if (BatchID > 0) @@ -1514,17 +1626,18 @@ namespace AppData { DS_App.SheetListDataTable tabSheets = null; // cerco in cache.... - if (cachedCurrSheetTab != null) + if (getCurrSheetTab(machine) != null) { - tabSheets = cachedCurrSheetTab; + tabSheets = getCurrSheetTab(machine); } else { // recupero sheet corrente da Bunk... tabSheets = DataLayer.man.taSHL.getByMLStatus(BatchID, 5, 5); // salvo in redis - cachedCurrSheetTab = tabSheets; + setCurrSheetTab(machine, tabSheets); } + // leggo prima riga --> foglio corrente if (tabSheets != null && tabSheets.Count > 0) { answ = tabSheets[0]; @@ -1535,31 +1648,44 @@ namespace AppData } return answ; } - - protected static DS_App.SheetListDataTable cachedCurrSheetTab + /// + /// resetto curr sheets + /// + /// + public static void resetCurrSheet(string machine = "WRK001") { - get + // svuoto" + memLayer.ML.redFlushKey(redCurrSheetTabKey(machine)); + } + /// + /// Recupero da redis tab fogli correnti + /// + protected static DS_App.SheetListDataTable getCurrSheetTab(string machine) + { + DS_App.SheetListDataTable answ = null; + string rawData = memLayer.ML.getRSV(redCurrSheetTabKey(machine)); + if (!string.IsNullOrEmpty(rawData)) { - DS_App.SheetListDataTable answ = null; - string rawData = memLayer.ML.getRSV(redCurrSheetTabKey()); - if (!string.IsNullOrEmpty(rawData)) + try { - try - { - // deserializzo... - answ = JsonConvert.DeserializeObject(rawData); - } - catch - { } + // deserializzo... + answ = JsonConvert.DeserializeObject(rawData); } - return answ; - } - set - { - string rawData = JsonConvert.SerializeObject(value); - // TTL 5 sec - memLayer.ML.setRSV(redCurrSheetTabKey(), rawData, 5); + catch + { } } + return answ; + } + /// + /// Salvataggio in redis tab fogli correnti + /// + /// + /// + protected static void setCurrSheetTab(string machine, DS_App.SheetListDataTable tabella) + { + string rawData = JsonConvert.SerializeObject(tabella); + // TTL 5 sec + memLayer.ML.setRSV(redCurrSheetTabKey(machine), rawData, 2); } /// /// Restituisce il PROSSIMO bunk secondo criterio: @@ -1772,17 +1898,17 @@ namespace AppData return answ; } /// - /// Valore dello Stack correntemente in processing per ML (MachineLoad) + /// ID del BUNK correntemente in processing per ML (MachineLoad) /// - public static string taktMLCurrStack + public static string taktMLCurrBunk { get { - return memLayer.ML.getRSV(redMLCurrStack); + return memLayer.ML.getRSV(redMLCurrBunk); } set { - memLayer.ML.setRSV(redMLCurrStack, value); + memLayer.ML.setRSV(redMLCurrBunk, value); } } diff --git a/Jenkinsfile b/Jenkinsfile index 8cbf4c9..c6a39d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,7 +11,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=325']) { + withEnv(['NEXT_BUILD_NUMBER=326']) { // 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/BunkController.cs b/NKC_WF/Controllers/BunkController.cs index a657d43..00c51f5 100644 --- a/NKC_WF/Controllers/BunkController.cs +++ b/NKC_WF/Controllers/BunkController.cs @@ -8,6 +8,10 @@ namespace NKC_WF.Controllers { public class BunkController : ApiController { + /// + /// COdice macchina (HARD CODED) + /// + protected string machine = "WRK001"; /// /// Restituisce il FIRST BUNK da lavorare /// GET: api/Bunk @@ -101,7 +105,7 @@ namespace NKC_WF.Controllers } } // INVALIDO eventuale valore BUNK in REDIS... - ComLib.resetRedisBunkData(); + ComLib.resetRedisBunkData(machine); } /// diff --git a/NKC_WF/Controllers/SheetController.cs b/NKC_WF/Controllers/SheetController.cs index 7b9e50a..fbe76af 100644 --- a/NKC_WF/Controllers/SheetController.cs +++ b/NKC_WF/Controllers/SheetController.cs @@ -8,6 +8,10 @@ namespace NKC_WF.Controllers { public class SheetController : ApiController { + /// + /// COdice macchina (HARD CODED) + /// + protected string machine = "WRK001"; /// /// Restituisce un array di sheet da lavorare (quindi NON ancora scaricati, anche di + BUNK) /// GET: api/Sheet @@ -95,7 +99,7 @@ namespace NKC_WF.Controllers if (currSheet.Machining.DtEnd != null) { // hard coded su multiax - DataLayer.man.taIL.updateSheetStatus(currSheet.SheetId, 1, "WRK001"); + DataLayer.man.taIL.updateSheetStatus(currSheet.SheetId, 1, machine); } } // segnalo avanzamento su redis x pagina unload @@ -113,7 +117,7 @@ namespace NKC_WF.Controllers // ricalcolo stato BUNK ComLib.updateBatchPosition(BatchId); // INVALIDO eventuale valore BUNK in REDIS... - ComLib.resetRedisBunkData(); + ComLib.resetRedisBunkData(machine); } } @@ -175,6 +179,8 @@ namespace NKC_WF.Controllers } // ricalcolo stato BUNK ComLib.updateBatchPosition(BatchId); + // INVALIDO eventuale valore BUNK in REDIS... + ComLib.resetRedisBunkData(machine); } } catch diff --git a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx index befb80b..540410e 100644 --- a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx +++ b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx @@ -17,13 +17,17 @@ SheetId = document.getElementById('<%=hfSheetId.ClientID%>').value; lastVal = document.getElementById('<%=hfCurrRev.ClientID%>').value; lastValBunk = document.getElementById('<%=hfCurrBunkRev.ClientID%>').value; + // commento sennò ricarica sempre document.getElementById("dynCss").href = "../api/getMUCss/" + SheetId; $.ajax({ url: "../api/getMUCssRev/" + SheetId }).then(function (data) { + //console.log("Check cssRev: data=" + data + " | lastVal=" + lastVal); // se è cambiato... if (data != lastVal) { console.log("Changed cssRev: data=" + data + " | lastVal=" + lastVal); + // aggiorno e ricarico css + //document.getElementById("dynCss").href = "../api/getMUCss/" + SheetId; $('#uplTavola').load(location.href + ' #dynCss'); document.getElementById('<%=hfCurrRev.ClientID%>').value = data; } @@ -32,6 +36,7 @@ $.ajax({ url: "../api/getMUSheetRev/" + BunkId }).then(function (data) { + //console.log("Check SheetReview: data=" + data + " | lastValBunk=" + lastValBunk); // se è cambiato... if (data != lastValBunk) { console.log("Changed SheetReview: data=" + data + " | lastValBunk=" + lastValBunk); diff --git a/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs b/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs index e3dfdcd..8ccc0ad 100644 --- a/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_secScreen.ascx.cs @@ -17,6 +17,11 @@ namespace NKC_WF.WebUserControls public partial class cmp_secScreen : BaseUserControl { + /// + /// Codice macchina (HARD CODED x ora) + /// + protected string machine = "WRK001"; + protected void timerRefresh_Tick(object sender, EventArgs e) { countDown--; @@ -38,7 +43,7 @@ namespace NKC_WF.WebUserControls DS_App.StackListRow currBunk = ComLib.getCurrBunk(); if (currBunk != null) { - DS_App.SheetListRow currSheet = ComLib.getCurrSheet(currBunk.BatchID); + DS_App.SheetListRow currSheet = ComLib.getCurrSheet(currBunk.BatchID, machine); if (currSheet != null) { // se variato... diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs index 5bdb762..29d3f25 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs @@ -162,7 +162,8 @@ namespace NKC_WF.WebUserControls if (currentBunkPrinted) { cmp_barcode.showOutput("badge badge-success", $"BUNK OK, {decoData.rawData}"); - ComLib.taktMLCurrStack = decoData.code; + ComLib.resetCurrBunk(); + ComLib.taktMLCurrBunk = decoData.codeInt.ToString(); // processo DB e salvo che lo stack è stato caricato in MACHINE LOAD int stackId = 0; try diff --git a/NKC_WF/site/DBG_QRCode_Unload.aspx.cs b/NKC_WF/site/DBG_QRCode_Unload.aspx.cs index 1f97738..8da202f 100644 --- a/NKC_WF/site/DBG_QRCode_Unload.aspx.cs +++ b/NKC_WF/site/DBG_QRCode_Unload.aspx.cs @@ -7,6 +7,8 @@ namespace NKC_WF.site { public partial class DBG_QRCode_Unload : System.Web.UI.Page { + + string machine ="WRK001"; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) @@ -92,7 +94,7 @@ namespace NKC_WF.site if (currBunk != null) { BatchId = currBunk.BatchID; - DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); + DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId, machine); if (currSheet != null) { SheetId = currSheet.SheetID; diff --git a/NKC_WF/site/MachineUnload.aspx b/NKC_WF/site/MachineUnload.aspx index 204cd5e..49aa670 100644 --- a/NKC_WF/site/MachineUnload.aspx +++ b/NKC_WF/site/MachineUnload.aspx @@ -9,11 +9,14 @@
-

<%: traduci("MachineUnload") %> (<%: hfBatchID.Value %>)

+ + +

<%: traduci("MachineUnload") %> (<%: hfBatchID.Value %>)

+
+
- + - @@ -21,7 +24,7 @@
- + @@ -35,8 +38,9 @@
- + + diff --git a/NKC_WF/site/MachineUnload.aspx.cs b/NKC_WF/site/MachineUnload.aspx.cs index fb864d1..5f514cf 100644 --- a/NKC_WF/site/MachineUnload.aspx.cs +++ b/NKC_WF/site/MachineUnload.aspx.cs @@ -6,11 +6,18 @@ namespace NKC_WF { public partial class MachineUnload : BasePage { + /// + /// Codice macchina (HARD CODED x ora) + /// + protected string machine = "WRK001"; + protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ((SiteMaster)this.Master).showSearch = false; + BatchId = -1; + SheetId = -1; doUpdate(); } } @@ -23,10 +30,11 @@ namespace NKC_WF set { hfBatchID.Value = value.ToString(); + ComLib.setCurrBunkId(machine, value); } get { - int answ = 0; + int answ = ComLib.getCurrBunkId(machine); int.TryParse(hfBatchID.Value, out answ); return answ; } @@ -39,10 +47,11 @@ namespace NKC_WF set { hfSheetID.Value = value.ToString(); + ComLib.setCurrSheetId(machine, value); } get { - int answ = 0; + int answ = ComLib.getCurrSheetId(machine); int.TryParse(hfSheetID.Value, out answ); return answ; } @@ -54,15 +63,16 @@ namespace NKC_WF { // imposto dati correnti bool doUpdate = setCurrData(); + // aggiorno child + cmp_MU_stats.BatchId = BatchId; + cmp_MU_bins.BatchId = BatchId; + cmp_MU_carts.BatchId = BatchId; + cmp_MU_svgViewer.BatchId = BatchId; + cmp_MU_svgViewer.SheetId = SheetId; if (doUpdate) { - // aggiorno child - cmp_MU_stats.BatchId = BatchId; - cmp_MU_bins.BatchId = BatchId; - cmp_MU_carts.BatchId = BatchId; - cmp_MU_svgViewer.BatchId = BatchId; - cmp_MU_svgViewer.SheetId = SheetId; cmp_MU_svgViewer.doUpdate(); + upnlTitle.Update(); } } /// @@ -81,7 +91,7 @@ namespace NKC_WF needUpdate = true; } - DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId); + DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId, machine); if (currSheet != null) { if (SheetId != currSheet.SheetID) @@ -94,10 +104,12 @@ namespace NKC_WF else { BatchId = 0; + ComLib.setCurrBunkId(machine, 0); + ComLib.setCurrSheetId(machine, 0); ComLib.man.resetSheetUnload(0); } // se sheet/bunk 0 --> update! - if (BatchId == 0 && SheetId == 0) + if (BatchId <= 0 && SheetId <= 0) { needUpdate = true; } @@ -113,11 +125,18 @@ namespace NKC_WF if (counter % 10 == 0) { cmp_MU_stats.doUpdate(); + upnlStats.Update(); } - if (counter % 2 == 0) + // faccio update bin/cart ogni pari/dispari... + else if (counter % 2 == 0) { cmp_MU_carts.doUpdate(); + upnlCarts.Update(); + } + else + { cmp_MU_bins.doUpdate(); + upnlBins.Update(); } incrNumWait(); } @@ -154,9 +173,10 @@ namespace NKC_WF /// protected void incrNumWait() { - if (numWaitSvg > 30) + if (numWaitSvg > 20) { memLayer.ML.resetRCnt(redProdReq); + Response.Redirect(Request.RawUrl); } memLayer.ML.setRCntI(redProdReq); } diff --git a/NKC_WF/site/MachineUnload.aspx.designer.cs b/NKC_WF/site/MachineUnload.aspx.designer.cs index dbdbd7b..655bc4e 100644 --- a/NKC_WF/site/MachineUnload.aspx.designer.cs +++ b/NKC_WF/site/MachineUnload.aspx.designer.cs @@ -14,6 +14,15 @@ namespace NKC_WF public partial class MachineUnload { + /// + /// Controllo upnlTitle. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.UpdatePanel upnlTitle; + /// /// Controllo upnlStats. /// @@ -23,15 +32,6 @@ namespace NKC_WF /// protected global::System.Web.UI.UpdatePanel upnlStats; - /// - /// Controllo timerSvg. - /// - /// - /// Campo generato automaticamente. - /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. - /// - protected global::System.Web.UI.Timer timerSvg; - /// /// Controllo hfBatchID. /// @@ -104,6 +104,15 @@ namespace NKC_WF /// protected global::System.Web.UI.UpdatePanel upnlCarts; + /// + /// Controllo timerSvg. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.Timer timerSvg; + /// /// Controllo cmp_MU_carts. ///