diff --git a/Step.Config/Config/areasConfig.xml b/Step.Config/Config/areasConfig.xml index 29d70528..5807e96d 100644 --- a/Step.Config/Config/areasConfig.xml +++ b/Step.Config/Config/areasConfig.xml @@ -11,12 +11,12 @@ true - false + true true true - false + true true false diff --git a/Step.Config/Report/PieAndData.xml b/Step.Config/Report/PieAndData.xml new file mode 100644 index 00000000..e3408db0 --- /dev/null +++ b/Step.Config/Report/PieAndData.xml @@ -0,0 +1,10 @@ + + + 90 + 10000 + 6 + + 20 + 60 + 20 + \ No newline at end of file diff --git a/Step.Config/Report/TimeLine.xml b/Step.Config/Report/TimeLine.xml new file mode 100644 index 00000000..a9fd0937 --- /dev/null +++ b/Step.Config/Report/TimeLine.xml @@ -0,0 +1,72 @@ + + + + + + 01/01/2019 + 03/01/2019 + + + 05/01/2019 + 10/01/2019 + + + 22/01/2019 + 27/01/2019 + + + + + 04/01/2019 + 05/01/2019 + + + 18/01/2019 + 20/01/2019 + + + + + 11/01/2019 + 18/01/2019 + + + 28/01/2019 + 30/01/2019 + + + + + + + PartPrg1 + 150 + 44 + + + 01/01/2019 + 05/01/2019 + + + 10/01/2019 + 15/01/2019 + + + + + Programma pezzo + 18 + 33 + + + 20/01/2019 + 23/01/2019 + + + 25/01/2019 + 25/01/2019 + + + + + \ No newline at end of file diff --git a/Step.Config/Step.Config.csproj b/Step.Config/Step.Config.csproj index 62391c4e..e35ea7f2 100644 --- a/Step.Config/Step.Config.csproj +++ b/Step.Config/Step.Config.csproj @@ -52,6 +52,12 @@ + + Always + + + Always + diff --git a/Step.Core/ThreadsFunctions.cs b/Step.Core/ThreadsFunctions.cs index de1ad091..ac9269f5 100644 --- a/Step.Core/ThreadsFunctions.cs +++ b/Step.Core/ThreadsFunctions.cs @@ -562,7 +562,7 @@ public static class ThreadsFunctions if (ncHandler.numericalControl.NC_IsConnected()) { // Get Data from config and PLC - libraryError = ncHandler.GetActiveProgramInfo(out DTOActiveProgramDataModel active); + libraryError = ncHandler.GetActiveProgramInfo(out DTOActiveProgramDataModel active); if (libraryError.IsError()) ManageLibraryError(libraryError); diff --git a/Step.Core/ThreadsHandler.cs b/Step.Core/ThreadsHandler.cs index b37ed8c9..a94a7824 100644 --- a/Step.Core/ThreadsHandler.cs +++ b/Step.Core/ThreadsHandler.cs @@ -25,7 +25,8 @@ namespace Step.Core ThreadsFunctions.UpdateToolsData, ThreadsFunctions.ReadNcMagazineActive, ThreadsFunctions.ReadPartProgramQueueData, - ThreadsFunctions.ReadScadaData + ThreadsFunctions.ReadScadaData, + ThreadsFunctions.ReadM154Data // ThreadsFunctions.ReadNcSoftKeysData, }; diff --git a/Step.Model/Constants.cs b/Step.Model/Constants.cs index 546e323d..6986818e 100644 --- a/Step.Model/Constants.cs +++ b/Step.Model/Constants.cs @@ -16,7 +16,7 @@ namespace Step.Model } public enum ROLE_IDS - { + { CMS_SERVICE_ONLY = 1, ADMIN = 2, GUEST = 3 diff --git a/Step/Controllers/WebApi/ReportController.cs b/Step/Controllers/WebApi/ReportController.cs new file mode 100644 index 00000000..0d66b15e --- /dev/null +++ b/Step/Controllers/WebApi/ReportController.cs @@ -0,0 +1,121 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Web.Http; +using System.Xml.Serialization; + +namespace Step.Controllers.WebApi +{ + [RoutePrefix("api/report")] + public class ReportController : ApiController + { + [Route("data")] + public IHttpActionResult GetReportData() + { + StreamReader sr = new StreamReader("./Report/PieAndData.xml"); + XmlSerializer xmlSerializer = new XmlSerializer(typeof(DTOReportData)); + DTOReportData schema = xmlSerializer.Deserialize(sr) as DTOReportData; + + return Ok(schema); + } + + [Route("pieChart")] + public IHttpActionResult GetPieChartData() + { + StreamReader sr = new StreamReader("./Report/PieAndData.xml"); + XmlSerializer xmlSerializer = new XmlSerializer(typeof(DTOPieChart)); + DTOPieChart schema = xmlSerializer.Deserialize(sr) as DTOPieChart; + + return Ok(schema); + } + + [Route("timeLine")] + public IHttpActionResult GetTimelineData() + { + StreamReader sr = new StreamReader("./Report/TimeLine.xml"); + XmlSerializer xmlSerializer = new XmlSerializer(typeof(DTOTimeline)); + DTOTimeline schema = xmlSerializer.Deserialize(sr) as DTOTimeline; + + return Ok(schema); + } + + [XmlRoot("pieAndData")] + public class DTOReportData + { + [XmlElement("absoluteValue")] + public int AbsoluteValue { get; set; } + [XmlElement("productedPieces")] + public int ProductedPieces { get; set; } + [XmlElement("discardedPieces")] + public int DiscardedPieces { get; set; } + } + + [XmlRoot("pieAndData")] + public class DTOPieChart + { + [XmlElement("stop")] + public int Stop { get; set; } + [XmlElement("run")] + public int Run { get; set; } + [XmlElement("idle")] + public int Idle { get; set; } + } + + + /// + /// TIMELINE + /// + + [XmlRoot("timeline")] + public class DTOTimeline + { + [XmlArray("partPrgs")] + [XmlArrayItem("partPrg", typeof(DTOTimelinePartPrg))] + public List PartPrgs { get; set; } + + [XmlElement("statusData")] + public DTOTimelineData StatusData { get; set; } + } + + public class DTOTimelineData + { + [XmlArray("runs")] + [XmlArrayItem("run", typeof(DTOTimelineDateElement))] + public List Run { get; set; } + [XmlArray("idles")] + [XmlArrayItem("idle", typeof(DTOTimelineDateElement))] + public List Idle { get; set; } + [XmlArray("stops")] + [XmlArrayItem("stop", typeof(DTOTimelineDateElement))] + public List Stop { get; set; } + } + + public class DTOTimelineDateElement + { + [XmlElement("from")] + public string From { get; set; } + + [XmlElement("to")] + public string To { get; set; } + } + + public class DTOTimelinePartPrg + { + [XmlElement("name")] + public string Name { get; set; } + + [XmlElement("executed")] + public string Executed { get; set; } + + [XmlElement("frequency")] + public string Frequency { get; set; } + + [XmlArray("dates")] + [XmlArrayItem("date", typeof(DTOTimelineDateElement))] + public List Occurrences { get; set; } + } + } +} diff --git a/Step/MultipartHandler.cs b/Step/MultipartHandler.cs index 57fb43e3..66b99e0d 100644 --- a/Step/MultipartHandler.cs +++ b/Step/MultipartHandler.cs @@ -13,7 +13,7 @@ namespace Step public string FileName { get; set; } public string MediaType { get; set; } public string Value { get { return Encoding.Default.GetString(Data); } } - public bool IsAFile { get { return !String.IsNullOrEmpty(FileName); } } + public bool IsAFile { get { return !string.IsNullOrEmpty(FileName); } } } public static class MultipartHandler diff --git a/Step/Step.csproj b/Step/Step.csproj index fa433db7..983138bd 100644 --- a/Step/Step.csproj +++ b/Step/Step.csproj @@ -178,6 +178,7 @@ +