Update x testare invio YAMl e pubblicazione versNumb corretta

This commit is contained in:
Samuele Locatelli
2025-06-30 10:27:19 +02:00
parent e4d7d93007
commit c434b14944
6 changed files with 68 additions and 25 deletions
+44 -17
View File
@@ -1,20 +1,22 @@
using Newtonsoft.Json;
using YamlDotNet.Serialization.NamingConventions;
using YamlDotNet.Serialization;
using NLog;
using System.IO;
using System;
using static IOB_UT_NEXT.Config.EnumConf;
using System.Collections.Generic;
using System.Linq;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Config;
using IOB_UT_NEXT.Config.Base;
using IOB_UT_NEXT.Config.Special;
using static System.Net.Mime.MediaTypeNames;
using System.Threading;
using MapoSDK;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Threading;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
using static IOB_UT_NEXT.BaseAlarmConf;
using static IOB_UT_NEXT.Config.EnumConf;
using static System.Net.Mime.MediaTypeNames;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
@@ -111,6 +113,8 @@ namespace IOB_UT_NEXT.Config
{
maxErrCheck = utils.CRI("maxErroriCheck");
}
Assembly entryAssembly = Assembly.GetEntryAssembly();
string relVers = entryAssembly != null ? $"{entryAssembly?.GetName().Version}" : $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}";
newConfObj.General = new IobDto()
{
CodIOB = fIni.ReadString("IOB", "IOB_NAME", codIob),
@@ -124,7 +128,7 @@ namespace IOB_UT_NEXT.Config
MaxPingRetry = fIni.ReadInteger("OPTPAR", "MAX_PING_RETRY", 5),
MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6),
MultiIobList = fIni.ReadString("OPTPAR", "IOB_MULTI_CNAME", ""),
RelVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}",
RelVers = relVers,// $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}",
ResetAlarmOnStart = bool.Parse(fIni.ReadString("OPTPAR", "SEND_ALARM_RESET", "false")),
SenMachineConf = bool.Parse(fIni.ReadString("OPTPAR", "SEND_MACHINE_CONF", "true")),
WaitRecMsec = Convert.ToInt32(fIni.ReadString("OPTPAR", "WAIT_REC_MSEC", "90000")),
@@ -259,7 +263,7 @@ namespace IOB_UT_NEXT.Config
MinRespTimeMs = fIni.ReadInteger("OPTPAR", "MIN_RESP_TIME_MS", 5),
NumArtMode = fIni.ReadString("OPTPAR", "SET_NUM_ART", ""),
NumOdlMode = fIni.ReadString("OPTPAR", "SET_NUM_COM", ""),
PoweroffTimeOutSec= fIni.ReadInteger("OPTPAR", "POWEROFF_TIMEOUT_SEC", 120),
PoweroffTimeOutSec = fIni.ReadInteger("OPTPAR", "POWEROFF_TIMEOUT_SEC", 120),
PzCadMode = fIni.ReadString("OPTPAR", "PZCAD_MODE", ""),
PzCountDelay = utils.CRI("pzCountDelay"),
PzCountMode = fIni.ReadString("OPTPAR", "PZCOUNT_MODE", ""),
@@ -341,7 +345,7 @@ namespace IOB_UT_NEXT.Config
// copio conf ping come x server...
newConfObj.MapoMes.DisabPing = newConfObj.Device.DisabPing;
// verifico opzione per disabilitare FeepAlive (es non voglio keepalive e info IOB da acquisitori potenza che sovrascrivono dati IOB macchina)
newConfObj.MapoMes.DisabKeepAlive= bool.Parse(fIni.ReadString("OPTPAR", "DISAB_KEEPALIVE", "false"));
newConfObj.MapoMes.DisabKeepAlive = bool.Parse(fIni.ReadString("OPTPAR", "DISAB_KEEPALIVE", "false"));
exclOptPar.Add("DISAB_KEEPALIVE");
// Gestione contapezzi...
@@ -374,11 +378,11 @@ namespace IOB_UT_NEXT.Config
string ftpServer = fIni.ReadString("OPTPAR", "FTP_SERVER", "");
if (!string.IsNullOrEmpty(ftpServer))
{
if(newConfObj.Special.FtpConf==null)
if (newConfObj.Special.FtpConf == null)
{
newConfObj.Special.FtpConf = new FtpDto()
{
Server=ftpServer,
Server = ftpServer,
User = fIni.ReadString("OPTPAR", "FTP_USER", ""),
Passwd = fIni.ReadString("OPTPAR", "FTP_PWD", ""),
CertValue = fIni.ReadString("OPTPAR", "FTP_CERT", ""),
@@ -1046,6 +1050,7 @@ namespace IOB_UT_NEXT.Config
{
var rawdata = GetYaml();
File.WriteAllText(filePath, rawdata);
answ = true;
}
catch
@@ -1053,6 +1058,28 @@ namespace IOB_UT_NEXT.Config
return answ;
}
/// <summary>
/// Invia a server conf serializzata in formato YAML
/// </summary>
/// <param name="urlSaveYaml">URL x chiamata salvtaggio yaml</param>
/// <returns></returns>
public bool SendConfYaml(string urlSaveYaml)
{
bool answ = false;
try
{
string rawData = GetYaml();
// prova anche ad inviare il contenuto al server IO...
string resp = utils.callUrl($"{urlSaveYaml}", rawData);
answ = resp == "OK";
}
catch
{ }
return answ;
}
#endregion
#region Logging
+2 -1
View File
@@ -1606,7 +1606,7 @@ namespace IOB_WIN_FORM
{
// out di cosa faccio...
displayTaskAndLog($"[STARTUP] Loading ConfFile: {iniConfFile}");
var appVers = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var appVers = Assembly.GetExecutingAssembly().GetName().Version;
string path = fileMover.GetExecutingDirectoryName(); // Directory.GetCurrentDirectory();
string fileName = Path.GetFileName(iniConfFile).Replace(".ini", ".iob");
string dirPath = Path.Combine(path, "DATA", "CONF_RUN");
@@ -1621,6 +1621,7 @@ namespace IOB_WIN_FORM
}
// salvo anche yaml...
IOBConfFull.SaveYaml(fullPath.Replace("iob", "yaml"));
IOBConfFull.SendConfYaml(iobObj.urlSaveConfYaml);
loadIobType();
// avvio macchina con adapter specificato...
+1 -1
View File
@@ -1037,7 +1037,7 @@ namespace IOB_WIN_FORM.Iob
/// </summary>
protected string urlSaveMemMap
{
get => $@"{urlCommandIob("saveConf")}";
get => $@"{urlCommandIobFile("saveConf")}";
}
/// <summary>
+10 -1
View File
@@ -447,6 +447,14 @@ namespace IOB_WIN_FORM.Iob
get => $@"{urlCommandIobFile("sendReboot")}?mac={GetMACAddress()}";
}
/// <summary>
/// URL per salvataggio dati conf YAML completi IOB...
/// </summary>
public string urlSaveConfYaml
{
get => $@"{urlCommandIobFile("saveConfYaml")}";
}
/// <summary>
/// Verifica SE si debba fare log verboso (verboso + ogni tot letture IN)
/// </summary>
@@ -3571,7 +3579,8 @@ namespace IOB_WIN_FORM.Iob
answ += $@"&&dtEve={valori[0]}&&dtCurr={DateTime.Now:yyyyMMddHHmmssfff}&&cnt={valori[3]}";
// se è disabilitato keepalive aggiungo opzione
if (IOBConfFull.MapoMes.DisabKeepAlive)
{;
{
;
answ += $"&&disabKA=true";
}
return answ;
+2 -2
View File
@@ -23,13 +23,13 @@ CLI_INST=SteamWareSim
;STARTLIST=2014
;STARTLIST=3026
;STARTLIST=2015
;STARTLIST=SIMUL_01
STARTLIST=SIMUL_01
;STARTLIST=TEND_250_53
;STARTLIST=Tend_RAMA_10_47
;STARTLIST=3026
;STARTLIST=TFT_RAMA_001
;STARTLIST=SIM_DP_02
;STARTLIST=2015
STARTLIST=1042
;STARTLIST=1042
MAXCNC=10
+9 -3
View File
@@ -288,9 +288,15 @@
<None Include="DATA\CONF\MAIN.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_01.ini" />
<None Include="DATA\CONF\SIMUL_01.json" />
<None Include="DATA\CONF\SIMUL_01_alarm.json" />
<None Include="DATA\CONF\SIMUL_01.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_01_alarm.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="postBuildTgt.bat" />
<None Include="Properties\Settings.settings">