0df7a2cd81
Aggiunta api alive x cancellazione vecchi dati redis e mongoDB
145 lines
4.4 KiB
C#
145 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)
|
|
{
|
|
Log.Instance.Error($"Eccezione in tentativo creazione file CNC da ordine offline{Environment.NewLine}{exc}");
|
|
}
|
|
|
|
if (allOk)
|
|
{
|
|
// registro che ho creato CNC... 1!
|
|
DLMan.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)
|
|
{
|
|
Log.Instance.Error($"Eccezione in tentativo chiusura richiesta CNC da ordine offline{Environment.NewLine}{exc}");
|
|
}
|
|
|
|
if (allOk)
|
|
{
|
|
// registro che riporto a 0!
|
|
DLMan.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!
|
|
DLMan.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...)
|
|
DLMan.taOffOL.updateStatus(OffOrdId, 3);
|
|
raiseReset();
|
|
}
|
|
|
|
/// <summary>
|
|
/// verifica possibilità avvio TASK x presenza task NON chiusi
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public bool canStartNew
|
|
{
|
|
get
|
|
{
|
|
return ComLib.canStartNew;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// Calcola il path corretto da mostrare x machine OFFLINE
|
|
/// </summary>
|
|
/// <param name="serverCncPath"></param>
|
|
/// <returns></returns>
|
|
public string getPathOffline(object serverCncPath)
|
|
{
|
|
string servBasePath = memLayer.ML.CRS("servBasePath").ToLower();
|
|
string offlineBasePath = memLayer.ML.CRS("offlineBasePath").ToLower();
|
|
string answ = $"{serverCncPath}".Replace(servBasePath, offlineBasePath);
|
|
return answ;
|
|
}
|
|
|
|
}
|
|
} |