Merge branch 'release/UpdateSimULog'
This commit is contained in:
Binary file not shown.
@@ -1282,6 +1282,14 @@ namespace IOB_MAN
|
||||
|
||||
private async void btnSendLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
// salvo valori button normali
|
||||
var stdColor = btnSendLog.BackColor;
|
||||
var stdText = btnSendLog.Text;
|
||||
// mostro che sto inviando dati...
|
||||
btnSendLog.Enabled = false;
|
||||
btnSendLog.BackColor = Color.OrangeRed;
|
||||
btnSendLog.Text = "fix directory";
|
||||
btnSendLog.Refresh();
|
||||
// svuoto area temp...
|
||||
string fileName = "LogFiles.zip";
|
||||
string tempDir = Path.Combine(Application.StartupPath, "temp", "logs");
|
||||
@@ -1300,6 +1308,8 @@ namespace IOB_MAN
|
||||
string logDir = TargetLogDir;
|
||||
if (dgvManagedItems.SelectedRows.Count > 0)
|
||||
{
|
||||
btnSendLog.Text = "zip start";
|
||||
btnSendLog.Refresh();
|
||||
// ciclo su row selezionate
|
||||
foreach (DataGridViewRow riga in dgvManagedItems.SelectedRows)
|
||||
{
|
||||
@@ -1326,6 +1336,8 @@ namespace IOB_MAN
|
||||
File.Delete(zipPath);
|
||||
}
|
||||
ZipFile.CreateFromDirectory(tempDir, zipPath);
|
||||
btnSendLog.Text = "zip end";
|
||||
btnSendLog.Refresh();
|
||||
|
||||
// ciclo di creazione ticket e upload file
|
||||
try
|
||||
@@ -1365,6 +1377,10 @@ namespace IOB_MAN
|
||||
idxSubLic = 0
|
||||
};
|
||||
}
|
||||
|
||||
btnSendLog.Text = "LogSend start";
|
||||
btnSendLog.BackColor = Color.DarkOrange;
|
||||
btnSendLog.Refresh();
|
||||
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(newSuppReq);
|
||||
var ticketResp = await client.PostAsync<TicketDTO>(ticketReq);
|
||||
|
||||
@@ -1376,6 +1392,9 @@ namespace IOB_MAN
|
||||
// ... infine INVIA file zip che li contiene...
|
||||
//var fileUploadResp = client.Post(fileUploadReq);
|
||||
var fileUploadResp = await client.PostAsync<UploadResult>(fileUploadReq);
|
||||
btnSendLog.Text = "LogSend end";
|
||||
btnSendLog.BackColor = Color.DarkOliveGreen;
|
||||
btnSendLog.Refresh();
|
||||
|
||||
// elimino folder temporanea
|
||||
if (Directory.Exists(tempDir))
|
||||
@@ -1393,6 +1412,10 @@ namespace IOB_MAN
|
||||
Logging.LogError($"Eccezione in fase gestione REST services{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
btnSendLog.BackColor = stdColor;
|
||||
btnSendLog.Text = stdText;
|
||||
btnSendLog.Enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,6 +483,11 @@ namespace IOB_UT_NEXT
|
||||
/// <summary>
|
||||
/// INPUT segnali in ingresso (standard base MAPO)
|
||||
/// </summary>
|
||||
SignIN
|
||||
SignIN,
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio UserLog (valori log attività utente)
|
||||
/// </summary>
|
||||
ULog
|
||||
}
|
||||
}
|
||||
@@ -59,8 +59,8 @@
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=1.3.1.9, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.1.3.1\lib\net45\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MapoSDK, Version=6.14.2109.2809, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2109.2809\lib\net40\MapoSDK.dll</HintPath>
|
||||
<Reference Include="MapoSDK, Version=6.14.2202.2819, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2202.2819\lib\net40\MapoSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MapoSDK" version="6.14.2109.2809" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2202.2819" targetFramework="net462" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
|
||||
<package id="NLog" version="4.7.11" targetFramework="net462" />
|
||||
|
||||
Generated
+26
-1
@@ -107,6 +107,8 @@
|
||||
this.lblOutMessage3 = new System.Windows.Forms.Label();
|
||||
this.lblOutMessage2 = new System.Windows.Forms.Label();
|
||||
this.tabData = new System.Windows.Forms.TabControl();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.lblQueueULog = new System.Windows.Forms.Label();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.tabMes.SuspendLayout();
|
||||
@@ -362,6 +364,8 @@
|
||||
// panel1
|
||||
//
|
||||
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||
this.panel1.Controls.Add(this.label24);
|
||||
this.panel1.Controls.Add(this.lblQueueULog);
|
||||
this.panel1.Controls.Add(this.label19);
|
||||
this.panel1.Controls.Add(this.lblQueueAlarmLen);
|
||||
this.panel1.Controls.Add(this.label13);
|
||||
@@ -380,7 +384,7 @@
|
||||
this.panel1.Location = new System.Drawing.Point(4, 6);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(343, 231);
|
||||
this.panel1.Size = new System.Drawing.Size(343, 248);
|
||||
this.panel1.TabIndex = 88;
|
||||
//
|
||||
// label19
|
||||
@@ -1020,6 +1024,25 @@
|
||||
this.tabData.TabIndex = 71;
|
||||
this.tabData.Selected += new System.Windows.Forms.TabControlEventHandler(this.TabData_Selected);
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.AutoSize = true;
|
||||
this.label24.Location = new System.Drawing.Point(15, 214);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(85, 13);
|
||||
this.label24.TabIndex = 94;
|
||||
this.label24.Text = "ULog Queue len";
|
||||
//
|
||||
// lblQueueULog
|
||||
//
|
||||
this.lblQueueULog.AutoSize = true;
|
||||
this.lblQueueULog.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblQueueULog.Location = new System.Drawing.Point(105, 214);
|
||||
this.lblQueueULog.Name = "lblQueueULog";
|
||||
this.lblQueueULog.Size = new System.Drawing.Size(31, 13);
|
||||
this.lblQueueULog.TabIndex = 95;
|
||||
this.lblQueueULog.Text = "###";
|
||||
//
|
||||
// AdapterForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -1143,5 +1166,7 @@
|
||||
private System.Windows.Forms.Label lblOutMessage3;
|
||||
private System.Windows.Forms.Label lblOutMessage2;
|
||||
private System.Windows.Forms.TabControl tabData;
|
||||
private System.Windows.Forms.Label label24;
|
||||
private System.Windows.Forms.Label lblQueueULog;
|
||||
}
|
||||
}
|
||||
@@ -275,6 +275,8 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
protected int maxMsQueue { get; set; }
|
||||
|
||||
protected int maxUlQueue { get; set; }
|
||||
|
||||
protected int qAlLen { get; set; }
|
||||
|
||||
protected int qEvLen { get; set; }
|
||||
@@ -282,12 +284,14 @@ namespace IOB_WIN_NEXT
|
||||
protected int qFlLen { get; set; }
|
||||
|
||||
protected int qMsLen { get; set; }
|
||||
|
||||
protected int qUlLen { get; set; }
|
||||
|
||||
protected int totQueue
|
||||
{
|
||||
get
|
||||
{
|
||||
return qEvLen + qFlLen + qAlLen + qMsLen;
|
||||
return qEvLen + qFlLen + qAlLen + qMsLen+ qUlLen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +643,30 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
public int ulQueueLen
|
||||
{
|
||||
set
|
||||
{
|
||||
qUlLen = value;
|
||||
lblQueueULog.Text = qUlLen.ToString();
|
||||
showQueueData();
|
||||
// se supero max precedente, ed è > 10... loggo!
|
||||
if (qUlLen > maxUlQueue && qUlLen > 10)
|
||||
{
|
||||
maxUlQueue = qUlLen;
|
||||
lgInfo($"[WARN] Coda UL di {value} record");
|
||||
}
|
||||
else
|
||||
{
|
||||
maxUlQueue--;
|
||||
maxUlQueue = maxUlQueue < qUlLen ? qUlLen : maxUlQueue;
|
||||
}
|
||||
}
|
||||
get
|
||||
{
|
||||
return qUlLen;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Numero max linee da mostrare (da controllo)...
|
||||
/// </summary>
|
||||
@@ -1111,7 +1139,7 @@ namespace IOB_WIN_NEXT
|
||||
cpuType = fIni.ReadString("CNC", "CPUTYPE", ""),
|
||||
rack = (short)fIni.ReadInteger("CNC", "RACK", 0),
|
||||
slot = (short)fIni.ReadInteger("CNC", "SLOT", 0),
|
||||
serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/"), fIni.ReadString("SERVER", "CMDBASE", "/"), fIni.ReadString("SERVER", "CMDFLOG", "/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/")),
|
||||
serverData = new serverMapo(fIni.ReadString("SERVER", "MPIP", "::1"), fIni.ReadString("SERVER", "MPURL", "/MP/IO"), fIni.ReadString("SERVER", "CMDBASE", "/IOB/input/"), fIni.ReadString("SERVER", "CMDFLOG", "/IOB/flog/"), fIni.ReadString("SERVER", "CMDULOG", "/IOB/ulog/"), fIni.ReadString("SERVER", "CMDALIVE", "/"), fIni.ReadString("SERVER", "CMDENABLED", "/"), fIni.ReadString("SERVER", "CMDREBO", "/"), fIni.ReadString("SERVER", "CMD_ODL_STARTED", "/IOB/getCurrOdlStart/"), fIni.ReadString("SERVER", "CLI_INST", "SW_CLI"), fIni.ReadString("SERVER", "CMD_FORCLE_SPLIT_ODL", "/IOB/forceSplitOdlFull/")),
|
||||
MAX_COUNTER_BLINK = Convert.ToInt32(fIni.ReadString("BLINK", "MAX_COUNTER_BLINK", "1")),
|
||||
BLINK_FILT = Convert.ToInt32(fIni.ReadString("BLINK", "BLINK_FILT", "0")),
|
||||
TCMaxDelayFactor = Convert.ToDouble(fIni.ReadString("OPTPAR", "TC_MAX_TC_FACTOR", "1.2").Replace(".", ",")),
|
||||
@@ -1401,6 +1429,7 @@ namespace IOB_WIN_NEXT
|
||||
flQueueLen = iobObj.QueueFLog.Count;
|
||||
alQueueLen = iobObj.QueueAlarm.Count;
|
||||
msQueueLen = iobObj.QueueMessages.Count;
|
||||
ulQueueLen = iobObj.QueueMessages.Count;
|
||||
// aggiorno labels counters...
|
||||
counterIob = $"pz IOB {iobObj.contapezziIOB}";
|
||||
counterMac = $"pz PLC {iobObj.contapezziPLC}";
|
||||
|
||||
@@ -74,6 +74,6 @@ CLI_INST=SteamWareSim
|
||||
;STARTLIST=PING
|
||||
;STARTLIST=PIZ09
|
||||
;STARTLIST=VL25
|
||||
STARTLIST=SIMUL_02
|
||||
STARTLIST=SIMUL_03
|
||||
|
||||
MAXCNC=10
|
||||
@@ -58,6 +58,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=true
|
||||
T_ON=7
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=81|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=161|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=261|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=82|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=162|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=262|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -16,6 +16,7 @@ MPIP=http://10.74.82.218
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDULOG=/IOB/ulog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
@@ -48,10 +49,19 @@ SIM_SLOW=4000|20
|
||||
SIM_WUCD=8000|20
|
||||
; indica gestione e simulazione bit 7 --> emergenza
|
||||
SIM_EMRG=4000|10
|
||||
; indica simulazione delle funzionalit� power ON/ OFF
|
||||
; indica simulazione delle funzionalita power ON/ OFF
|
||||
SIM_POW_ON_OFF=true
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=83|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=163|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=263|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=84|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=164|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=264|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=85|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=165|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=265|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=86|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=166|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=266|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=87|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=167|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=267|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -52,6 +52,15 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=88|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=168|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=268|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
; gestione DynData simulati
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
@@ -61,6 +61,14 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=true
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=81|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=161|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=261|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
|
||||
[BRANCH]
|
||||
|
||||
@@ -61,6 +61,14 @@ SIM_EMRG=4000|10
|
||||
SIM_POW_ON_OFF=false
|
||||
T_ON=6
|
||||
T_OFF=22
|
||||
; indica simulazione controlli utente
|
||||
SIM_RC=82|1
|
||||
; indica simulazione registro scarti
|
||||
SIM_RS=162|1
|
||||
; indica simulazione dichiarazioni (note) utente
|
||||
SIM_DICH=262|1
|
||||
; indica matricola opr simulata
|
||||
SIM_MATR_OPR=1
|
||||
|
||||
|
||||
[BRANCH]
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
},
|
||||
"PressBH": {
|
||||
"name": "SIM_PressBH",
|
||||
"description": "Pressione ALTA Bolbole",
|
||||
"description": "Pressione ALTA Bombole",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 2000,
|
||||
"maxVal": 2300,
|
||||
@@ -52,7 +52,7 @@
|
||||
},
|
||||
"PressBL": {
|
||||
"name": "SIM_PressBL",
|
||||
"description": "Pressione Media Bolbole",
|
||||
"description": "Pressione Media Bombole",
|
||||
"tipoMem": "Real",
|
||||
"minVal": 2100,
|
||||
"maxVal": 2500,
|
||||
|
||||
@@ -90,8 +90,8 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\krcc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MapoSDK, Version=6.14.2111.313, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2111.313\lib\net40\MapoSDK.dll</HintPath>
|
||||
<Reference Include="MapoSDK, Version=6.14.2202.2819, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2202.2819\lib\net40\MapoSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
|
||||
|
||||
@@ -141,12 +141,13 @@ namespace IOB_WIN_NEXT
|
||||
/// <param name="MPURL_">URL Base server applicativo</param>
|
||||
/// <param name="CMDBASE_">Comando x invio INPUT</param>
|
||||
/// <param name="CMDFLOG_">Comando x invio LOG per FLUSSO generico</param>
|
||||
/// <param name="CMDULOG_">Comando x invio USER LOG</param>
|
||||
/// <param name="CMDALIVE_">Comando x check alive</param>
|
||||
/// <param name="CMDENABLED_">Comando x check abilitato</param>
|
||||
/// <param name="CMDREBO_">Comando x reboot</param>
|
||||
/// <param name="CMD_ODL_STARTED_">Comando x check data avvio ODL</param>
|
||||
/// <param name="CMD_FORCLE_SPLIT_ODL_">Comando x forzare split ODL</param>
|
||||
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/")
|
||||
public serverMapo(string MPIP_, string MPURL_ = "/MP/IO", string CMDBASE_ = "/IOB/input/", string CMDFLOG_ = "/IOB/flog/", string CMDULOG_ = "/IOB/ulog/", string CMDALIVE_ = "IOB", string CMDENABLED_ = "/IOB/enabled/", string CMDREBO_ = "/sendReboot.aspx?idxMacchina=", string CMD_ODL_STARTED_ = "/IOB/getCurrOdlStart/", string CLI_INST_ = "SteamWare", string CMD_FORCLE_SPLIT_ODL_ = "/IOB/forceSplitOdlFull/", string CMD_IDLE_TIME_ = "/IOB/getIdlePeriod/")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(MPIP_))
|
||||
{
|
||||
@@ -159,6 +160,7 @@ namespace IOB_WIN_NEXT
|
||||
MPURL = MPURL_;
|
||||
CMDBASE = CMDBASE_;
|
||||
CMDFLOG = CMDFLOG_;
|
||||
CMDULOG = CMDULOG_;
|
||||
if (!string.IsNullOrEmpty(CMDBASE_))
|
||||
{
|
||||
CMDBASE_JSON = CMDBASE_.Replace("input", "evListJson");
|
||||
@@ -167,6 +169,10 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
CMDFLOG_JSON = CMDFLOG_.Replace("flog", "flogJson");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(CMDULOG_))
|
||||
{
|
||||
CMDULOG_JSON = CMDULOG_.Replace("ulog", "ulogJson");
|
||||
}
|
||||
CMDALIVE = CMDALIVE_;
|
||||
CMDENABLED = CMDENABLED_;
|
||||
CMDREBO = CMDREBO_;
|
||||
@@ -221,15 +227,25 @@ namespace IOB_WIN_NEXT
|
||||
public string CMDENABLED { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO
|
||||
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO
|
||||
/// </summary>
|
||||
public string CMDFLOG { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// comando base x LOG di FLUSSSO generico - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
|
||||
/// comando base x LOG di FLUSSO generico - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
|
||||
/// </summary>
|
||||
public string CMDFLOG_JSON { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO
|
||||
/// </summary>
|
||||
public string CMDULOG { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// comando base x USER LOG - salvataggio parametri extra sistema MAPO in modalità JSON payload come lista
|
||||
/// </summary>
|
||||
public string CMDULOG_JSON { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// comando base x comando reboot
|
||||
/// </summary>
|
||||
|
||||
+356
-136
@@ -355,6 +355,11 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
public ConcurrentQueue<string> QueueMessages = new ConcurrentQueue<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Coda valori LOG UTENTE (da non sottocampionare come samples)...
|
||||
/// </summary>
|
||||
public ConcurrentQueue<string> QueueULog = new ConcurrentQueue<string>();
|
||||
|
||||
/// <summary>
|
||||
/// alias booleano false = R
|
||||
/// </summary>
|
||||
@@ -1069,6 +1074,11 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
public int counterSigIN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contatore x invio dati UserLog
|
||||
/// </summary>
|
||||
public int counterULog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se sia in modalità DEMO --> da tipo IOB SIMULA...
|
||||
/// </summary>
|
||||
@@ -2029,6 +2039,7 @@ namespace IOB_WIN_NEXT
|
||||
QueueFLog = new ConcurrentQueue<string>();
|
||||
QueueAlarm = new ConcurrentQueue<string>();
|
||||
QueueMessages = new ConcurrentQueue<string>();
|
||||
QueueULog = new ConcurrentQueue<string>();
|
||||
}
|
||||
// imposto contatori blink a zero...
|
||||
i_counters = new int[32];
|
||||
@@ -2153,6 +2164,65 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Processo la coda UserLog...
|
||||
/// </summary>
|
||||
private void svuotaCodaULog()
|
||||
{
|
||||
// verifico SE la coda abbia dei valori...
|
||||
if (QueueULog.Count > 0)
|
||||
{
|
||||
// invio pacchetto di dati (max da conf)
|
||||
for (int i = 0; i < nMaxSend; i++)
|
||||
{
|
||||
// SE ho qualcosa in coda...
|
||||
if (QueueULog.Count > 0)
|
||||
{
|
||||
string currVal = "";
|
||||
if (MPOnline)
|
||||
{
|
||||
if (IobOnline)
|
||||
{
|
||||
List<string> listaValori = new List<string>();
|
||||
// se ho + di maxJsonData elementi --> invio un set di dati alla volta
|
||||
if (QueueULog.Count > maxJsonData)
|
||||
{
|
||||
// prendoi primi maxJsonDataValori
|
||||
for (int j = 0; j < maxJsonData; j++)
|
||||
{
|
||||
QueueULog.TryDequeue(out currVal);
|
||||
listaValori.Add(currVal);
|
||||
}
|
||||
sendDataBlock(urlType.ULog, listaValori);
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in blocco
|
||||
listaValori = QueueULog.ToList();
|
||||
// invio
|
||||
sendDataBlock(urlType.ULog, listaValori);
|
||||
// svuoto!
|
||||
QueueULog = new ConcurrentQueue<string>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca di inviare su un altro thread i vari dati accumulati...
|
||||
/// </summary>
|
||||
@@ -2183,7 +2253,8 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
// invio con thread separato...
|
||||
Task taskSigIN = Task.Run(() => svuotaCodaSignIN());
|
||||
Task taskFlog = Task.Run(() => svuotaCodaFLog());
|
||||
Task taskFLog = Task.Run(() => svuotaCodaFLog());
|
||||
Task taskULog = Task.Run(() => svuotaCodaULog());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2197,6 +2268,9 @@ namespace IOB_WIN_NEXT
|
||||
raiseRefresh(currDispData);
|
||||
// gestione queue FluxLog (invio, display)
|
||||
svuotaCodaFLog();
|
||||
// coda UserLog
|
||||
svuotaCodaULog();
|
||||
// refresh
|
||||
raiseRefresh(currDispData);
|
||||
}
|
||||
// se arrivo è tutto ok...
|
||||
@@ -2456,6 +2530,38 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
protected void lgDebug(string message, bool sendToForm = true)
|
||||
{
|
||||
//if (isVerboseLog)
|
||||
//{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB;
|
||||
lg.Debug(message);
|
||||
if (sendToForm)
|
||||
{
|
||||
sendToLogWatch("DEBUG", message);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
protected void lgDebug(string message, params object[] args)
|
||||
{
|
||||
//if (isVerboseLog)
|
||||
//{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB;
|
||||
lg.Debug(message, args);
|
||||
sendToLogWatch("DEBUG", message, args);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
@@ -2585,36 +2691,6 @@ namespace IOB_WIN_NEXT
|
||||
lg.Trace(message, args);
|
||||
sendToLogWatch("INFO", message, args);
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
protected void lgDebug(string message, bool sendToForm = true)
|
||||
{
|
||||
//if (isVerboseLog)
|
||||
//{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB;
|
||||
lg.Debug(message);
|
||||
if (sendToForm)
|
||||
{
|
||||
sendToLogWatch("DEBUG", message);
|
||||
}
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua logging DEBUG corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
protected void lgDebug(string message, params object[] args)
|
||||
{
|
||||
//if (isVerboseLog)
|
||||
//{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB;
|
||||
lg.Debug(message, args);
|
||||
sendToLogWatch("DEBUG", message, args);
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Legge il file di conf di una MAP di informazioni da gestire con lettura set memoria
|
||||
@@ -3278,6 +3354,27 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Accumula in coda i valori USER LOG e logga...
|
||||
/// </summary>
|
||||
/// <param name="val">VALORE RAW (x display)</param>
|
||||
/// <param name="encodedVal">VALORE già processato con qEncodeULog(...)</param>
|
||||
public void accodaUserLog(string val, string encodedVal)
|
||||
{
|
||||
// mostro dati variati letti...
|
||||
displayOtherData(val);
|
||||
// accodo IN PRIMIS al FluxLog --> accodo (valore già formattato)!
|
||||
QueueULog.Enqueue(encodedVal);
|
||||
|
||||
// loggo!
|
||||
lgInfo(string.Format("[QUEUE-USER-LOG] {0}", encodedVal));
|
||||
counterULog++;
|
||||
if (counterULog > 9999)
|
||||
{
|
||||
counterFLog = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update visualizzaizone BIT in ingresso
|
||||
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
|
||||
@@ -3868,76 +3965,115 @@ namespace IOB_WIN_NEXT
|
||||
string answ = "";
|
||||
if (elencoValori != null)
|
||||
{
|
||||
if (tipoUrl == urlType.FLog)
|
||||
string[] valori;
|
||||
int counter = 0;
|
||||
DateTime dtEve = DateTime.Now;
|
||||
switch (tipoUrl)
|
||||
{
|
||||
flogData currData = new flogData();
|
||||
flogJsonPayload fullObj = new flogJsonPayload();
|
||||
fullObj.fluxData = new List<flogData>();
|
||||
string[] valori;
|
||||
int counter = 0;
|
||||
DateTime dtEve = DateTime.Now;
|
||||
// inizio processando ogni valore
|
||||
foreach (var item in elencoValori)
|
||||
{
|
||||
valori = qDecodeIN(item);
|
||||
//DateTime.TryParse(valori[0], out dtEve);
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
DateTime.TryParseExact(valori[0], "yyyyMMddHHmmssfff", provider, DateTimeStyles.AssumeLocal, out dtEve);
|
||||
int.TryParse(valori[3], out counter);
|
||||
currData = new flogData()
|
||||
case urlType.FLog:
|
||||
flogData currFlData = new flogData();
|
||||
flogJsonPayload fullFlObj = new flogJsonPayload();
|
||||
fullFlObj.fluxData = new List<flogData>();
|
||||
// inizio processando ogni valore
|
||||
foreach (var item in elencoValori)
|
||||
{
|
||||
flux = valori[1],
|
||||
valore = valori[2],
|
||||
dtEve = dtEve,
|
||||
dtCurr = DateTime.Now,
|
||||
cnt = counter
|
||||
};
|
||||
fullObj.fluxData.Add(currData);
|
||||
}
|
||||
// conversione finale
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(fullObj);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in costruzione jsonPayload:{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
evData currData = new evData();
|
||||
evJsonPayload fullObj = new evJsonPayload();
|
||||
fullObj.eventList = new List<evData>();
|
||||
string[] valori;
|
||||
int counter = 0;
|
||||
DateTime dtEve = DateTime.Now;
|
||||
// inizio processando ogni valore
|
||||
foreach (var item in elencoValori)
|
||||
{
|
||||
valori = qDecodeIN(item);
|
||||
//DateTime.TryParse(valori[0], out dtEve);
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
DateTime.TryParseExact(valori[0], "yyyyMMddHHmmssfff", provider, DateTimeStyles.AssumeLocal, out dtEve);
|
||||
int.TryParse(valori[2], out counter);
|
||||
currData = new evData()
|
||||
valori = qDecodeIN(item);
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
DateTime.TryParseExact(valori[0], "yyyyMMddHHmmssfff", provider, DateTimeStyles.AssumeLocal, out dtEve);
|
||||
int.TryParse(valori[3], out counter);
|
||||
currFlData = new flogData()
|
||||
{
|
||||
flux = valori[1],
|
||||
valore = valori[2],
|
||||
dtEve = dtEve,
|
||||
dtCurr = DateTime.Now,
|
||||
cnt = counter
|
||||
};
|
||||
fullFlObj.fluxData.Add(currFlData);
|
||||
}
|
||||
// conversione finale
|
||||
try
|
||||
{
|
||||
valore = valori[1],
|
||||
dtEve = dtEve,
|
||||
dtCurr = DateTime.Now,
|
||||
cnt = counter
|
||||
};
|
||||
fullObj.eventList.Add(currData);
|
||||
}
|
||||
// conversione finale
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(fullObj);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in costruzione jsonPayload:{Environment.NewLine}{exc}");
|
||||
}
|
||||
answ = JsonConvert.SerializeObject(fullFlObj);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"FLog Errore in costruzione jsonPayload:{Environment.NewLine}{exc}");
|
||||
}
|
||||
break;
|
||||
|
||||
case urlType.SignIN:
|
||||
evData currSigData = new evData();
|
||||
evJsonPayload fullEvObj = new evJsonPayload();
|
||||
fullEvObj.eventList = new List<evData>();
|
||||
// inizio processando ogni valore
|
||||
foreach (var item in elencoValori)
|
||||
{
|
||||
valori = qDecodeIN(item);
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
DateTime.TryParseExact(valori[0], "yyyyMMddHHmmssfff", provider, DateTimeStyles.AssumeLocal, out dtEve);
|
||||
int.TryParse(valori[2], out counter);
|
||||
currSigData = new evData()
|
||||
{
|
||||
valore = valori[1],
|
||||
dtEve = dtEve,
|
||||
dtCurr = DateTime.Now,
|
||||
cnt = counter
|
||||
};
|
||||
fullEvObj.eventList.Add(currSigData);
|
||||
}
|
||||
// conversione finale
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(fullEvObj);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"SignIN Errore in costruzione jsonPayload:{Environment.NewLine}{exc}");
|
||||
}
|
||||
break;
|
||||
|
||||
case urlType.ULog:
|
||||
int numVal = 0;
|
||||
int matrOp = 0;
|
||||
ulogData currUlData = new ulogData();
|
||||
ulogJsonPayload fullUlObj = new ulogJsonPayload();
|
||||
fullUlObj.fluxData = new List<ulogData>();
|
||||
// inizio processando ogni valore
|
||||
foreach (var item in elencoValori)
|
||||
{
|
||||
valori = qDecodeIN(item);
|
||||
CultureInfo provider = CultureInfo.InvariantCulture;
|
||||
DateTime.TryParseExact(valori[0], "yyyyMMddHHmmssfff", provider, DateTimeStyles.AssumeLocal, out dtEve);
|
||||
int.TryParse(valori[3], out matrOp);
|
||||
int.TryParse(valori[5], out numVal);
|
||||
int.TryParse(valori[6], out counter);
|
||||
currUlData = new ulogData()
|
||||
{
|
||||
flux = valori[1],
|
||||
valore = valori[2],
|
||||
dtEve = dtEve,
|
||||
dtCurr = DateTime.Now,
|
||||
cnt = counter,
|
||||
matrOpr = matrOp,
|
||||
label = valori[4],
|
||||
valNum = numVal
|
||||
};
|
||||
fullUlObj.fluxData.Add(currUlData);
|
||||
}
|
||||
// conversione finale
|
||||
try
|
||||
{
|
||||
answ = JsonConvert.SerializeObject(fullUlObj);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"ULog Errore in costruzione jsonPayload:{Environment.NewLine}{exc}");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
@@ -4239,45 +4375,45 @@ namespace IOB_WIN_NEXT
|
||||
if (connectionOk)
|
||||
{
|
||||
currDynData = getDynData();
|
||||
try
|
||||
{
|
||||
string sVal = "";
|
||||
// se richiesto send diretto...
|
||||
if (forceSendByIob)
|
||||
{
|
||||
// per ogni valore del dizionario mostro ed accodo!
|
||||
foreach (var item in currDynData)
|
||||
{
|
||||
sVal = string.Format("[DYNDATA]{0}|{1}", item.Key, item.Value);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
// altrimenti verifico SE sia cambiato il valore dei DynData...
|
||||
else if (lastDynDataCtrlVal != currDynData["DYNDATA"])
|
||||
{
|
||||
// salvo!
|
||||
lastDynDataCtrlVal = currDynData["DYNDATA"];
|
||||
// per ogni valore del dizionario mostro ed accodo!
|
||||
foreach (var item in currDynData)
|
||||
{
|
||||
sVal = string.Format("[DYNDATA]{0}|{1}", item.Key, item.Value);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
// salvo array...
|
||||
lastDynData = currDynData;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in processDynData");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Errore connessione mancante x getDynData");
|
||||
}
|
||||
try
|
||||
{
|
||||
string sVal = "";
|
||||
// se richiesto send diretto...
|
||||
if (forceSendByIob)
|
||||
{
|
||||
// per ogni valore del dizionario mostro ed accodo!
|
||||
foreach (var item in currDynData)
|
||||
{
|
||||
sVal = string.Format("[DYNDATA]{0}|{1}", item.Key, item.Value);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
// altrimenti verifico SE sia cambiato il valore dei DynData...
|
||||
else if (lastDynDataCtrlVal != currDynData["DYNDATA"])
|
||||
{
|
||||
// salvo!
|
||||
lastDynDataCtrlVal = currDynData["DYNDATA"];
|
||||
// per ogni valore del dizionario mostro ed accodo!
|
||||
foreach (var item in currDynData)
|
||||
{
|
||||
sVal = string.Format("[DYNDATA]{0}|{1}", item.Key, item.Value);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog(item.Key, item.Value));
|
||||
}
|
||||
}
|
||||
// salvo array...
|
||||
lastDynData = currDynData;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in processDynData");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4508,7 +4644,8 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce il valore di flusso e valore in formato valido x messa in coda nel formato dtEve#flux#value#cont
|
||||
/// Fornisce il valore di flusso e valore in formato valido x messa in coda nel formato
|
||||
/// dtEve#flusso#valore#cont
|
||||
/// <paramref name="flusso">Flusso dati</paramref>
|
||||
/// <paramref name="valore">Valore da salvare</paramref>
|
||||
/// </summary>
|
||||
@@ -4517,7 +4654,7 @@ namespace IOB_WIN_NEXT
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format("{0:yyyyMMddHHmmssfff}#{1}#{2}#{3}", DateTime.Now, flusso, valore, counterFLog);
|
||||
answ = $"{DateTime.Now:yyyyMMddHHmmssfff}#{flusso}#{valore}#{counterULog}";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -4535,7 +4672,28 @@ namespace IOB_WIN_NEXT
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format("{0:yyyyMMddHHmmssfff}#{1}#{2}#{3}", eventDT, flusso, valore, counterFLog);
|
||||
answ = $"{eventDT:yyyyMMddHHmmssfff}#{flusso}#{valore}#{counterFLog}";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce il valore di UserLog e valore in formato valido x messa in coda nel formato:
|
||||
/// dtEve#flusso#value#cont#matrOpr#label#valNum
|
||||
/// <paramref name="flusso">Flusso dati (RC/RS/DI)</paramref>
|
||||
/// <paramref name="valore">Valore da inviare (valString</paramref>
|
||||
/// <paramref name="matrOpr">Matricola operatore</paramref>
|
||||
/// <paramref name="label">Valore etichetta: causale scarto / tagCode</paramref>
|
||||
/// <paramref name="valNum">Valore numerico: esitoOk (0/1) / nuo scarti</paramref>
|
||||
/// </summary>
|
||||
public string qEncodeULog(string flusso, string valore, int matrOpr, string label, int valNum)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = $"{DateTime.Now:yyyyMMddHHmmssfff}#{flusso}#{valore}#{matrOpr}#{label}#{valNum}#{counterULog}";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -5016,6 +5174,33 @@ namespace IOB_WIN_NEXT
|
||||
sendToMoonPro(urlType.FLog, currVal);
|
||||
}
|
||||
}
|
||||
|
||||
// svuoto coda ULog
|
||||
while (QueueULog.Count > 0)
|
||||
{
|
||||
List<string> listaValori = new List<string>();
|
||||
// se ho + di maxJsonData elementi --> invio un set di dati alla volta
|
||||
if (QueueULog.Count > maxJsonData)
|
||||
{
|
||||
string currVal = "";
|
||||
// prendoi primi maxJsonDataValori
|
||||
for (int i = 0; i < maxJsonData; i++)
|
||||
{
|
||||
QueueULog.TryDequeue(out currVal);
|
||||
listaValori.Add(currVal);
|
||||
}
|
||||
sendDataBlock(urlType.ULog, listaValori);
|
||||
}
|
||||
else
|
||||
{
|
||||
// invio in blocco
|
||||
listaValori = QueueULog.ToList();
|
||||
// invio
|
||||
sendDataBlock(urlType.ULog, listaValori);
|
||||
// svuoto!
|
||||
QueueULog = new ConcurrentQueue<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
parentForm.displayTaskAndLog("[STOP] Stopping adapter...");
|
||||
adpTryRestart = false;
|
||||
@@ -5216,7 +5401,24 @@ namespace IOB_WIN_NEXT
|
||||
public string urlDataBlock(urlType tipoUrl)
|
||||
{
|
||||
// verifico la parte di link "tipoComando"
|
||||
string tipoComando = tipoUrl == urlType.FLog ? cIobConf.serverData.CMDFLOG_JSON : cIobConf.serverData.CMDBASE_JSON;
|
||||
string tipoComando = "";
|
||||
switch (tipoUrl)
|
||||
{
|
||||
case urlType.FLog:
|
||||
tipoComando = cIobConf.serverData.CMDFLOG_JSON;
|
||||
break;
|
||||
|
||||
case urlType.SignIN:
|
||||
tipoComando = cIobConf.serverData.CMDBASE_JSON;
|
||||
break;
|
||||
|
||||
case urlType.ULog:
|
||||
tipoComando = cIobConf.serverData.CMDULOG_JSON;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// URL base x input
|
||||
string answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{tipoComando}{cIobConf.codIOB}";
|
||||
return answ;
|
||||
@@ -5258,6 +5460,24 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce URL di tipo UserLog
|
||||
/// </summary>
|
||||
/// <param name="queueVal">valore salvato in coda nel formato dtEve#flux#valore#counter</param>
|
||||
/// <returns></returns>
|
||||
public string urlULog(string queueVal)
|
||||
{
|
||||
// URL base x input
|
||||
string answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDULOG}";
|
||||
// decodifica valore!
|
||||
string[] valori = qDecodeIN(queueVal);
|
||||
// aggiungo macchina e valore...
|
||||
answ += string.Format(@"{0}?flux={1}&&valore={2}", cIobConf.codIOB, valori[1], valori[2]);
|
||||
// aggiondo dataOra evento e corrente + contatore...
|
||||
answ += string.Format(@"&&dtEve={0}&&dtCurr={1:yyyyMMddHHmmssfff}&&cnt={2}", valori[0], DateTime.Now, valori[3]);
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
|
||||
@@ -170,55 +170,56 @@ namespace IOB_WIN_NEXT
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
case taskType.setPzComm:
|
||||
case taskType.startSetup:
|
||||
case taskType.stopSetup:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setParameter:
|
||||
saveProdData(item);
|
||||
int byteSize = 0;
|
||||
// recupero dati da memMap... altrimenti NULLA
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
// verifico se posso aggiornare valori in memoria...
|
||||
if (memMap != null && memMap.mMapWrite != null)
|
||||
{
|
||||
dataConf currMem = memMap.mMapWrite[item.Key];
|
||||
byteSize = currMem.size;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
MemBlock = new byte[byteSize];
|
||||
if (currMem.tipoMem == plcDataType.String)
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
{
|
||||
saveStringOnMemBlock(ref MemBlock, item.Key, 0, byteSize);
|
||||
// recupero dati da memMap... altrimenti NULLA
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
{
|
||||
dataConf currMem = memMap.mMapWrite[item.Key];
|
||||
byteSize = currMem.size;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
MemBlock = new byte[byteSize];
|
||||
if (currMem.tipoMem == plcDataType.String)
|
||||
{
|
||||
saveStringOnMemBlock(ref MemBlock, item.Key, 0, byteSize);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.DInt)
|
||||
{
|
||||
int valDInt = 0;
|
||||
int.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.DInt.ToByteArray(valDInt);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.Int)
|
||||
{
|
||||
short valDInt = 0;
|
||||
short.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.Int.ToByteArray(valDInt);
|
||||
}
|
||||
}
|
||||
taskVal = item.Value;
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.DInt)
|
||||
else
|
||||
{
|
||||
int valDInt = 0;
|
||||
int.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.DInt.ToByteArray(valDInt);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.Int)
|
||||
{
|
||||
short valDInt = 0;
|
||||
short.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.Int.ToByteArray(valDInt);
|
||||
taskVal = $"NO DATA MEM, SET task: {item.Key} --> {item.Value}";
|
||||
}
|
||||
}
|
||||
taskVal = item.Value;
|
||||
break;
|
||||
|
||||
case taskType.startSetup:
|
||||
//// processo scrittura BIT su DB150.DBX4.0
|
||||
//MemBlock = new byte[1];
|
||||
//MemBlock[0] = (byte)1;
|
||||
//memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
|
||||
case taskType.stopSetup:
|
||||
//// processo scrittura BIT su DB150.DBX4.0
|
||||
//MemBlock = new byte[1];
|
||||
//MemBlock[0] = (byte)0;
|
||||
//memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
|
||||
case taskType.setParameter:
|
||||
else
|
||||
{
|
||||
taskVal = $"NO MemMap found, SET task: {item.Key} --> {item.Value}";
|
||||
}
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
|
||||
@@ -57,6 +57,11 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
protected DateTime lastSimData;
|
||||
|
||||
/// <summary>
|
||||
/// Matricola OPR simulato
|
||||
/// </summary>
|
||||
protected int matrOpr = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Durata minima ODL x reset quando pezzi iob > pezzi macchina...
|
||||
/// </summary>
|
||||
@@ -77,11 +82,26 @@ namespace IOB_WIN_NEXT
|
||||
/// </summary>
|
||||
protected bool sigPzCount = false;
|
||||
|
||||
/// <summary>
|
||||
/// Simulazione registrazione dichiarazioni utente
|
||||
/// </summary>
|
||||
protected simPar simDich;
|
||||
|
||||
/// <summary>
|
||||
/// BOOL: indica se simulare powerOn/Off (bit 0 e 1) compresi WarmUp e CoolDown
|
||||
/// </summary>
|
||||
protected bool simPowerOnOff;
|
||||
|
||||
/// <summary>
|
||||
/// Simulazione effettuazione controlli utente
|
||||
/// </summary>
|
||||
protected simPar simRC;
|
||||
|
||||
/// <summary>
|
||||
/// Simulazione registro scarti utente
|
||||
/// </summary>
|
||||
protected simPar simRS;
|
||||
|
||||
/// <summary>
|
||||
/// Tempo di MINIMO attesa x simulazione parametri
|
||||
/// </summary>
|
||||
@@ -146,6 +166,11 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
bool.TryParse(strDisableSim, out disableSimStatus);
|
||||
}
|
||||
// simulazioni azioni utente
|
||||
simRC = setupSimPar("SIM_RC");
|
||||
simRS = setupSimPar("SIM_RS");
|
||||
simDich = setupSimPar("SIM_DICH");
|
||||
int.TryParse(getOptPar("SIM_MATR_OPR"), out matrOpr);
|
||||
}
|
||||
setParamPlc();
|
||||
// ricarico da server i dati dei pezzi fatti...
|
||||
@@ -473,6 +498,62 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
// gestione simulazione utente
|
||||
if (simRC.wait <= 0)
|
||||
{
|
||||
// preparo record controlli... guasto se mi esce un secondo divisibile x 25
|
||||
DateTime adesso = DateTime.Now;
|
||||
int esitoNum = adesso.Second % 25 == 0 ? 0 : 1;
|
||||
string note = esitoNum == 1 ? "" : $"SIM Controllo fallito alle {DateTime.Now:yyyy-MM-dd HH:mm:ss}";
|
||||
string sVal = $"MatrOpr: {matrOpr} | Esito: {esitoNum} | note: {note}";
|
||||
// accodo x invio
|
||||
accodaUserLog(sVal, qEncodeULog("RC", note, matrOpr, "", esitoNum));
|
||||
// decremento duration
|
||||
simRC.duration--;
|
||||
// controllo se sia scaduta la duration... in quel caso reset...
|
||||
if (simRC.duration <= 0)
|
||||
{
|
||||
simRC = setupSimPar("SIM_RC");
|
||||
}
|
||||
}
|
||||
if (simRS.wait <= 0)
|
||||
{
|
||||
// preparo record controlli... guasto se mi esce un secondo divisibile x 25
|
||||
DateTime adesso = DateTime.Now;
|
||||
int causaleInt = adesso.Second % 7 + 1;
|
||||
int numSca = adesso.Second % 5 + 1;
|
||||
string causale = $"{causaleInt:00}";
|
||||
string note = $"SIM Scarto [{causale} x {numSca}] {DateTime.Now:yyyy-MM-dd HH:mm:ss}";
|
||||
string sVal = $"MatrOpr: {matrOpr} | Causale: {causale} | note: {note}";
|
||||
// accodo x invio
|
||||
accodaUserLog(sVal, qEncodeULog("RS", note, matrOpr, causale, numSca));
|
||||
// decremento duration
|
||||
simRS.duration--;
|
||||
// controllo se sia scaduta la duration... in quel caso reset...
|
||||
if (simRS.duration <= 0)
|
||||
{
|
||||
simRS = setupSimPar("SIM_RS");
|
||||
}
|
||||
}
|
||||
if (simDich.wait <= 0)
|
||||
{
|
||||
// preparo record dichiarazione...
|
||||
DateTime adesso = DateTime.Now;
|
||||
bool recLogin = adesso.Second % 5 == 0 ? false : true;
|
||||
string note = recLogin ? "SIM Login Utente STEAMWARE USER" : $"SIM Nota automatica alle {DateTime.Now:yyyy-MM-dd HH:mm:ss}";
|
||||
string codTag = recLogin ? "UserLogin" : "Note";
|
||||
string sVal = $"MatrOpr: {matrOpr} | codTag: {codTag} | note: {note}";
|
||||
// accodo x invio
|
||||
accodaUserLog(sVal, qEncodeULog("DI", note, matrOpr, codTag, 0));
|
||||
// decremento duration
|
||||
simDich.duration--;
|
||||
// controllo se sia scaduta la duration... in quel caso reset...
|
||||
if (simDich.duration <= 0)
|
||||
{
|
||||
simDich = setupSimPar("SIM_DICH");
|
||||
}
|
||||
}
|
||||
|
||||
// init obj display
|
||||
newDisplayData currDispData = new newDisplayData();
|
||||
currDispData.counter = contapezziIOB;
|
||||
@@ -482,7 +563,7 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup aprametri di simulazione per BIT indicato
|
||||
/// Setup parametri di simulazione per BIT indicato
|
||||
/// </summary>
|
||||
/// <param name="keyName"></param>
|
||||
private simPar setupSimPar(string keyName)
|
||||
@@ -804,6 +885,9 @@ namespace IOB_WIN_NEXT
|
||||
bit3.wait--;
|
||||
bit4.wait--;
|
||||
bit5.wait--;
|
||||
simDich.wait--;
|
||||
simRC.wait--;
|
||||
simRS.wait--;
|
||||
lastEvCheck = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="Autoupdater.NET.Official" version="1.7.0" targetFramework="net462" />
|
||||
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2111.313" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2202.2819" targetFramework="net462" />
|
||||
<package id="MathNet.Numerics" version="4.15.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="6.0.0" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.8" targetFramework="net462" developmentDependency="true" />
|
||||
|
||||
Reference in New Issue
Block a user