diff --git a/NKC_WF/site/DxfValidation.aspx b/NKC_WF/site/DxfValidation.aspx new file mode 100644 index 0000000..a7850c0 --- /dev/null +++ b/NKC_WF/site/DxfValidation.aspx @@ -0,0 +1,25 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="DxfValidation.aspx.cs" Inherits="NKC_WF.site.DxfValidation" %> + +<%@ Register Src="~/WebUserControls/cmp_fileUpload.ascx" TagPrefix="uc1" TagName="cmp_fileUpload" %> + + +
+
+
+

<%: traduci("DxfValidation") %>

+
+
+
+
+ +
+
+
+
+ Dxf file List +
+
+
+
+
+
\ No newline at end of file diff --git a/NKC_WF/site/DxfValidation.aspx.cs b/NKC_WF/site/DxfValidation.aspx.cs new file mode 100644 index 0000000..430df43 --- /dev/null +++ b/NKC_WF/site/DxfValidation.aspx.cs @@ -0,0 +1,178 @@ +using AppData; +using SteamWare; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class DxfValidation : BasePage + { + #region Protected Fields + + /// + /// Folder REMOTA x copia verso SQL + /// + protected string _SqlCopyDir = memLayer.ML.CRS("_SqlCopyDir"); + + /// + /// Folder x SQL import + /// + protected string _SqlImportDir = memLayer.ML.CRS("_SqlImportDir"); + + /// + /// Path base x nesting + /// + protected string cadBasePath = $"{memLayer.ML.CRS("nestBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; + + /// + /// Path base x server + /// + protected string srvCadBasePath = $"{memLayer.ML.CRS("servBasePath")}{memLayer.ML.CRS("drawingFolder")}/"; + + #endregion Protected Fields + + #region Private Methods + + private void Cmp_fileUpload_eh_FileUploaded(object sender, WebUserContols.FileUploadEventArgs e) + { +#if false + /*-------------------------------------------- + * Note validazione: + * - leggo cSV + * - carico su DB + * - verifico (come ora x DXF) TUTTI i particolari + * - cerco su tab ItemValidation + * --> NON TROVATO --> creo record IV + record Batch stato 8, con KitID = OrdID = 0, DA VALUTARE!!! + * - se valutazione tempo <= 1 sec --> NON VALIDO + * - se valutazione tempo > 1 sec --> VALIDO + * + * --> trovato + * - se valido --> check DXF, + * --> dxf ok --> finito + * --> dxf non trovato --> NON VALIDO, segnalo errore su part + * - se NON valido --> segnalo errore su part + * + *--------------------------------------------*/ + + bool dataValidated = true; + DateTime adesso = DateTime.Now; + string dirFrom = e.LocalPath; + string dirTo = $"{_SqlCopyDir}{adesso.ToString("yyyy-MM")}\\"; + string dirImport = $"{_SqlImportDir}{adesso.ToString("yyyy-MM")}\\"; + int batchID = 0; + // recupero elenco parti validate... + DS_App.ItemListDataTable ItemValitadion = DLMan.taIL.GetData(); + // preporcessing file: leggo e correggo: + // - sostituisco "," --> ";" come separatore + // - tolgo "" e spazi da stringa + string[] rawLines = System.IO.File.ReadAllLines($"{e.LocalPath}{e.FileName}"); + string[] fixLines = new string[rawLines.Length]; + int numRow = 0; + if (memLayer.ML.CRB("preFixCsv")) + { + foreach (var riga in rawLines) + { + string newLine = ""; + // splitto con " + string[] rowPart = riga.Split('"'); + int i = 0; + foreach (var parte in rowPart) + { + if (i % 2 == 0) + { + // pari --> sostituisco , --> ; + newLine += parte.Replace(",", ";"); + } + else + { + // dispari: trimmo + newLine += parte.Trim(); + } + i++; + } + // ricombino! + fixLines[numRow] = newLine; + numRow++; + } + // salvo NUOVO file... + System.IO.File.WriteAllLines($"{e.LocalPath}{e.FileName}", fixLines); + } + // copio su server SQL + try + { + // copio su SQL... + fileMover.obj.copiaFile(dirFrom, dirTo, e.FileName); + } + catch (Exception exc) + { + logger.lg.scriviLog($"{traduci("ErrOrderCsvImp01")}:{Environment.NewLine}{exc}"); + DLMan.taEL.insertQuery(DateTime.Now, "Copy CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); + } + // chiamo stored caricamento + DS_App.ImportLogDataTable tabDati = null; + try + { + // chiamo procedura SQL x import... + tabDati = DLMan.taImpLog.importCsvOrd($"{dirImport}", e.FileName, e.BatchName, ";", "\n", "2", 0, 0, 0); + } + catch (Exception exc) + { + logger.lg.scriviLog($"{traduci("ErrOrderCsvImp02")}:{Environment.NewLine}{exc}"); + // salvo log errore... + DLMan.taEL.insertQuery(DateTime.Now, "Upload CSV", $"{e.BatchName}", $"{e.BatchName}.{e.FileName}", $"Exception: {exc}"); + dataValidated = false; + } + // FIX eventuali cadFilePath... + DLMan.taIL.updateCadPath(cadBasePath, 0, false); + // recupero da batch la riga impostata... + try + { + var tabBatch = DLMan.taBL.getLastByTakt(e.BatchName); + if (tabBatch != null) + { + if (tabBatch.Count > 0) + { + batchID = tabBatch[0].BatchID; + } + } + } + catch (Exception exc) + { + logger.lg.scriviLog($"{traduci("ErrOrderCsvImp03")}:{Environment.NewLine}{exc}"); + dataValidated = false; + } + if (dataValidated && batchID > 0) + { + dataValidated = doValidations(batchID); + } + if (!dataValidated) + { + try + { + var newBatch = tabDati[0]; + int bStatus = 7; + DLMan.taBL.updateStatus(batchID, bStatus, e.BatchName, -1); + } + catch + { } + } + Response.Redirect(Request.RawUrl); +#endif + } + + #endregion Private Methods + + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + cmp_fileUpload.eh_FileUploaded += Cmp_fileUpload_eh_FileUploaded; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/NKC_WF/site/DxfValidation.aspx.designer.cs b/NKC_WF/site/DxfValidation.aspx.designer.cs new file mode 100644 index 0000000..dd74365 --- /dev/null +++ b/NKC_WF/site/DxfValidation.aspx.designer.cs @@ -0,0 +1,35 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class DxfValidation + { + + /// + /// Controllo cmp_fileUpload. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::NKC_WF.WebUserContols.cmp_fileUpload cmp_fileUpload; + + /// + /// Controllo divFileList. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFileList; + } +} diff --git a/NKC_WF/site/OrderHistory.aspx b/NKC_WF/site/OrderHistory.aspx new file mode 100644 index 0000000..d7d97da --- /dev/null +++ b/NKC_WF/site/OrderHistory.aspx @@ -0,0 +1,18 @@ +<%@ Page Title="" Language="C#" MasterPageFile="~/SiteContent.master" AutoEventWireup="true" CodeBehind="OrderHistory.aspx.cs" Inherits="NKC_WF.site.OrderHistory" %> + + +
+
+
+

<%: traduci("OrderHistory") %>

+
+
+
+
+ FULL orders List +
+
+
+
+
+
\ No newline at end of file diff --git a/NKC_WF/site/OrderHistory.aspx.cs b/NKC_WF/site/OrderHistory.aspx.cs new file mode 100644 index 0000000..e58cbd4 --- /dev/null +++ b/NKC_WF/site/OrderHistory.aspx.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace NKC_WF.site +{ + public partial class OrderHistory : BasePage + { + #region Protected Methods + + protected void Page_Load(object sender, EventArgs e) + { + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/NKC_WF/site/OrderHistory.aspx.designer.cs b/NKC_WF/site/OrderHistory.aspx.designer.cs new file mode 100644 index 0000000..0fb1732 --- /dev/null +++ b/NKC_WF/site/OrderHistory.aspx.designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Codice generato da uno strumento. +// +// Le modifiche a questo file possono causare un comportamento non corretto e verranno perse se +// il codice viene rigenerato. +// +//------------------------------------------------------------------------------ + +namespace NKC_WF.site +{ + + + public partial class OrderHistory + { + + /// + /// Controllo divFileList. + /// + /// + /// Campo generato automaticamente. + /// Per la modifica, spostare la dichiarazione di campo dal file di progettazione al file code-behind. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl divFileList; + } +}