122 lines
3.4 KiB
C#
122 lines
3.4 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_batchDetail : System.Web.UI.UserControl
|
|
{
|
|
public event EventHandler eh_doRefresh;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
public int BatchId
|
|
{
|
|
set
|
|
{
|
|
hfBatchId.Value = value.ToString();
|
|
frmView.DataBind();
|
|
}
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfBatchId.Value, out answ);
|
|
return answ;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Controlla se lo stato sia uguale a quello richiesto
|
|
/// </summary>
|
|
/// <param name="_status"></param>
|
|
/// <param name="statusReq"></param>
|
|
/// <returns></returns>
|
|
public bool checkStatus(object _status, ComLib.BatchStatus statusReq)
|
|
{
|
|
bool answ = false;
|
|
int status = -1;
|
|
int.TryParse(_status.ToString(), out status);
|
|
answ = (status == (int)statusReq);
|
|
return answ;
|
|
}
|
|
public bool canStartNew(object _status)
|
|
{
|
|
bool answ = false;
|
|
// in primis controllo SE ci siano task running, nel qual caso è false e basta...
|
|
int numEst = DataLayer.man.taBL.getByStatus((int)ComLib.BatchStatus.EstimationRequested).Count;
|
|
int numNest = DataLayer.man.taBL.getByStatus((int)ComLib.BatchStatus.NestRequested).Count;
|
|
answ = ((numEst + numNest) == 0);
|
|
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;
|
|
}
|
|
|
|
protected void lbtAccept_Click(object sender, EventArgs e)
|
|
{
|
|
// registro accettazione Nesting
|
|
DataLayer.man.taBL.acceptBatch(BatchId, DataLayer.man.CodSoggCurrUser);
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lbtStopEstim_Click(object sender, EventArgs e)
|
|
{
|
|
// !!!FIXME!!! inviare a redis...
|
|
|
|
// registro su DB nesting iniziato...
|
|
DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.Imported);
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lbtSendEstim_Click(object sender, EventArgs e)
|
|
{
|
|
// invia a redis a a richiesta...
|
|
ComLib.sendMaterials();
|
|
ComLib.sendBatchReq(BatchId, "Estimation");
|
|
|
|
// registro su DB nesting iniziato...
|
|
DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.EstimationRequested);
|
|
raiseEvent();
|
|
}
|
|
protected void lbtStopNesting_Click(object sender, EventArgs e)
|
|
{
|
|
// !!!FIXME!!! inviare a redis...
|
|
|
|
// registro su DB nesting iniziato...
|
|
DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.EstimationDone);
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lbtSendNesting_Click(object sender, EventArgs e)
|
|
{
|
|
// invia a redis a a richiesta...
|
|
ComLib.sendMaterials();
|
|
ComLib.sendBatchReq(BatchId, "Nesting");
|
|
|
|
// registro su DB nesting iniziato...
|
|
DataLayer.man.taBL.updateStatus(BatchId, (int)ComLib.BatchStatus.NestRequested);
|
|
raiseEvent();
|
|
}
|
|
|
|
private void raiseEvent()
|
|
{
|
|
// se qualcuno ascolta sollevo evento nuovo valore...
|
|
if (eh_doRefresh != null)
|
|
{
|
|
eh_doRefresh(this, new EventArgs());
|
|
}
|
|
}
|
|
}
|
|
} |