Bozza painting

This commit is contained in:
Samuele E. Locatelli
2020-02-10 16:47:07 +01:00
parent 189af410e8
commit ce7bdbbdaa
11 changed files with 753 additions and 116 deletions
@@ -0,0 +1,55 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_paint_bins.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_paint_bins" %>
<asp:HiddenField runat="server" ID="hfTitleClass" />
<div class="card text-center mb-2" style="width: 100%;">
<h5 class="card-header bg-secondary text-light"><asp:Label runat="server" ID="lblTitle"></asp:Label> </h5>
<div class="card-body py-1">
<div class="row">
<div class="col-12 px-0">
<asp:GridView runat="server" ID="grView" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="BinID" DataSourceID="ods" CssClass="table table-striped table-sm table-borderless" BorderWidth="0px">
<HeaderStyle CssClass="default" />
<PagerStyle CssClass="active GridPager" />
<PagerSettings Mode="NumericFirstLast" />
<SelectedRowStyle CssClass="table-info" />
<EmptyDataTemplate>
No Record
</EmptyDataTemplate>
<Columns>
<asp:TemplateField HeaderText="Cod" SortExpression="BinDtmx">
<ItemTemplate>
<asp:Image runat="server" Height='<%# qrSize %>' Visible='<%# hfShowQr.Value.ToLower()=="true" %>' ImageUrl='<%# getImgUrl(Eval("BinDtmx")) %>' />
<b><asp:Label ID="lblBinIndex" runat="server" Text='<%# Eval("BinIndex","B{0}") %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemLoad"),Eval("TotItem"))) %>' /></b>
<asp:Label ID="lblBinDtmx" runat="server" Visible='<%# hfShowQr.Value.ToLower()=="true" %>' Text='<%# Eval("BinDtmx") %>' CssClass="small" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="D/T" SortExpression="TotItem">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("TotItemLoad") +"/" + Eval("TotItem") %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemLoad"),Eval("TotItem"))) %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="%" SortExpression="TotItemLoad">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# getRatio(Eval("TotItemLoad"),Eval("TotItem")).ToString("P1") %>' CssClass='<%# getCssByRatio(getRatio(Eval("TotItemLoad"),Eval("TotItem"))) %>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ObjectDataSource runat="server" ID="ods" OldValuesParameterFormatString="original_{0}" SelectMethod="getByStatus" TypeName="AppData.DS_AppTableAdapters.BinsTableAdapter">
<SelectParameters>
<asp:Parameter DefaultValue="True" Name="Fillup" Type="Boolean" />
<asp:ControlParameter ControlID="hfShowComplete" DefaultValue="false" Name="Complete" PropertyName="Value" Type="Boolean" />
<asp:ControlParameter ControlID="hfShowPainted" DefaultValue="false" Name="Painted" PropertyName="Value" Type="Boolean" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:HiddenField ID="hfBatchID" runat="server" />
<asp:HiddenField ID="hfShowQr" runat="server" Value="false" />
<asp:HiddenField ID="hfQrSize" runat="server" Value="32" />
<asp:HiddenField ID="hwShowFillup" runat="server" Value="1" />
<asp:HiddenField ID="hfShowComplete" runat="server" Value="false" />
<asp:HiddenField ID="hfShowPainted" runat="server" Value="false" />
</div>
</div>
</div>
</div>
@@ -0,0 +1,181 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace NKC_WF.WebUserControls
{
public partial class cmp_paint_bins : System.Web.UI.UserControl
{
/// <summary>
/// Testo titolo...
/// </summary>
public string titleText
{
set
{
lblTitle.Text = value;
}
get
{
return lblTitle.Text;
}
}
/// <summary>
/// Classe css titolo...
/// </summary>
public string titleClass
{
set
{
lblTitle.CssClass = value;
}
get
{
return lblTitle.CssClass;
}
}
/// <summary>
/// Batch corrente...
/// </summary>
public int BatchId
{
set
{
hfBatchID.Value = value.ToString();
doUpdate();
}
get
{
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno QRCode
/// </summary>
public bool ShowQr
{
set
{
hfShowQr.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowQr.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno COMPLETED
/// </summary>
public bool ShowComplete
{
set
{
hfShowComplete.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowComplete.Value, out answ);
return answ;
}
}
/// <summary>
/// Indica se mostrare o meno PAINTED
/// </summary>
public bool ShowPainted
{
set
{
hfShowPainted.Value = value.ToString();
}
get
{
bool answ = false;
bool.TryParse(hfShowPainted.Value, out answ);
return answ;
}
}
/// <summary>
/// restituisce URL immagine QRCode
/// </summary>
/// <param name="currId"></param>
/// <returns></returns>
public string getImgUrl(object currId)
{
string baseUrl = "https://qrcode.steamware.net/HOME/QR_site/JSON?val=";
string payload = "{'baseUrl':'{0}','parameters':['" + currId.ToString() + "']}";
string answ = $"{baseUrl}{payload}";
return answ;
}
protected void Page_Load(object sender, EventArgs e)
{
}
public void doUpdate()
{
grView.DataBind();
}
/// <summary>
/// Calcola il rapporto tra 2 valori
/// </summary>
/// <param name="_dividendo"></param>
/// <param name="_divisore"></param>
/// <returns></returns>
public double getRatio(object _dividendo, object _divisore)
{
double ratio = 0;
double dividendo = 0;
double divisore = 1;
double.TryParse(_dividendo.ToString(), out dividendo);
double.TryParse(_divisore.ToString(), out divisore);
ratio = dividendo / divisore;
return ratio;
}
/// <summary>
/// determina CSS x colore testo da perc svuotamento...
/// </summary>
/// <param name="ratio"></param>
/// <returns></returns>
public string getCssByRatio(double ratio)
{
string answ = "text-dark";
if (ratio == 0)
{
answ = "text-danger";
}
else if (ratio == 1)
{
answ = "text-success";
}
else
{
answ = "text-warning";
}
return answ;
}
/// <summary>
/// Dimensione QRCode
/// </summary>
public int qrSize
{
get
{
int answ = 32;
int.TryParse(hfQrSize.Value, out answ);
return answ;
}
set
{
hfQrSize.Value = value.ToString();
doUpdate();
}
}
}
}
+107
View File
@@ -0,0 +1,107 @@
//------------------------------------------------------------------------------
// <generato automaticamente>
// Codice generato da uno strumento.
//
// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se
// il codice viene rigenerato.
// </generato automaticamente>
//------------------------------------------------------------------------------
namespace NKC_WF.WebUserControls
{
public partial class cmp_paint_bins
{
/// <summary>
/// Controllo hfTitleClass.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfTitleClass;
/// <summary>
/// Controllo lblTitle.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblTitle;
/// <summary>
/// Controllo grView.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.GridView grView;
/// <summary>
/// Controllo ods.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.ObjectDataSource ods;
/// <summary>
/// Controllo hfBatchID.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfBatchID;
/// <summary>
/// Controllo hfShowQr.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfShowQr;
/// <summary>
/// Controllo hfQrSize.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfQrSize;
/// <summary>
/// Controllo hwShowFillup.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hwShowFillup;
/// <summary>
/// Controllo hfShowComplete.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfShowComplete;
/// <summary>
/// Controllo hfShowPainted.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::System.Web.UI.WebControls.HiddenField hfShowPainted;
}
}
+16 -1
View File
@@ -1,3 +1,18 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="cmp_painting.ascx.cs" Inherits="NKC_WF.WebUserControls.cmp_painting" %>
<%@ Register Src="~/WebUserControls/cmp_paint_bins.ascx" TagPrefix="uc1" TagName="cmp_paint_bins" %>
<%@ Register Src="~/WebUserControls/cmp_barcode.ascx" TagPrefix="uc1" TagName="cmp_barcode" %>
gestione painting
<div class="row text-center">
<div class="col-4">
<uc1:cmp_paint_bins runat="server" id="cmp_paint_binsIN" titleText="BINS IN" titleClass="text-light" ShowComplete="true" ShowPainted="false" />
</div>
<div class="col-4">
READER<br />
<uc1:cmp_barcode runat="server" ID="cmp_barcode" />
</div>
<div class="col-4">
<uc1:cmp_paint_bins runat="server" id="cmp_paint_binsOUT" titleText="BINS OUT" titleClass="text-warning" ShowComplete="true" ShowPainted="true" />
</div>
</div>
+27
View File
@@ -13,5 +13,32 @@ namespace NKC_WF.WebUserControls
public partial class cmp_painting
{
/// <summary>
/// Controllo cmp_paint_binsIN.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::NKC_WF.WebUserControls.cmp_paint_bins cmp_paint_binsIN;
/// <summary>
/// Controllo cmp_barcode.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::NKC_WF.WebUserControls.cmp_barcode cmp_barcode;
/// <summary>
/// Controllo cmp_paint_binsOUT.
/// </summary>
/// <remarks>
/// Campo generato automaticamente.
/// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind.
/// </remarks>
protected global::NKC_WF.WebUserControls.cmp_paint_bins cmp_paint_binsOUT;
}
}