From 59622332999fbe2f92c80298d4400d33276f003e Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 11 Aug 2020 11:41:12 +0200 Subject: [PATCH] Fix gestione preview OfflineOrder --- NKC_WF/Controllers/BatchProcController.cs | 5 +- NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx | 5 +- .../WebUserControls/cmp_OOIL_drawings.ascx.cs | 11 ++- .../cmp_offOrderDetail.ascx.cs | 18 ---- .../WebUserControls/cmp_offlineOrders.ascx.cs | 3 +- NKC_WF/WebUserControls/cmp_scrapList.ascx | 98 ++++++++----------- NKC_WF/WebUserControls/cmp_svgFull.ascx.cs | 28 ++++-- NKC_WF/site/MachineOffline.aspx | 4 +- NKC_WF/site/MachineOffline.aspx.cs | 9 +- NKC_WF/site/SvgFull.aspx.cs | 13 ++- 10 files changed, 99 insertions(+), 95 deletions(-) diff --git a/NKC_WF/Controllers/BatchProcController.cs b/NKC_WF/Controllers/BatchProcController.cs index 33c29d4..2012476 100644 --- a/NKC_WF/Controllers/BatchProcController.cs +++ b/NKC_WF/Controllers/BatchProcController.cs @@ -293,8 +293,11 @@ namespace NKC_WF.Controllers } else { + string nestBasePath = memLayer.ML.CRS("nestBasePath").ToLower(); + string servBasePath = memLayer.ML.CRS("servBasePath").ToLower(); + string fixPath = rispNest.DrawingPath.ToLower().Replace(nestBasePath, servBasePath); // segno offline order come processato registrando il disegno e segno ogni PART come lavorata da OffOrd2Item (status 992) - DataLayer.man.taOffOL.updateDrawing(Math.Abs(rispNest.BatchID), rispNest.DrawingPath); + DataLayer.man.taOffOL.updateDrawing(Math.Abs(rispNest.BatchID), fixPath); } } } diff --git a/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx b/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx index a473d2b..9885983 100644 --- a/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx +++ b/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx @@ -8,11 +8,10 @@
- + <%# Eval("imgName") %>
- -<%--traduci("SheetPreview")--%> \ No newline at end of file + \ No newline at end of file diff --git a/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx.cs b/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx.cs index 35da8c6..b0f39c0 100644 --- a/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_OOIL_drawings.ascx.cs @@ -1,4 +1,5 @@ -using System; +using SteamWare; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -22,7 +23,10 @@ namespace NKC_WF.WebUserControls } set { - hfDrawingPath.Value = value; + string nestBasePath = memLayer.ML.CRS("nestBasePath").ToLower(); + string servBasePath = memLayer.ML.CRS("servBasePath").ToLower(); + string fixPath = value.Replace(nestBasePath, servBasePath); + hfDrawingPath.Value = fixPath; fixDataBind(); } } @@ -30,6 +34,7 @@ namespace NKC_WF.WebUserControls private void fixDataBind() { string currPath = DrawingPath; + // in primis: fix directory // visibile SOLO SE valore != null... if (string.IsNullOrEmpty(currPath)) { @@ -51,7 +56,7 @@ namespace NKC_WF.WebUserControls { foreach (var item in elencoFiles) { - elencoDisegni.Add(new imgData { imgName = Path.GetFileName(item), DrawPath = item }); + elencoDisegni.Add(new imgData { imgName = Path.GetFileName(item), DrawPath = item.Replace(@"/",@"\") }); } } // sistemo repeater diff --git a/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs b/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs index 42472d1..9df63d6 100644 --- a/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_offOrderDetail.ascx.cs @@ -37,24 +37,6 @@ namespace NKC_WF.WebUserControls protected void frmView_DataBound(object sender, EventArgs e) { -#if false - 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}"); - } -#endif } protected void lbtMakeCnc_Click(object sender, EventArgs e) diff --git a/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs b/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs index 491a087..c784e36 100644 --- a/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_offlineOrders.ascx.cs @@ -4,7 +4,7 @@ using System.Web.UI; namespace NKC_WF.WebUserControls { - public partial class cmp_offlineOrders : System.Web.UI.UserControl + public partial class cmp_offlineOrders : BaseUserControl { protected void Page_Load(object sender, EventArgs e) { @@ -47,6 +47,7 @@ namespace NKC_WF.WebUserControls grView.SelectedIndex = -1; grView.DataBind(); cmp_offOrderDetail.Visible = false; + raiseReset(); } protected int selOrdId diff --git a/NKC_WF/WebUserControls/cmp_scrapList.ascx b/NKC_WF/WebUserControls/cmp_scrapList.ascx index e4dfff5..8221bf4 100644 --- a/NKC_WF/WebUserControls/cmp_scrapList.ascx +++ b/NKC_WF/WebUserControls/cmp_scrapList.ascx @@ -3,59 +3,47 @@
-
-

Scrap List (Items to process)

-
-
- - - <%-- - - - --%> - - - - - - - - - - - - - - - <%-- - --%> - <%-- - - - --%> - - - - - - - - - - - - - - - - - - - <%----%> - <%----%> - Create Order -
-
- diff --git a/NKC_WF/WebUserControls/cmp_svgFull.ascx.cs b/NKC_WF/WebUserControls/cmp_svgFull.ascx.cs index c999655..638f93a 100644 --- a/NKC_WF/WebUserControls/cmp_svgFull.ascx.cs +++ b/NKC_WF/WebUserControls/cmp_svgFull.ascx.cs @@ -59,18 +59,28 @@ namespace NKC_WF.WebUserControls string baseCurr = memLayer.ML.CRS("servBasePath").ToLower(); try { - var tabSheets = DataLayer.man.taSHL.getBySheetId(SheetId); - if (tabSheets.Count > 0) + if (SheetId > 0) { - filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr); - // la versioen da usare è la "_qr.svg", x cui faccio replace... tolgo ultimi 4 char e sostituisco... - int repPos = filename.LastIndexOf(".svg"); - filename = filename.Remove(repPos) + "_qr.svg"; - if (memLayer.ML.CRB("userVirtDir")) + var tabSheets = DataLayer.man.taSHL.getBySheetId(SheetId); + if (tabSheets.Count > 0) { - filename = Server.MapPath(filename); + filename = tabSheets[0].DrawFilePath.ToLower().Replace(baseOrig, baseCurr); + // la versioen da usare è la "_qr.svg", x cui faccio replace... tolgo ultimi 4 char e sostituisco... + int repPos = filename.LastIndexOf(".svg"); + filename = filename.Remove(repPos) + "_qr.svg"; + if (memLayer.ML.CRB("userVirtDir")) + { + filename = Server.MapPath(filename); + } + answ = File.ReadAllText(filename); + } + } + else + { + if (File.Exists(filename)) + { + answ = File.ReadAllText(filename); } - answ = File.ReadAllText(filename); } } catch diff --git a/NKC_WF/site/MachineOffline.aspx b/NKC_WF/site/MachineOffline.aspx index f668bd6..e04e0c8 100644 --- a/NKC_WF/site/MachineOffline.aspx +++ b/NKC_WF/site/MachineOffline.aspx @@ -8,10 +8,10 @@
-
+
-
+
diff --git a/NKC_WF/site/MachineOffline.aspx.cs b/NKC_WF/site/MachineOffline.aspx.cs index d59bcca..52c6d84 100644 --- a/NKC_WF/site/MachineOffline.aspx.cs +++ b/NKC_WF/site/MachineOffline.aspx.cs @@ -1,4 +1,5 @@ -using System; +using NKC_WF.WebUserControls; +using System; namespace NKC_WF { @@ -7,6 +8,12 @@ namespace NKC_WF protected void Page_Load(object sender, EventArgs e) { cmp_scrapList.eh_doRefresh += Cmp_scrapList_eh_doRefresh; + cmp_offlineOrders.eh_doReset += cmp_offlineOrders_eh_doReset; + } + + private void cmp_offlineOrders_eh_doReset(object sender, EventArgs e) + { + cmp_scrapList.doUpdate(); } private void Cmp_scrapList_eh_doRefresh(object sender, EventArgs e) diff --git a/NKC_WF/site/SvgFull.aspx.cs b/NKC_WF/site/SvgFull.aspx.cs index 58c8e6f..3607a22 100644 --- a/NKC_WF/site/SvgFull.aspx.cs +++ b/NKC_WF/site/SvgFull.aspx.cs @@ -13,12 +13,21 @@ namespace NKC_WF.site { protected void Page_Load(object sender, EventArgs e) { - if(!Page.IsPostBack) + if (!Page.IsPostBack) { ((SiteMaster)this.Master).showSearch = false; // recupero valore URL ed imposto... int sheetId = memLayer.ML.QSI("sheetId"); - cmp_svgFull.SheetId = sheetId; + string ImgPath = memLayer.ML.QSS("ImgPath"); + if (sheetId > 0) + { + cmp_svgFull.SheetId = sheetId; + } + else if(!string.IsNullOrEmpty(ImgPath)) + { + cmp_svgFull.filename = ImgPath; + cmp_svgFull.updateSvg(); + } } } }