ancora modifiche in decodifica status
This commit is contained in:
+115
-108
@@ -549,92 +549,91 @@ namespace IOB_WIN
|
||||
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
string currStatus = "00000";
|
||||
bool readDone = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
// leggo il file dela produzione HARD CODED...
|
||||
var sessStatus = confE63.ActiveSessions[4];
|
||||
// ciclo!
|
||||
try
|
||||
{
|
||||
// controllo di essere in sampling (o quasi)...
|
||||
if (actLevel >= Eurom63.ComLevel.ChannelOk)
|
||||
// controllo se sono in sampling dello stato
|
||||
if (actLevel >= Eurom63.ComLevel.StatusRequested || true)
|
||||
{
|
||||
// controllo se sono in sampling dello stato
|
||||
if (actLevel >= Eurom63.ComLevel.StatusRequested || true)
|
||||
/* -----------------------------------------------------
|
||||
* bitmap MAPO
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
* B5: allarme TCiclo (SLOW)
|
||||
----------------------------------------------------- */
|
||||
|
||||
/******************************************************************
|
||||
*
|
||||
* EXAMPLE file content
|
||||
* DATE, TIME, ActStsMach
|
||||
* 20201007, 21:28:10, 0A000
|
||||
*
|
||||
* Configurazione array status: 5 char status decoding
|
||||
*
|
||||
* Pos1: (status)
|
||||
* 0: poweron
|
||||
* 1: poweroff
|
||||
*
|
||||
* Pos2: (mode)
|
||||
* A: AUTO
|
||||
* S: SEMI auto
|
||||
* M: Manual
|
||||
* U: Setup
|
||||
* H: Hord
|
||||
* C: Maintenance
|
||||
* 0: Unknown
|
||||
* I: Idle
|
||||
*
|
||||
* Pos3: (assist call)
|
||||
* 0: No assistance
|
||||
* 2: Assistance required
|
||||
*
|
||||
* Pos4: (Bad part)
|
||||
* 0: last cycle not bad
|
||||
* 1: last cycle bad
|
||||
*
|
||||
* Pos5: Active Alarm
|
||||
* 0: No alarm
|
||||
* 1: Alarm
|
||||
*
|
||||
*
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
if (sessStatus != null)
|
||||
{
|
||||
/* -----------------------------------------------------
|
||||
* bitmap MAPO
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
* B5: allarme TCiclo (SLOW)
|
||||
----------------------------------------------------- */
|
||||
|
||||
/******************************************************************
|
||||
*
|
||||
* EXAMPLE file content
|
||||
* DATE, TIME, ActStsMach
|
||||
* 20201007, 21:28:10, 0A000
|
||||
*
|
||||
* Configurazione array status: 5 char status decoding
|
||||
*
|
||||
* Pos1: (status)
|
||||
* 0: poweron
|
||||
* 1: poweroff
|
||||
*
|
||||
* Pos2: (mode)
|
||||
* A: AUTO
|
||||
* S: SEMI auto
|
||||
* M: Manual
|
||||
* U: Setup
|
||||
* H: Hord
|
||||
* C: Maintenance
|
||||
* 0: Unknown
|
||||
* I: Idle
|
||||
*
|
||||
* Pos3: (assist call)
|
||||
* 0: No assistance
|
||||
* 2: Assistance required
|
||||
*
|
||||
* Pos4: (Bad part)
|
||||
* 0: last cycle not bad
|
||||
* 1: last cycle bad
|
||||
*
|
||||
* Pos5: Active Alarm
|
||||
* 0: No alarm
|
||||
* 1: Alarm
|
||||
*
|
||||
*
|
||||
*
|
||||
*******************************************************************/
|
||||
|
||||
// leggo il file dela produzione HARD CODED...
|
||||
var sessStatus = confE63.ActiveSessions[4];
|
||||
string currStatus = "00000";
|
||||
bool readDone = false;
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (sessStatus != null)
|
||||
if (sessStatus.Active)
|
||||
{
|
||||
if (sessStatus.Active)
|
||||
// nome file...
|
||||
string fileName = $"{BaseDir}\\{sessStatus.SessionName}.DAT";
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
// nome file...
|
||||
string fileName = $"{BaseDir}\\{sessStatus.SessionName}.DAT";
|
||||
if (File.Exists(fileName))
|
||||
string rawData = "";
|
||||
using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var textReader = new StreamReader(fileStream))
|
||||
{
|
||||
string rawData = "";
|
||||
using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
using (var textReader = new StreamReader(fileStream))
|
||||
{
|
||||
rawData = textReader.ReadToEnd();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
// ora splitto in linee
|
||||
string[] rawLines = Regex.Split(rawData, "\r\n|\r|\n");
|
||||
int numRow = rawLines.Length;
|
||||
rawData = textReader.ReadToEnd();
|
||||
}
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
// ora splitto in linee
|
||||
string[] rawLines = Regex.Split(rawData, "\r\n|\r|\n");
|
||||
int numRow = rawLines.Length;
|
||||
|
||||
// devo avere almeno 2 righe...
|
||||
if (numRow >= 2)
|
||||
// devo avere almeno 2 righe...
|
||||
if (numRow >= 2)
|
||||
{
|
||||
string[] statusData = rawLines[1].Split(',');
|
||||
if (statusData.Length >= 3)
|
||||
{
|
||||
string[] statusData = rawLines[1].Split(',');
|
||||
currStatus = statusData[2].Trim();
|
||||
if (!string.IsNullOrEmpty(currStatus))
|
||||
{
|
||||
@@ -663,52 +662,51 @@ namespace IOB_WIN
|
||||
cleanupResp(sessStatus.SessionName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"decodifica StatusData in errore: trovati {statusData.Length} campi in {rawLines}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Lettura file stato in errore: trovate {numRow} linee");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
actLevel = Eurom63.ComLevel.ChannelOk;
|
||||
// se valido RILEGGO ultimo curr status
|
||||
if (Last_CurrStatus.ValidUntil > adesso)
|
||||
{
|
||||
currStatus = Last_CurrStatus.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!readDone)
|
||||
else
|
||||
{
|
||||
actLevel = Eurom63.ComLevel.ChannelOk;
|
||||
// se valido RILEGGO ultimo curr status
|
||||
if (Last_CurrStatus.ValidUntil > adesso)
|
||||
{
|
||||
currStatus = Last_CurrStatus.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// processo il currentStatus... parto da poweron
|
||||
B_input = currStatus[0] == '1' ? 0 : 1;
|
||||
// ora MODE
|
||||
switch (currStatus[1])
|
||||
{
|
||||
case 'A':
|
||||
B_input += (1 << 1);
|
||||
break;
|
||||
// processo il currentStatus... parto da poweron
|
||||
B_input = currStatus[0] == '1' ? 0 : 1;
|
||||
// ora MODE
|
||||
switch (currStatus[1])
|
||||
{
|
||||
case 'A':
|
||||
B_input += (1 << 1);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
case 'M':
|
||||
case 'U':
|
||||
B_input += (1 << 4);
|
||||
break;
|
||||
case 'S':
|
||||
case 'M':
|
||||
case 'U':
|
||||
B_input += (1 << 4);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// ora cerco allarmi
|
||||
if (currStatus[4] == '1')
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// ora cerco allarmi
|
||||
if (currStatus[4] == '1')
|
||||
{
|
||||
B_input += (1 << 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,6 +719,15 @@ namespace IOB_WIN
|
||||
if (currDispData != null)
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
}
|
||||
|
||||
if (!readDone)
|
||||
{
|
||||
// se valido RILEGGO ultimo curr status
|
||||
if (Last_CurrStatus.ValidUntil > adesso)
|
||||
{
|
||||
currStatus = Last_CurrStatus.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=715']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=716']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MAPO-IOB-WIN'
|
||||
|
||||
Reference in New Issue
Block a user