212 lines
6.1 KiB
C#
212 lines
6.1 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_MU_carts : 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>
|
|
/// 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>
|
|
/// 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>
|
|
/// CartId selezionato
|
|
/// </summary>
|
|
public int selCartId
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Macchina selezionata
|
|
/// </summary>
|
|
public string MachineSel
|
|
{
|
|
get
|
|
{
|
|
return hfMachineSel.Value;
|
|
}
|
|
set
|
|
{
|
|
hfMachineSel.Value = value;
|
|
currQueue = DLMan.getPrinter($"{value}-UNLOAD");
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
currQueue = DLMan.getPrinter($"{MachineSel}-UNLOAD");
|
|
}
|
|
}
|
|
public void doUpdate()
|
|
{
|
|
grView.DataBind();
|
|
}
|
|
/// <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
|
|
DLMan.stampaDoc(selCartId.ToString(), currQueue, tipoDocumento.docCart, Request.UserHostName);
|
|
|
|
// verifico eventuale stampa speciale
|
|
checkSpecialPrint(selCartId);
|
|
|
|
// reset
|
|
doReset();
|
|
}
|
|
/// <summary>
|
|
/// Verifica se il cartellino corrente richieda una stampa speciale coem epr CANYON
|
|
/// - se il model fa parte di quelli gestiti in tab Special Part
|
|
/// - in tal caso inserisce un record di stampa del formato speciale dato il cartId
|
|
/// </summary>
|
|
/// <param name="cartId"></param>
|
|
private void checkSpecialPrint(int cartId)
|
|
{
|
|
/***************************************
|
|
* 2022.10.26 gestione CANYON/SpecialPart
|
|
*
|
|
* - recupero tab SpecialPart da DB/cache
|
|
* - recupero dati da stored CartKitDetail: exec stp_CKD_getByKey CartID
|
|
* - verifico SE da CKD trovo un model di quelli gestiti --> in tal caso invio richiesta stampa
|
|
***************************************/
|
|
bool isSpecial = false;
|
|
// cerco se trovo righe lanciando report stampa SpecPArt dato CartID...
|
|
var tabSpecPart = DLMan.taRepSpecPart.GetData(cartId,"", "");
|
|
if (tabSpecPart != null)
|
|
{
|
|
isSpecial = tabSpecPart.Rows.Count > 0;
|
|
}
|
|
// se ho verificato essere speciale il CART...
|
|
if (isSpecial)
|
|
{
|
|
// invio SINGOLO record in stampa (che poi stamperà + pagine, 1 x item)
|
|
DLMan.stampaDoc(selCartId.ToString(), currQueue, tipoDocumento.docCartSpecialPart, Request.UserHostName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// comando stampa tutti i carts del batch
|
|
/// </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 tabCarts = DLMan.taCR.getByBatch(BatchId);
|
|
try
|
|
{
|
|
if (tabCarts != null && tabCarts.Count > 0)
|
|
{
|
|
foreach (var item in tabCarts)
|
|
{
|
|
// invio SINGOLO record in stampa
|
|
DLMan.stampaDoc(item.CartID.ToString(), currQueue, tipoDocumento.docCart, Request.UserHostName);
|
|
|
|
// verifico eventuale stampa speciale
|
|
checkSpecialPrint(item.CartID);
|
|
}
|
|
}
|
|
}
|
|
catch
|
|
{ }
|
|
// reset
|
|
doReset();
|
|
}
|
|
|
|
private void doReset()
|
|
{
|
|
// resetto
|
|
grView.SelectedIndex = -1;
|
|
grView.DataBind();
|
|
}
|
|
}
|
|
} |