From 1e85c4f92bd4e11ac62d1c7648cc2960b53ac02f Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 15 Feb 2020 17:55:49 +0100 Subject: [PATCH] Ok registrazioen avanzamento foglio in unload --- AppData/ComLib.cs | 75 ++++++++++++++++++- NKC_WF/Controllers/BunkController.cs | 2 + NKC_WF/Controllers/getMUSheetRevController.cs | 24 ++++++ NKC_WF/NKC_WF.csproj | 1 + NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx | 1 - .../WebUserControls/cmp_stackLoading.ascx.cs | 2 + 6 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 NKC_WF/Controllers/getMUSheetRevController.cs diff --git a/AppData/ComLib.cs b/AppData/ComLib.cs index 7243526..cc465a3 100644 --- a/AppData/ComLib.cs +++ b/AppData/ComLib.cs @@ -1061,7 +1061,7 @@ namespace AppData // !!!FIXME!!! } /// - /// Esegue richieste lettura da PROD + /// Esegue richieste scrittura da PROD /// public static void procProdWriteReq() { @@ -1518,6 +1518,79 @@ namespace AppData } return answ; } + /// + /// Calcola area REDIS per BUNK in fase di scarico + /// + /// + /// + public static string machineUnloadBunkArea(int BunkID) + { + // se 0 --> tutto l'albero, sennò solo area corrente... + string answ = ""; + if (BunkID > 0) + { + answ = memLayer.ML.redHash($"MachineUnload:Bunk:{BunkID}"); + } + else + { + answ = memLayer.ML.redHash($"MachineUnload:Bunk"); + } + return answ; + } + + + /// + /// Recupera da REDIS info indice revisione x BUNK (cambio foglio) + /// + /// + /// + public static int getSheetRevByBunk(int BunkID) + { + int answ = 0; + if (BunkID > 0) + { + // recupero da REDIS! + string redKeyExp = memLayer.ML.redHash($"DataExp"); + string redKeyRev = $"{ComLib.machineUnloadBunkArea(BunkID)}:Rev"; + // controllo expiry globale... se manca SVUOTO area + string rawData = memLayer.ML.getRSV(redKeyExp); + if (string.IsNullOrEmpty(rawData)) + { + // svuoto e scrivo... + memLayer.ML.redFlushKey(memLayer.ML.redHash($"MachineUnload")); + memLayer.ML.redFlushKey(memLayer.ML.redHash($"TabSheets")); + memLayer.ML.setRSV(redKeyExp, $"Reload Data {DateTime.Now}", 3600); + } + answ = memLayer.ML.getRCnt(redKeyRev); + } + return answ; + } + + + /// + /// Aggiorna revisione indice sheet x BUNK (cambio foglio) + /// + /// + /// + public static long advaceSheetRevByBunk(int BunkID) + { + long answ = 0; + if (BunkID > 0) + { + // recupero da REDIS! + string redKeyExp = memLayer.ML.redHash($"DataExp"); + string redKeyRev = $"{ComLib.machineUnloadBunkArea(BunkID)}:Rev"; + // incremento... + answ = memLayer.ML.setRCntI(redKeyRev); + // se > 999 --> resetto + if (answ > 999) + { + memLayer.ML.resetRCnt(redKeyRev); + } + } + return answ; + } + /// /// Svuota elenco pezzi nella postazione di unload diff --git a/NKC_WF/Controllers/BunkController.cs b/NKC_WF/Controllers/BunkController.cs index 922a853..009a1c4 100644 --- a/NKC_WF/Controllers/BunkController.cs +++ b/NKC_WF/Controllers/BunkController.cs @@ -140,6 +140,8 @@ namespace NKC_WF.Controllers DataLayer.man.taIL.updateSheetStatus(item.SheetId, 1, "PROD"); } } + // segnalo avanzamento su redis x pagina unload + ComLib.advaceSheetRevByBunk(currBunk.BunkId); } answ = "OK"; } diff --git a/NKC_WF/Controllers/getMUSheetRevController.cs b/NKC_WF/Controllers/getMUSheetRevController.cs new file mode 100644 index 0000000..cc1c8de --- /dev/null +++ b/NKC_WF/Controllers/getMUSheetRevController.cs @@ -0,0 +1,24 @@ +using AppData; +using SteamWare; +using System; +using System.Web.Http; + +namespace NKC_WF.Controllers +{ + public class getMUSheetRevController : ApiController + { + // GET api/getMUSheetRevController + public int Get() + { + int answ = ComLib.getSheetRevByBunk(0); + return answ; + } + // GET api/getMUSheetRevController/5 + public int Get(int id) + { + int answ = ComLib.getSheetRevByBunk(id); + return answ; + } + + } +} \ No newline at end of file diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 4ff7c11..fc90720 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -513,6 +513,7 @@ VersGen.cs + diff --git a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx index 2b5c11f..10f00af 100644 --- a/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx +++ b/NKC_WF/WebUserControls/cmp_MU_svgViewer.ascx @@ -21,7 +21,6 @@ if (data != lastVal) { $('#uplTavola').load(location.href + ' #dynCss'); document.getElementById('<%=hfCurrRev.ClientID%>').value = data; - //lastVal = document.getElementById('<%=hfCurrRev.ClientID%>').value; } }); } diff --git a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs index 0c8db29..245275f 100644 --- a/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_stackLoading.ascx.cs @@ -209,6 +209,8 @@ namespace NKC_WF.WebUserControls } doUpdate(); cmp_stackNextloading.doUpdate(); + // segnalo avanzamento su redis x pagina unload + ComLib.advaceSheetRevByBunk(BatchIdCurr); raiseEvent(); } }