194 lines
6.6 KiB
C#
194 lines
6.6 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Web.UI;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_stackBuilding : BaseUserControl
|
|
{
|
|
/// <summary>
|
|
/// Comando barcode letto
|
|
/// </summary>
|
|
protected string lastCmd
|
|
{
|
|
get
|
|
{
|
|
return hfLastBCode.Value;
|
|
}
|
|
set
|
|
{
|
|
hfLastBCode.Value = value;
|
|
}
|
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// pulisco dir temp dai file dei cartellini stampati
|
|
reportPrinter.obj.pulisciDir();
|
|
}
|
|
cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh;
|
|
}
|
|
/// <summary>
|
|
/// Verifica bvisibilità button stampa
|
|
/// ...se NON ci sono altri campi "next" allora posso mostrare stampa...
|
|
/// </summary>
|
|
private void checkPrint()
|
|
{
|
|
DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId);
|
|
// se tab vuota --> HO FINITO, mostro stampa...
|
|
divPrint.Visible = (nextTbl.Count == 0);
|
|
}
|
|
|
|
|
|
private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e)
|
|
{
|
|
bool doRaiseEv = false;
|
|
lastCmd = cmp_barcode.inputAcquired.ToUpper();
|
|
processLastCmd(doRaiseEv);
|
|
doUpdate();
|
|
}
|
|
|
|
private bool processLastCmd(bool doRaiseEv)
|
|
{
|
|
// verifico il datamatrix dei BIN da pitturare
|
|
if (string.IsNullOrEmpty(lastCmd)) doRaiseEv = true;
|
|
// processiamo barcode letto
|
|
decodedData decoData = DataLayer.man.decodeBcode(lastCmd);
|
|
switch (decoData.codeType)
|
|
{
|
|
case codeType.UNK:
|
|
cmp_barcode.showOutput("text-danger", "Unknown Data");
|
|
doRaiseEv = true;
|
|
break;
|
|
case codeType.Item:
|
|
case codeType.ItemGeneric:
|
|
cmp_barcode.showOutput("text-warning", "Item - ignored");
|
|
doRaiseEv = true;
|
|
break;
|
|
case codeType.Material:
|
|
// verifico SE il materiale SIA quello dello sheet richiesto dallo stack/bunk corrente...
|
|
DS_App.SheetListDataTable nextTbl = DataLayer.man.taSHL.getNextByStack(StackId);
|
|
// se tab vuota --> HO FINITO!!!!
|
|
if (nextTbl.Count == 0)
|
|
{
|
|
cmp_barcode.showOutput("badge badge-warning", $"STACK IS COMPLETED, {decoData.description}");
|
|
}
|
|
// se ho valori --> controllo se corretto...
|
|
else
|
|
{
|
|
string codReq = nextTbl[0].MatExtCode.ToString();
|
|
if (codReq == decoData.codeInt.ToString())
|
|
{
|
|
cmp_barcode.showOutput("badge badge-success", $"SHEET RECORDED: {decoData.description}");
|
|
// chiamo stored x indicare preparato
|
|
DataLayer.man.taSHL.setPrepared(nextTbl[0].SheetID);
|
|
cmp_barcode.resetInput();
|
|
}
|
|
else
|
|
{
|
|
cmp_barcode.showOutput("badge badge-danger", $"WRONG SHEET: {decoData.description}");
|
|
}
|
|
}
|
|
break;
|
|
case codeType.Sheet:
|
|
cmp_barcode.showOutput("badge badge-warning", "Sheet - ignored");
|
|
doRaiseEv = true;
|
|
break;
|
|
case codeType.Stack:
|
|
cmp_barcode.showOutput("badge badge-warning", "Stack - ignored");
|
|
doRaiseEv = true;
|
|
break;
|
|
case codeType.Batch:
|
|
cmp_barcode.showOutput("badge badge-warning", "Batch - ignored");
|
|
doRaiseEv = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
return doRaiseEv;
|
|
}
|
|
|
|
public void doUpdate()
|
|
{
|
|
repCtrl.DataBind();
|
|
repProgress.DataBind();
|
|
checkPrint();
|
|
}
|
|
|
|
public int StackId
|
|
{
|
|
set
|
|
{
|
|
hfStackId.Value = value.ToString();
|
|
lastCmd = "";
|
|
cmp_barcode.resetMessage();
|
|
ComLib.updateBatchPositionByBunk(value);
|
|
doUpdate();
|
|
}
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfStackId.Value, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
|
|
public string cssFlashNext(object _isNext)
|
|
{
|
|
string answ = "";
|
|
if (_isNext.ToString() == "1")
|
|
{
|
|
answ = " flashColor";
|
|
}
|
|
return answ;
|
|
}
|
|
public string cssByPrepared(object _prepared, object _isNext)
|
|
{
|
|
string answ = "table-secondary border border-secondary border-thick rounded";
|
|
if (_isNext.ToString() == "1")
|
|
{
|
|
answ = "table-primary flashColor rounded";
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(_prepared.ToString()))
|
|
{
|
|
answ = "table-success border border-success border-thick rounded";
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
/// <summary>
|
|
/// Chiesta stampa stack corrente
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void lbtPrint_Click(object sender, EventArgs e)
|
|
{
|
|
// chiamo procedura stampa report x stack
|
|
string printer = DataLayer.man.getPrinter("PC-MACHINE-STACK-BUILD");
|
|
DataLayer.man.stampaDoc(StackId.ToString(), printer, tipoDocumento.docStack, Request.UserHostName);
|
|
// aggiorno stato BATCH
|
|
ComLib.updateBatchPositionByBunk(StackId);
|
|
}
|
|
|
|
public string getProgressStyle(object _num, object _den)
|
|
{
|
|
string answ = "width: 10%";
|
|
int num = 0;
|
|
int den = 1;
|
|
int.TryParse(_num.ToString(), out num);
|
|
int.TryParse(_den.ToString(), out den);
|
|
answ = $"width: {num * 100 / den}%";
|
|
return answ;
|
|
}
|
|
|
|
protected void Unnamed1_Tick(object sender, EventArgs e)
|
|
{
|
|
doUpdate();
|
|
}
|
|
}
|
|
} |