Update gestione buon rilavorati!

This commit is contained in:
Samuele E. Locatelli
2020-07-14 19:26:48 +02:00
parent f0619df15c
commit aaf515eecc
3 changed files with 313 additions and 284 deletions
+110 -107
View File
@@ -7,120 +7,123 @@ using System.Web.UI.WebControls;
namespace NKC_WF.WebUserControls
{
public partial class cmp_stackList : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
public partial class cmp_stackList : BaseUserControl
{
if (!Page.IsPostBack)
{
checkVisibility();
}
}
private void checkVisibility()
{
divSelected.Visible = StackIdSel > 0;
grView.Visible = !divSelected.Visible;
// imposto css titolo...
string titleClass = "row";
if (divSelected.Visible)
{
titleClass += " table-info";
}
divTitle.Attributes.Remove("class");
divTitle.Attributes.Add("class", titleClass);
}
public int BatchId
{
set
{
hfBatchId.Value = value.ToString();
grView.DataBind();
}
get
{
int answ = 0;
int.TryParse(hfBatchId.Value, out answ);
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
checkVisibility();
raiseEvent();
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
public void resetSelezione()
{
lblStack.Text = "";
grView.SelectedIndex = -1;
grView.DataBind();
checkVisibility();
raiseEvent();
}
/// <summary>
/// StackId selezionato
/// </summary>
public int StackIdSel
{
get
{
int answ = 0;
try
protected void Page_Load(object sender, EventArgs e)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
if (!Page.IsPostBack)
{
checkVisibility();
}
}
catch
{ }
return answ;
}
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// recupero argomento = Takt...
try
{
string stack = e.CommandArgument.ToString();
lblStack.Text = stack;
}
catch
{ }
}
/// <summary>
/// Calcola il css x il blocco dato la condizione del num di sheets totali e preparati
/// </summary>
/// <param name="_numSheets"></param>
/// <param name="_numPrepared"></param>
/// <returns></returns>
public string cssByPrepared(object _numSheets, object _numPrepared)
{
string answ = "table-secondary border border-secondary border-thick rounded";
int numSheets = 0;
int numPrepared = 0;
int.TryParse(_numSheets.ToString(), out numSheets);
int.TryParse(_numPrepared.ToString(), out numPrepared);
if (numPrepared > 0)
{
if (numPrepared == numSheets)
private void checkVisibility()
{
answ = "table-success border border-success border-thick rounded";
divSelected.Visible = StackIdSel > 0;
grView.Visible = !divSelected.Visible;
// imposto css titolo...
string titleClass = "row";
if (divSelected.Visible)
{
titleClass += " table-info";
}
divTitle.Attributes.Remove("class");
divTitle.Attributes.Add("class", titleClass);
}
else
public int BatchId
{
answ = "table-primary flashColor rounded";
set
{
hfBatchId.Value = value.ToString();
grView.DataBind();
}
get
{
int answ = 0;
int.TryParse(hfBatchId.Value, out answ);
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
checkVisibility();
raiseEvent();
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
public void resetSelezione()
{
lblStack.Text = "";
grView.SelectedIndex = -1;
grView.DataBind();
checkVisibility();
raiseEvent();
}
/// <summary>
/// StackId selezionato
/// </summary>
public int StackIdSel
{
get
{
int answ = 0;
try
{
if (grView.SelectedValue != null)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
}
catch
{ }
return answ;
}
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// recupero argomento = Takt...
try
{
string stack = e.CommandArgument.ToString();
lblStack.Text = stack;
}
catch
{ }
}
/// <summary>
/// Calcola il css x il blocco dato la condizione del num di sheets totali e preparati
/// </summary>
/// <param name="_numSheets"></param>
/// <param name="_numPrepared"></param>
/// <returns></returns>
public string cssByPrepared(object _numSheets, object _numPrepared)
{
string answ = "table-secondary border border-secondary border-thick rounded";
int numSheets = 0;
int numPrepared = 0;
int.TryParse(_numSheets.ToString(), out numSheets);
int.TryParse(_numPrepared.ToString(), out numPrepared);
if (numPrepared > 0)
{
if (numPrepared == numSheets)
{
answ = "table-success border border-success border-thick rounded";
}
else
{
answ = "table-primary flashColor rounded";
}
}
return answ;
}
}
return answ;
}
}
}
+50 -27
View File
@@ -119,37 +119,46 @@ namespace NKC_WF.WebUserControls
// controllo sia quello RICHIESTO
if (decoData.codeInt == cmp_stackNextloading.StackIdReq)
{
// verifico SE i BUNKS correnti siano tutti stati completati (NumSheet == NumWorking)
if (currentBunkPrinted)
// controllo se il bunk richiesto sia stato caricato coi materiali...
if (!isBunkFilled(decoData.codeInt))
{
cmp_barcode.showOutput("badge badge-success", $"BUNK OK, {decoData.rawData}");
ComLib.taktMLCurrStack = decoData.code;
// processo DB e salvo che lo stack è stato caricato in MACHINE LOAD
int stackId = 0;
try
{
var tabStacks = DataLayer.man.taSTL.getByDtmx(decoData.rawData);
if (tabStack.Count == 1)
{
stackId = tabStack[0].StackID;
}
}
catch
{ }
// SE HO uno stackId valido (>0)...
if (stackId > 0)
{
DataLayer.man.taSTL.updatePos(stackId, 5);
// controllo status del bunk nel suo insieme...
ComLib.updateBatchPositionByBunk(stackId);
doRaiseEv = true;
}
cmp_barcode.showOutput("badge badge-danger", $"NEXT BUNK NOT PREPARED, {decoData.rawData}");
doRaiseEv = true;
}
// altrimenti segnalo NON pronto x caricare prossimo
else
{
cmp_barcode.showOutput("badge badge-danger", $"PREV BUNK NOT COMPLETED, {decoData.rawData}");
doRaiseEv = true;
// verifico SE i BUNKS correnti siano tutti stati completati (NumSheet == NumWorking)
if (currentBunkPrinted)
{
cmp_barcode.showOutput("badge badge-success", $"BUNK OK, {decoData.rawData}");
ComLib.taktMLCurrStack = decoData.code;
// processo DB e salvo che lo stack è stato caricato in MACHINE LOAD
int stackId = 0;
try
{
var tabStacks = DataLayer.man.taSTL.getByDtmx(decoData.rawData);
if (tabStack.Count == 1)
{
stackId = tabStack[0].StackID;
}
}
catch
{ }
// SE HO uno stackId valido (>0)...
if (stackId > 0)
{
DataLayer.man.taSTL.updatePos(stackId, 5);
// controllo status del bunk nel suo insieme...
ComLib.updateBatchPositionByBunk(stackId);
doRaiseEv = true;
}
}
// altrimenti segnalo NON pronto x caricare prossimo
else
{
cmp_barcode.showOutput("badge badge-danger", $"PREV BUNK NOT COMPLETED, {decoData.rawData}");
doRaiseEv = true;
}
}
}
else
@@ -220,6 +229,20 @@ namespace NKC_WF.WebUserControls
return answ;
}
}
/// <summary>
/// verifica se il bunk sia stato completato come caricamento dei fogli richiesti)
/// </summary>
protected bool isBunkFilled(int BunkId)
{
bool answ = false;
// leggo i dati del bunk...
var currBunk = DataLayer.man.taSTL.getByKey(BunkId);
if (currBunk.Count == 1)
{
answ = currBunk[0].Position == 4;
}
return answ;
}
protected void checkVisibility()
{
+153 -150
View File
@@ -8,159 +8,162 @@ using System.Web.UI.WebControls;
namespace NKC_WF.WebUserControls
{
public partial class cmp_taktList : BaseUserControl
{
protected void Page_Load(object sender, EventArgs e)
public partial class cmp_taktList : BaseUserControl
{
if (!Page.IsPostBack)
{
checkVisibility();
}
}
private void checkVisibility()
{
divSelected.Visible = BatchIdSel > 0;
grView.Visible = !divSelected.Visible;
// imposto css titolo...
string titleClass = "row";
if (divSelected.Visible)
{
titleClass += " table-primary";
}
divTitle.Attributes.Remove("class");
divTitle.Attributes.Add("class", titleClass);
}
/// <summary>
/// Codice CSS in base a status...
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string cssByStatus(object _status)
{
string answ = "text-muted";
int status = -1;
int.TryParse(_status.ToString(), out status);
switch (status)
{
case 1:
answ = "font-weight-bold text-info";
break;
case 2:
answ = "font-weight-bold text-primary";
break;
case 3:
answ = "font-weight-bold text-warning";
break;
case 4:
answ = "font-weight-bold text-danger";
break;
case 5:
answ = "font-weight-bold text-success";
break;
case 6:
answ = "font-weight-bold text-secondary";
break;
default:
break;
}
return answ;
}
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BStatus(object _status)
{
string answ = ComLib.BatchStatusDescr(_status);
return answ;
}
/// <summary>
/// Converte il codice POSITION di un BATCH in traduzione
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BatchPositionStatus(object _status)
{
string answ = ComLib.PositionStatusDescr(_status);
return answ;
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
private void resetSelezione()
{
lblTakt.Text = "";
grView.SelectedIndex = -1;
grView.DataBind();
checkVisibility();
raiseReset();
}
/// <summary>
/// BatchId selezionato
/// </summary>
public int BatchIdSel
{
get
{
int answ = 0;
try
protected void Page_Load(object sender, EventArgs e)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
if (!Page.IsPostBack)
{
checkVisibility();
}
}
catch
{ }
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
checkVisibility();
raiseEvent();
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// recupero argomento = Takt...
try
{
string takt = e.CommandArgument.ToString();
lblTakt.Text = takt;
}
catch
{ }
private void checkVisibility()
{
divSelected.Visible = BatchIdSel > 0;
grView.Visible = !divSelected.Visible;
// imposto css titolo...
string titleClass = "row";
if (divSelected.Visible)
{
titleClass += " table-primary";
}
divTitle.Attributes.Remove("class");
divTitle.Attributes.Add("class", titleClass);
}
/// <summary>
/// Codice CSS in base a status...
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string cssByStatus(object _status)
{
string answ = "text-muted";
int status = -1;
int.TryParse(_status.ToString(), out status);
switch (status)
{
case 1:
answ = "font-weight-bold text-info";
break;
case 2:
answ = "font-weight-bold text-primary";
break;
case 3:
answ = "font-weight-bold text-warning";
break;
case 4:
answ = "font-weight-bold text-danger";
break;
case 5:
answ = "font-weight-bold text-success";
break;
case 6:
answ = "font-weight-bold text-secondary";
break;
default:
break;
}
return answ;
}
/// <summary>
/// Converte il codice stato in effettivo campo
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BStatus(object _status)
{
string answ = ComLib.BatchStatusDescr(_status);
return answ;
}
/// <summary>
/// Converte il codice POSITION di un BATCH in traduzione
/// </summary>
/// <param name="_status"></param>
/// <returns></returns>
public string BatchPositionStatus(object _status)
{
string answ = ComLib.PositionStatusDescr(_status);
return answ;
}
/// <summary>
/// comando reset
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtReset_Click(object sender, EventArgs e)
{
resetSelezione();
}
private void resetSelezione()
{
lblTakt.Text = "";
grView.SelectedIndex = -1;
grView.DataBind();
checkVisibility();
raiseReset();
}
/// <summary>
/// BatchId selezionato
/// </summary>
public int BatchIdSel
{
get
{
int answ = 0;
try
{
if (grView.SelectedValue != null)
{
int.TryParse(grView.SelectedValue.ToString(), out answ);
}
}
catch
{ }
return answ;
}
}
protected void grView_SelectedIndexChanged(object sender, EventArgs e)
{
checkVisibility();
raiseEvent();
}
protected void grView_RowCommand(object sender, GridViewCommandEventArgs e)
{
// recupero argomento = Takt...
try
{
string takt = e.CommandArgument.ToString();
lblTakt.Text = takt;
}
catch
{ }
}
/// <summary>
/// Calcola il css x il blocco dato la positioj (logica) del TAKT
/// </summary>
/// <param name="_Position"></param>
/// <returns></returns>
public string cssByPosition(object _Position)
{
string answ = "table-secondary border border-secondary border-thick rounded";
int Position = 0;
int.TryParse(_Position.ToString(), out Position);
switch (Position)
{
case 1:
answ = "table-primary flashColor rounded";
break;
case 2:
answ = "table-success border border-success border-thick rounded";
break;
default:
break;
}
return answ;
}
}
/// <summary>
/// Calcola il css x il blocco dato la positioj (logica) del TAKT
/// </summary>
/// <param name="_Position"></param>
/// <returns></returns>
public string cssByPosition(object _Position)
{
string answ = "table-secondary border border-secondary border-thick rounded";
int Position = 0;
int.TryParse(_Position.ToString(), out Position);
switch (Position)
{
case 1:
answ = "table-primary flashColor rounded";
break;
case 2:
answ = "table-success border border-success border-thick rounded";
break;
default:
break;
}
return answ;
}
}
}