Merge branch 'develop'

This commit is contained in:
Samuele E. Locatelli
2019-12-18 11:23:41 +01:00
3 changed files with 81 additions and 5 deletions
Vendored
+1 -1
View File
@@ -12,7 +12,7 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=1266']) {
withEnv(['NEXT_BUILD_NUMBER=1267']) {
// env.versionNumber = VersionNumber(versionNumberString : '6.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '6.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO'
+63 -2
View File
@@ -104,6 +104,67 @@ namespace MP_IO.Controllers
}
return answ;
}
/// <summary>
/// Processa una chiamata POST per l'invio di un array Json di oggetti input (EVENTI)
/// PUT: IOB/input/SIMUL_03
/// </summary>
/// <param name="id">ID dell'IOB</param>
/// <returns></returns>
[HttpPost]
public string inputJson(string id)
{
string answ = "-";
// questa classe è derivata da Controller.Response... x cui recupero lo stream in altro modo...
string content = "";
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
using (var reader = new StreamReader(
Request.InputStream, System.Text.Encoding.UTF8, true, 4096, true))
{
content = reader.ReadToEnd();
}
//Rest
System.Web.HttpContext.Current.Request.InputStream.Position = 0;
// se ho dati...
if (content != "")
{
// procedo a deserializzare in blocco l'oggetto...
evJsonPayload receivedData = new evJsonPayload();
try
{
// deserializzo.
receivedData = JsonConvert.DeserializeObject<evJsonPayload>(content);
}
catch (Exception exc)
{
logger.lg.scriviLog($"Errore in fase deserializzazione inputJson{Environment.NewLine}{exc}");
answ = "NO";
}
// se ho qualcosa da processare...
if (receivedData != null)
{
// per ogni valore --> processo!
try
{
foreach (var item in receivedData.eventsData)
{
if (memLayer.ML.CRI("_logLevel") > 6)
{
logger.lg.scriviLog(string.Format("Valori letti:{0}idxMacchina: {1}{0}valore: {2}{0}dtEve: {3}{0}dtCurr: {4}{0}cnt: {5}", Environment.NewLine, id, item.valore, item.dtEve, item.dtCurr, item.cnt), tipoLog.INFO);
}
// formato datetime come yyyyMMddHHmmssfff -->es: 20181223180600000
answ = DataLayer.processInput(id, item.valore, item.dtEve.ToString("yyyyMMddHHmmssfff"), item.dtCurr.ToString("yyyyMMddHHmmssfff"), item.cnt.ToString());
}
}
catch (Exception exc)
{
logger.lg.scriviLog($"Errore in fase invio valori inputJson{Environment.NewLine}{exc}");
answ = "NO";
}
}
}
return answ;
}
// GET: IOB/flog/SIMUL_03?flux=PROG&valore=P0001&dtEve=20161223180600000&dtCurr=20161223180600000&cnt=999
public string flog(string id, string flux, string valore, string dtEve, string dtCurr, string cnt)
{
@@ -156,11 +217,11 @@ namespace MP_IO.Controllers
if (content != "")
{
// procedo a deserializzare in blocco l'oggetto...
flogJson receivedData = new flogJson();
flogJsonPayload receivedData = new flogJsonPayload();
try
{
// deserializzo.
receivedData = JsonConvert.DeserializeObject<flogJson>(content);
receivedData = JsonConvert.DeserializeObject<flogJsonPayload>(content);
}
catch (Exception exc)
{
+17 -2
View File
@@ -35,19 +35,34 @@ namespace MapoSDK
/// <summary>
/// Array valori tipo flogData inviati come JSon
/// </summary>
public class flogJson
public class flogJsonPayload
{
public List<flogData> fluxData { get; set; }
}
/// <summary>
/// Tracciato FluxLog in formato JSON valido
/// </summary>
public class flogData
public class flogData : evData
{
/// <summary>
/// nome del flusso
/// </summary>
public string flux { get; set; } = "ND";
}
/// <summary>
/// Array valori tipo evData inviati come JSon
/// </summary>
public class evJsonPayload
{
public List<evData> eventsData { get; set; }
}
/// <summary>
/// Tracciato InputEvents in formato JSON valido
/// Derivato da input realtime valore=3&dtEve=20181206180600000&dtCurr=20181206180600000&cnt=999
/// </summary>
public class evData
{
/// <summary>
/// Valore del dato di flusso registrato
/// </summary>