diff --git a/MP-TAB/WebUserControls/cmp_ST_detail.ascx b/MP-TAB/WebUserControls/cmp_ST_detail.ascx index 7ab169cb..742c91a6 100644 --- a/MP-TAB/WebUserControls/cmp_ST_detail.ascx +++ b/MP-TAB/WebUserControls/cmp_ST_detail.ascx @@ -6,12 +6,12 @@
- +
- +
diff --git a/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs b/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs index f12ca399..20dfc48f 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs +++ b/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs @@ -121,9 +121,9 @@ namespace MoonProTablet.WebUserControls var trovatoBatch = tabRichieste.Where(x => x.CheckType == "BATCH"); if (trovatoBatch != null && trovatoBatch.Count() > 0) { + datiBatchCheck = trovatoBatch.FirstOrDefault(); if (tabGiacenzeLotto != null && tabGiacenzeLotto.Count > 0) { - datiBatchCheck = trovatoBatch.FirstOrDefault(); datiLotto = tabGiacenzeLotto.FirstOrDefault(); // registro trovato @@ -143,8 +143,21 @@ namespace MoonProTablet.WebUserControls lblMessage.CssClass = "text-danger"; } } + else + { + // verifico EVENTUALI deroghe + var currDeroga = DataLayerObj.getDerogaSt(tabRichieste[0].IdxST); + // se รจ deroga x gruppo/tipo/num corretto... + if (currDeroga.CanForce && tabRichieste[0].CodGruppo == currDeroga.CodGruppo && tabRichieste[0].CodTipo == currDeroga.CodTipo && tabRichieste[0].Num == currDeroga.Num) + { + // ... forzo accettazione deroga + DataLayerObj.taSTChk.upsertQuery(idxOdl, datiBatchCheck.IdxST, datiBatchCheck.Oggetto, datiBatchCheck.Num, BCodeVal, tabRichieste[0].Value, true, user_std.UtSn.utente); + lblMessage.Text = $"Lotto/articolo non valido: {BCodeVal} --> Forzato a valido per articolo {tabRichieste[0].Value}"; + lblMessage.CssClass = "text-warning"; + DataLayerObj.setDerogaSt(new MapoSDK.StCheckOverride() { IdxST = tabRichieste[0].IdxST, CanForce = false }); + } + } } - } // se non trovato if (!found) diff --git a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs index c50c4ad0..f1e4c68e 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs +++ b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs @@ -256,14 +256,13 @@ namespace MoonProTablet.WebUserControls // registro abilitazione forzatura parametro per un periodo limitato StCheckOverride newDeroga = new StCheckOverride() { - ValidUntil=DateTime.Now.AddMinutes(2), CanForce=enableForceParamSchedaTecnica, Num= dataNum, CodTipo= dataType, CodGruppo=dataGroup, IdxST = idxST }; - + // salvo DataLayerObj.setDerogaSt(newDeroga); } } diff --git a/MapoDb/DataLayer.cs b/MapoDb/DataLayer.cs index 2b97077d..bcf32896 100644 --- a/MapoDb/DataLayer.cs +++ b/MapoDb/DataLayer.cs @@ -168,8 +168,8 @@ namespace MapoDb public StCheckOverride getDerogaSt(int idxST) { StCheckOverride answ = new StCheckOverride() { IdxST = idxST }; - string keyDerogaST = $"derogaSt_{idxST:000}"; - string rawData = memLayer.ML.StringSessionObj(keyDerogaST); + string keyDerogaST = memLayer.ML.redHash($"DerogaSt:{user_std.UtSn.utente}:{idxST:000}"); + string rawData = memLayer.ML.getRSV(keyDerogaST); if (!string.IsNullOrEmpty(rawData)) { try @@ -187,9 +187,9 @@ namespace MapoDb bool fatto = false; try { - string keyDerogaST = $"derogaSt_{deroga.IdxST:000}"; + string keyDerogaST = memLayer.ML.redHash($"DerogaSt:{user_std.UtSn.utente}:{deroga.IdxST:000}"); string rawData = JsonConvert.SerializeObject(deroga); - memLayer.ML.setSessionVal(keyDerogaST, rawData); + memLayer.ML.setRSV(keyDerogaST, rawData, 60*2); fatto = true; } catch diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs index 3986939e..0e1f68f3 100644 --- a/MapoSDK/Objects.cs +++ b/MapoSDK/Objects.cs @@ -990,6 +990,5 @@ namespace MapoSDK public string CodTipo { get; set; } = ""; public int IdxST { get; set; } = 0; public int Num { get; set; } = 0; - public DateTime ValidUntil { get; set; } = DateTime.Now; } } \ No newline at end of file