Files
NKC/NKC_WF/WebUserControls/cmp_stackBuilding.ascx.cs
T
Samuele E. Locatelli 5aa93f403f Fix grafico stack index
2019-08-28 16:10:11 +02:00

137 lines
3.7 KiB
C#

using AppData;
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_stackBuilding : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
// svuoto input barcode...
cmp_barcode.inputAcquired = "";
lastCmd = "";
}
cmp_barcode.eh_doRefresh += Cmp_barcode_eh_doRefresh;
}
/// <summary>
/// Comando barcode letto
/// </summary>
protected string lastCmd
{
get
{
return hfBarcode.Value;
}
set
{
hfBarcode.Value = value;
}
}
private void Cmp_barcode_eh_doRefresh(object sender, EventArgs e)
{
// processo evento..
lastCmd = cmp_barcode.inputAcquired.ToUpper();
// processiamo barcode letto
decodedData decoData = DataLayer.man.decodeBcode(lastCmd);
switch (decoData.codeType)
{
case codeType.UNK:
cmp_barcode.showOutput("text-danger","Unknown Data");
break;
case codeType.Item:
cmp_barcode.showOutput("text-warning", "Item - ignored");
break;
case codeType.Material:
// verifico SE il materiale SIA quello dello sheet richeisto dallos tack 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].MaterExtCode;
if(codReq== decoData.code)
{
cmp_barcode.showOutput("badge badge-success", $"SHEET RECORDED: {decoData.description}");
// chiamo stored x indicare preparato
DataLayer.man.taSHL.setPrepared(nextTbl[0].SheetID);
}
else
{
cmp_barcode.showOutput("badge badge-danger", $"WRONG SHEET: {decoData.description}");
}
}
break;
case codeType.Sheet:
cmp_barcode.showOutput("badge badge-warning", "Sheet - ignored");
break;
case codeType.Stack:
cmp_barcode.showOutput("badge badge-warning", "Stack - ignored");
break;
case codeType.Batch:
cmp_barcode.showOutput("badge badge-warning", "Batch - ignored");
break;
default:
break;
}
// reset comando
cmp_barcode.inputAcquired = "";
// aggiorno repeater...
repCtrl.DataBind();
}
public int StackId
{
set
{
hfStackId.Value = value.ToString();
lastCmd = "";
cmp_barcode.resetMessage();
repCtrl.DataBind();
}
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 (_prepared.ToString() != "")
{
answ = "table-success border border-success border-thick rounded";
}
}
return answ;
}
}
}