COmpletata gestione deroga con visuals

This commit is contained in:
Samuele Locatelli
2021-07-27 19:00:20 +02:00
parent 9ccefa2aec
commit 52fdc60ca3
5 changed files with 70 additions and 23 deletions
+2 -2
View File
@@ -6,12 +6,12 @@
<asp:Repeater ID="repDetail" runat="server" DataSourceID="ods">
<ItemTemplate>
<div class="border border-bottom-secondary">
<uc1:cmp_ST_objView runat="server" ID="cmp_ST_objView" dataType='<%# Eval("CodTipo") %>' dataGroup='<%# Eval("CodGruppo") %>' idxST='<%# Eval("IdxST") %>' num='<%# Eval("Num") %>' dataLabel='<%# traduci(Eval("Label")) %>' dataValue='<%# Eval("Value") %>' dataValueRead='<%# Eval("ValueRead") %>' extCode='<%# Eval("ExtCode") %>' required='<%# Eval("Required") %>' />
<uc1:cmp_ST_objView runat="server" ID="cmp_ST_objView" dataType='<%# Eval("CodTipo") %>' dataGroup='<%# Eval("CodGruppo") %>' idxST='<%# Eval("IdxST") %>' dataNum='<%# Eval("Num") %>' dataLabel='<%# traduci(Eval("Label")) %>' dataValue='<%# Eval("Value") %>' dataValueRead='<%# Eval("ValueRead") %>' extCode='<%# Eval("ExtCode") %>' required='<%# Eval("Required") %>' />
</div>
</ItemTemplate>
<AlternatingItemTemplate>
<div class="">
<uc1:cmp_ST_objView runat="server" ID="cmp_ST_objView" dataType='<%# Eval("CodTipo") %>' dataGroup='<%# Eval("CodGruppo") %>' idxST='<%# Eval("IdxST") %>' num='<%# Eval("Num") %>' dataLabel='<%# traduci(Eval("Label")) %>' dataValue='<%# Eval("Value") %>' dataValueRead='<%# Eval("ValueRead") %>' extCode='<%# Eval("ExtCode") %>' required='<%# Eval("Required") %>' />
<uc1:cmp_ST_objView runat="server" ID="cmp_ST_objView" dataType='<%# Eval("CodTipo") %>' dataGroup='<%# Eval("CodGruppo") %>' idxST='<%# Eval("IdxST") %>' dataNum='<%# Eval("Num") %>' dataLabel='<%# traduci(Eval("Label")) %>' dataValue='<%# Eval("Value") %>' dataValueRead='<%# Eval("ValueRead") %>' extCode='<%# Eval("ExtCode") %>' required='<%# Eval("Required") %>' />
</div>
</AlternatingItemTemplate>
</asp:Repeater>
+17 -12
View File
@@ -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)
{
+4 -3
View File
@@ -13,9 +13,10 @@
<div class="col-4 pr-0 text-left">
<%: hfLabel.Value %>
</div>
<div class='<%: "col-8 pl-0 text-right font-weight-bold" + dataCss %>'>
<div class='<%: "col-8 pl-0 text-right font-weight-bold " + dataCss + derogaCss %>'>
<asp:Label runat="server" ID="lblDeroga">Deroga Attiva</asp:Label>
<asp:LinkButton runat="server" ID="lbtForce" CssClass="btn btn-sm btn-danger text-light py-0" OnClientClick='<%# SteamWare.jsUtils.getCBE("ConfirmForceParamST") %>' ToolTip="Forza Parametro" OnClick="lbtForce_Click"><i class="fa fa-medkit" aria-hidden="true"></i></asp:LinkButton>
<asp:Label runat="server" ID="lblExtCode" CssClass="small2" >(<%: hfValueRead.Value %>)</asp:Label>&nbsp;<%: hfValue.Value %>
<asp:Label runat="server" ID="lblExtCode" CssClass="small2">(<%: hfValueRead.Value %>)</asp:Label>&nbsp;<%: hfValue.Value %>
<asp:Label runat="server" ID="lblError"><i class="fa fa-exclamation-triangle" aria-hidden="true" ></i></asp:Label>
<asp:Label runat="server" ID="lblChecked"><i class="fa fa-check-square-o" aria-hidden="true" ></i></asp:Label>
</div>
@@ -27,4 +28,4 @@
<div class="col-8 pl-0 text-right">
<asp:Image runat="server" ID="imgData" CssClass="img-fluid" ImageUrl='<%# imageUrl %>' Height="128px" />
</div>
</div>
</div>
+38 -6
View File
@@ -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);
}
}
}
+9
View File
@@ -104,6 +104,15 @@ namespace MoonProTablet.WebUserControls
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl divTxt;
/// <summary>
/// lblDeroga control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblDeroga;
/// <summary>
/// lbtForce control.
/// </summary>