diff --git a/NKC_WF/Controllers/ReportConfController.cs b/NKC_WF/Controllers/ReportConfController.cs index bd7ddac..c12ed50 100644 --- a/NKC_WF/Controllers/ReportConfController.cs +++ b/NKC_WF/Controllers/ReportConfController.cs @@ -6,6 +6,10 @@ using System.Net.Http; using System.Web.Http; using static NKC_WF.WebUserControls.cmp_OOIL_drawings; using SteamWare; +using SteamWare.Reports; +using System.Web; +using System.IO; +using Newtonsoft.Json; namespace NKC_WF.Controllers { @@ -16,13 +20,13 @@ namespace NKC_WF.Controllers /// GET: api/PrintQueueConf /// /// lista oggetto Json in formato SteamwareSDK.queueConf - public List Get() + public List Get() { - List answ = MagData.MagDataLayer.man.reportConfJson; + List answ = reportConfJson; // se vuoto... creo! if (answ.Count == 0) { - SteamWare.Reports.reportConf currConf = new SteamWare.Reports.reportConf() + reportConf currConf = new reportConf() { name = "none", template = "none.rdlc" @@ -31,5 +35,36 @@ namespace NKC_WF.Controllers } return answ; } + + /// + /// Restituisce un array JSon x le conf dei report/template di stampa leggendo dal file + /// + /// lista oggetto Json in formato SteamwareSDK.templateConf + protected List reportConfJson + { + get + { + List answ = new List(); + string dirPath = HttpContext.Current.Server.MapPath("~/Reports/"); + string nomeFile = "reportConf.json"; + bool fileExist = fileMover.obj.fileExist(dirPath, nomeFile); + if (fileExist) + { + string rawData = File.ReadAllText($"{dirPath}\\{nomeFile}"); + if (!string.IsNullOrEmpty(rawData)) + { + try + { + answ = JsonConvert.DeserializeObject>(rawData); + } + catch (Exception exc) + { + SteamWare.Logger.Logging.Instance.Error(exc, "Eccezione in decodifica file conf reportConfJson"); + } + } + } + return answ; + } + } } } diff --git a/NKC_WF/NKC_WF.csproj b/NKC_WF/NKC_WF.csproj index 94476ca..23210e5 100644 --- a/NKC_WF/NKC_WF.csproj +++ b/NKC_WF/NKC_WF.csproj @@ -352,6 +352,7 @@ + @@ -704,6 +705,7 @@ + diff --git a/NKC_WF/Reports/reportConf.json b/NKC_WF/Reports/reportConf.json new file mode 100644 index 0000000..32ab91d --- /dev/null +++ b/NKC_WF/Reports/reportConf.json @@ -0,0 +1,46 @@ +[ + //{ + // "name": "docPaint", + // "template": "Bin.rdlc" + //}, + //{ + // "name": "docPaintPost", + // "template": "Bin.rdlc" + //}, + //{ + // "name": "docCart", + // "template": "Cart.rdlc" + //}, + //{ + // "name": "docCartIRK", + // "template": "IRK_Kitting_List.rdlc" + //}, + //{ + // "name": "docCartIRKSum", + // "template": "IRK_Kitting_Group.rdlc" + //}, + //{ + // "name": "docPart", + // "template": "Part.rdlc" + //}, + //{ + // "name": "docOffline", + // "template": "Part.rdlc" + //}, + //{ + // "name": "docOtherPart", + // "template": "OtherPart.rdlc" + //}, + //{ + // "name": "docCartSpecialPart", + // "template": "SpecialParts.rdlc" + //}, + //{ + // "name": "docStack", + // "template": "BunkGroup.rdlc" + //}, + //{ + // "name": "docStack", + // "template": "BunkList.rdlc" + //} +] \ No newline at end of file