diff --git a/Thermo.Active.Database/Controllers/ProdInfoController.cs b/Thermo.Active.Database/Controllers/ProdInfoController.cs index 6e8fa0c5..9e9c3a5f 100644 --- a/Thermo.Active.Database/Controllers/ProdInfoController.cs +++ b/Thermo.Active.Database/Controllers/ProdInfoController.cs @@ -73,7 +73,7 @@ namespace Thermo.Active.Database.Controllers // Create database machine model ProdInfoModel prodData = new ProdInfoModel() { - DtEvent = DateTime.UtcNow, + DtEvent = DateTime.Now, NumTarget = NumTarget, NumDone = NumDone, TimeWarm = TimeWarm, diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index e4d4a6ef..19c7f776 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -1390,6 +1390,7 @@ namespace Thermo.Active.NC // creo una perturubazione... var rand = new Random(); + int slope = TS_TC.Count / 2; Dictionary origTcData = new Dictionary(); foreach (var item2fix in TS_TC) { @@ -1397,7 +1398,8 @@ namespace Thermo.Active.NC } foreach (var origVal in origTcData) { - TS_TC[origVal.Key] = Math.Round(origVal.Value + (rand.NextDouble() * 20 - 10), 2); + TS_TC[origVal.Key] = Math.Round(origVal.Value + (rand.NextDouble() * 20 - 10) + slope, 2); + slope--; if (TS_Cad.ContainsKey(origVal.Key)) { TS_Cad[origVal.Key] = Math.Round((double)3600 / TS_TC[origVal.Key], 2); @@ -1513,6 +1515,8 @@ namespace Thermo.Active.NC libraryError = numericalControl.PLC_WAckPzProdEnd(); if (libraryError.IsError()) return libraryError; + // salvo x sicurezza ultimo start... + lastProdStart = DateTime.Now; } return libraryError; diff --git a/Thermo.Active/Controllers/WebApi/ProdController.cs b/Thermo.Active/Controllers/WebApi/ProdController.cs index 81f28f97..ae8aa070 100644 --- a/Thermo.Active/Controllers/WebApi/ProdController.cs +++ b/Thermo.Active/Controllers/WebApi/ProdController.cs @@ -1,6 +1,7 @@ using CMS_CORE_Library.Models; using System; using System.Collections.Generic; +using System.Linq; using System.Web.Http; using Thermo.Active.Model.DTOModels.ThProd; using Thermo.Active.NC; @@ -186,6 +187,7 @@ namespace Thermo.Active.Controllers.WebApi [Route("history"), HttpGet] public IHttpActionResult GetHistory(int indexStart, int numRecord) { + List prodInfoDTO = new List(); // Try connection CmsError libraryError = ncAdapter.Connect(); if (libraryError.IsError()) @@ -196,14 +198,21 @@ namespace Thermo.Active.Controllers.WebApi // recupero da DB i record richiesti libraryError = ncAdapter.GetHistProdInfoData(out List prodInfoDataList, indexStart, numRecord); + if (libraryError.IsError()) { ThermoActiveLogger.LogError($"GetHistory error | {libraryError.exception}"); return BadRequest(libraryError.localizationKey); } + // converto da datiPLC a DTOProdInfo... + foreach (var item in prodInfoDataList) + { + prodInfoDTO.Add(new DTOProdInfo(item)); + } + // ritorno solo fatto! - return Ok(prodInfoDataList); + return Ok(prodInfoDTO); } /// /// Request Prod Panel data diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs index 090e3f3a..c2a4b1b6 100644 --- a/Thermo.Active/Properties/AssemblyInfo.cs +++ b/Thermo.Active/Properties/AssemblyInfo.cs @@ -30,4 +30,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.9.39")] \ No newline at end of file +[assembly: AssemblyVersion("0.9.40")] \ No newline at end of file