137 lines
4.4 KiB
C#
137 lines
4.4 KiB
C#
using AppData;
|
|
using NKC_SDK;
|
|
using SteamWare;
|
|
using System;
|
|
using System.IO;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace NKC_WF.WebUserControls
|
|
{
|
|
public partial class cmp_offOrderDetail : BaseUserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!Page.IsPostBack)
|
|
{
|
|
// pulisco dir temp dai file dei cartellini stampati
|
|
reportPrinter.obj.pulisciDir();
|
|
}
|
|
}
|
|
|
|
public int OffOrdId
|
|
{
|
|
get
|
|
{
|
|
int answ = 0;
|
|
int.TryParse(hfOffOrderId.Value, out answ);
|
|
return answ;
|
|
}
|
|
set
|
|
{
|
|
hfOffOrderId.Value = value.ToString();
|
|
// faccio udpate svg...
|
|
frmView.DataBind();
|
|
}
|
|
}
|
|
|
|
protected void frmView_DataBound(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
protected void lbtMakeCnc_Click(object sender, EventArgs e)
|
|
{
|
|
bool allOk = true;
|
|
// invio tramite redis...
|
|
try
|
|
{
|
|
// ...inizio dai materiali
|
|
ComLib.sendMaterials();
|
|
// invio VERA richeista come OFFLINE ORDER...
|
|
allOk = ComLib.sendOfflineOrderReq(OffOrdId, "OffOrdCalculation");
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog($"Eccezione in tentativo creazione file CNC da ordine offline{Environment.NewLine}{exc}");
|
|
}
|
|
|
|
if (allOk)
|
|
{
|
|
// registro che ho creato CNC... 1!
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 1);
|
|
}
|
|
frmView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
protected void lbtStopCnc_Click(object sender, EventArgs e)
|
|
{
|
|
bool allOk = true;
|
|
// invio tramite redis...
|
|
try
|
|
{
|
|
// invio chiusura richiesta
|
|
ComLib.resetBatchReq();
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog($"Eccezione in tentativo chiusura richiesta CNC da ordine offline{Environment.NewLine}{exc}");
|
|
}
|
|
|
|
if (allOk)
|
|
{
|
|
// registro che riporto a 0!
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 0);
|
|
}
|
|
frmView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lbtPrintLabels_Click(object sender, EventArgs e)
|
|
{
|
|
bool allOk = true;
|
|
#if false
|
|
// chiamo procedura stampa report x etichette dei pezzi lavorati offline
|
|
string printer = DataLayer.man.getPrinter("PC-MACHINE-OFFLINE");
|
|
// ciclo tra TUTTI gli item compresi in questo Offline Order
|
|
var tabItems = DataLayer.man.taIL.getByOfflineOrder(OffOrdId);
|
|
foreach (var item in tabItems)
|
|
{
|
|
// lancio stampa
|
|
allOk = allOk && DataLayer.man.stampaDoc(item.ItemID.ToString(), printer, tipoDocumento.docPart, Request.UserHostName);
|
|
}
|
|
#endif
|
|
if (allOk)
|
|
{
|
|
// registro che ho stampato... 2!
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 2);
|
|
}
|
|
frmView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lblDone_Click(object sender, EventArgs e)
|
|
{
|
|
// registro che ho COMPLETATO... 3! (e di conseguenza aggiorna gli items...)
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 3);
|
|
raiseReset();
|
|
}
|
|
|
|
/// <summary>
|
|
/// verifica possibilità avvio TASK x presenza task NON chiusi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool canStartNew()
|
|
{
|
|
bool answ = false;
|
|
// in primis controllo SE ci siano task running, nel qual caso è false e basta...
|
|
int numEst = DataLayer.man.taBL.getByStatus((int)BatchStatus.EstimationRequested, "", 0).Count;
|
|
int numNest = DataLayer.man.taBL.getByStatus((int)BatchStatus.NestRequested, "", 0).Count;
|
|
// ora controllo anche offline orders...
|
|
int numOffOrd = DataLayer.man.taOffOL.getRunning().Count;
|
|
// ora la somma di tutti DEVE essere zero...
|
|
answ = ((numEst + numNest + numOffOrd) == 0);
|
|
return answ;
|
|
}
|
|
|
|
}
|
|
} |