197 lines
5.3 KiB
C#
197 lines
5.3 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using SteamWare;
|
|
using System;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_MU_bins : BaseUserControl
|
|
{
|
|
/// <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 button PRINT
|
|
/// </summary>
|
|
public bool ShowPrint
|
|
{
|
|
set
|
|
{
|
|
hfShowPrint.Value = value.ToString();
|
|
}
|
|
get
|
|
{
|
|
bool answ = false;
|
|
bool.TryParse(hfShowPrint.Value, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// BinId selezionato
|
|
/// </summary>
|
|
public int selBinId
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(grView.SelectedValue.ToString(), out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Queue selezionata
|
|
/// </summary>
|
|
public string currQueue
|
|
{
|
|
get
|
|
{
|
|
return hfPrintQueue.Value;
|
|
}
|
|
set
|
|
{
|
|
hfPrintQueue.Value = value;
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (!Page.IsPostBack)
|
|
{
|
|
currQueue = DataLayer.man.getPrinter("PC-MACHINE-UNLOAD2");
|
|
}
|
|
}
|
|
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();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Alla selezione mando in stampa il singolo record
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
// invio SINGOLO record in stampa
|
|
DataLayer.man.stampaDoc(selBinId.ToString(), currQueue, tipoDocumento.docBinPre, Request.UserHostName);
|
|
// reset
|
|
doReset();
|
|
}
|
|
/// <summary>
|
|
/// comando reset
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtPrintAll_Click(object sender, EventArgs e)
|
|
{
|
|
// chiamo stored x stampare OGNI cart del BATCH
|
|
var tabBins = DataLayer.man.taBN.getByBatch(BatchId);
|
|
try
|
|
{
|
|
if (tabBins != null && tabBins.Count > 0)
|
|
{
|
|
foreach (var item in tabBins)
|
|
{
|
|
// invio SINGOLO record in stampa
|
|
DataLayer.man.stampaDoc(item.BinID.ToString(), currQueue, tipoDocumento.docBinPre, Request.UserHostName);
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
// reset
|
|
doReset();
|
|
}
|
|
|
|
private void doReset()
|
|
{
|
|
// resetto
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
}
|
|
}
|
|
} |