From 52fdc60ca35cbab3e5e979cf0d30be3dc57501be Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 27 Jul 2021 19:00:20 +0200 Subject: [PATCH] COmpletata gestione deroga con visuals --- MP-TAB/WebUserControls/cmp_ST_detail.ascx | 4 +- .../WebUserControls/cmp_ST_objCheck.ascx.cs | 29 +++++++----- MP-TAB/WebUserControls/cmp_ST_objView.ascx | 7 +-- MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs | 44 ++++++++++++++++--- .../cmp_ST_objView.ascx.designer.cs | 9 ++++ 5 files changed, 70 insertions(+), 23 deletions(-) diff --git a/MP-TAB/WebUserControls/cmp_ST_detail.ascx b/MP-TAB/WebUserControls/cmp_ST_detail.ascx index 742c91a6..32ad87fe 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 20dfc48f..b4562b8c 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs +++ b/MP-TAB/WebUserControls/cmp_ST_objCheck.ascx.cs @@ -90,6 +90,7 @@ namespace MoonProTablet.WebUserControls private void processInput() { bool found = false; + bool batchOk = false; MapoDb.DS_Arca.GiacenzeDataTable tabGiacenzeLotto = new MapoDb.DS_Arca.GiacenzeDataTable(); MapoDb.DS_SheetTech.ST_ActualRowDataTable tabRichieste = new MapoDb.DS_SheetTech.ST_ActualRowDataTable(); MapoDb.DS_SheetTech.ST_ActualRowRow datiBatchCheck; @@ -136,6 +137,7 @@ namespace MoonProTablet.WebUserControls { lblMessage.Text = $"Lotto riconosciuto: {BCodeVal} --> {datiLotto.Cd_AR} | Articolo acquisito"; lblMessage.CssClass = "text-success"; + batchOk = true; } else { @@ -143,22 +145,25 @@ namespace MoonProTablet.WebUserControls lblMessage.CssClass = "text-danger"; } } - else + } + + if (!batchOk) + { + // 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) { - // 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 }); - } + // ... forzo accettazione deroga + DataLayerObj.taSTChk.upsertQuery(idxOdl, tabRichieste[0].IdxST, tabRichieste[0].Oggetto, tabRichieste[0].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 }); + batchOk = true; } } } + // se non trovato if (!found) { diff --git a/MP-TAB/WebUserControls/cmp_ST_objView.ascx b/MP-TAB/WebUserControls/cmp_ST_objView.ascx index 2fdf0e1f..b271ce2b 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objView.ascx +++ b/MP-TAB/WebUserControls/cmp_ST_objView.ascx @@ -13,9 +13,10 @@
<%: hfLabel.Value %>
-
+
+ Deroga Attiva - (<%: hfValueRead.Value %>) <%: hfValue.Value %> + (<%: hfValueRead.Value %>) <%: hfValue.Value %>
@@ -27,4 +28,4 @@
-
\ No newline at end of file + diff --git a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs index f1e4c68e..d157ad5e 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs +++ b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.cs @@ -120,7 +120,7 @@ namespace MoonProTablet.WebUserControls set { hfValueRead.Value = value.Trim(); - lblExtCode.Visible = !string.IsNullOrEmpty(value); + lblExtCode.Visible = !string.IsNullOrEmpty(value); } } @@ -216,6 +216,36 @@ namespace MoonProTablet.WebUserControls } } + public string derogaCss + { + get + { + string answ = enableForceParamSchedaTecnica && hasDeroga ? " bg-warning" : ""; + + return answ; + } + } + + protected bool hasDeroga + { + get + { + bool answ = false; + try + { + var currDeroga = DataLayerObj.getDerogaSt(idxST); + answ = (currDeroga != null); + if (answ) + { + answ = (currDeroga.CanForce && currDeroga.Num == dataNum && currDeroga.CodGruppo == dataGroup && currDeroga.CodTipo == dataType); + } + } + catch + { } + return answ; + } + } + #endregion Public Properties #region Private Methods @@ -238,7 +268,8 @@ namespace MoonProTablet.WebUserControls bool doShow = showMissingData; lblError.Visible = doShow; lblChecked.Visible = doShow; - lbtForce.Visible = doShow && enableForceParamSchedaTecnica; + lbtForce.Visible = doShow && enableForceParamSchedaTecnica && !hasDeroga; + lblDeroga.Visible = doShow && enableForceParamSchedaTecnica && hasDeroga; } #endregion Private Methods @@ -256,14 +287,15 @@ namespace MoonProTablet.WebUserControls // registro abilitazione forzatura parametro per un periodo limitato StCheckOverride newDeroga = new StCheckOverride() { - CanForce=enableForceParamSchedaTecnica, - Num= dataNum, - CodTipo= dataType, - CodGruppo=dataGroup, + CanForce = enableForceParamSchedaTecnica, + Num = dataNum, + CodTipo = dataType, + CodGruppo = dataGroup, IdxST = idxST }; // salvo DataLayerObj.setDerogaSt(newDeroga); + Response.Redirect(Request.RawUrl); } } } \ No newline at end of file diff --git a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.designer.cs b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.designer.cs index c19e0046..c8621400 100644 --- a/MP-TAB/WebUserControls/cmp_ST_objView.ascx.designer.cs +++ b/MP-TAB/WebUserControls/cmp_ST_objView.ascx.designer.cs @@ -104,6 +104,15 @@ namespace MoonProTablet.WebUserControls /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl divTxt; + /// + /// lblDeroga control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblDeroga; + /// /// lbtForce control. ///