112 lines
3.7 KiB
C#
112 lines
3.7 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)
|
|
{
|
|
try
|
|
{
|
|
Label filePath = (Label)frmView.FindControl("DrawFilePathLabel");
|
|
// se ho una stringa valida mostro svg, altrimenti NOT PROCESSED...
|
|
if (!string.IsNullOrEmpty(filePath.Text))
|
|
{
|
|
string filename = Server.MapPath(filePath.Text);
|
|
string svgRawData = File.ReadAllText(filename);
|
|
HtmlGenericControl svgControl = (HtmlGenericControl)frmView.FindControl("svgTable");
|
|
svgControl.InnerHtml = svgRawData;
|
|
}
|
|
}
|
|
catch (Exception exc)
|
|
{
|
|
logger.lg.scriviLog($"Eccezione in tentativo display file svg da ordine offline{Environment.NewLine}{exc}");
|
|
}
|
|
}
|
|
|
|
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 stampato... 2!
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 1);
|
|
}
|
|
frmView.DataBind();
|
|
raiseEvent();
|
|
}
|
|
|
|
protected void lbtPrintLabels_Click(object sender, EventArgs e)
|
|
{
|
|
bool allOk = true;
|
|
// 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);
|
|
}
|
|
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!
|
|
DataLayer.man.taOffOL.updateStatus(OffOrdId, 3);
|
|
raiseReset();
|
|
}
|
|
|
|
}
|
|
} |