NON INIZIALIZZA correttamente persistence layer... da verificare!!!! però abbozzata gestione contatori manutenzione...
This commit is contained in:
@@ -2481,9 +2481,12 @@ namespace MTC_Adapter
|
||||
string value = "";
|
||||
try
|
||||
{
|
||||
if (!persistenceLayer.TryGetValue(keyVal, out value))
|
||||
if (persistenceLayer != null)
|
||||
{
|
||||
persistenceLayer.Add(keyVal, "0");
|
||||
if (!persistenceLayer.TryGetValue(keyVal, out value))
|
||||
{
|
||||
persistenceLayer.Add(keyVal, "0");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace MTC_Adapter
|
||||
currACK_DW = new byte[1];
|
||||
}
|
||||
}
|
||||
catch(Exception exc)
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(string.Format("Errore in strobe:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
@@ -1109,31 +1109,27 @@ namespace MTC_Adapter
|
||||
private void getMtzDataFromPlc()
|
||||
{
|
||||
bool needSave = false;
|
||||
#if false
|
||||
// recupero i dati di manutenzione dall'area di memoria IN BLOCCO
|
||||
int memIndex = 14000;
|
||||
byte[] tabDatiMtz = new byte[4 * maintData.Length];
|
||||
int memIndex = 19166;
|
||||
uint[] tabDatiMtz = new uint[maintData.Length];
|
||||
inizio = DateTime.Now;
|
||||
OsaiMemRW(R, FANUC.MemType.R, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
OsaiMemRW_DWord(R, OSAI.MemTypeWord.MW_CODE, memIndex, ref tabDatiMtz);
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-DatiMtz", tabDatiMtz.Length * 4), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// uno ad uno vado a inserirli nella mappa dei dati dell'adapter...
|
||||
int shift = 4; // 32bit
|
||||
int numero = 0;
|
||||
uint valRead = 0;
|
||||
for (int i = 0; i < maintData.Length; i++)
|
||||
{
|
||||
numero = 0;
|
||||
valRead = 0;
|
||||
// 2016.07.06 uso indice i * 4 x selezionare area memoria...
|
||||
//shift = Convert.ToInt32(maintData[i].codNum) - 1;
|
||||
|
||||
if (maintData[i].varName == "ACC_TIME")
|
||||
{
|
||||
istOreMaccOn = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istOreMaccOn = tabDatiMtz[i];
|
||||
}
|
||||
else if (maintData[i].varName == "ACC_TIME_WORK")
|
||||
{
|
||||
istOreMaccLav = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istOreMaccLav = tabDatiMtz[i];
|
||||
}
|
||||
else if (maintData[i].varName.StartsWith("Path_"))
|
||||
{
|
||||
@@ -1148,7 +1144,7 @@ namespace MTC_Adapter
|
||||
}
|
||||
if (numero > 0)
|
||||
{
|
||||
vettPath[numero - 1].mPathPartCount.Value = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
vettPath[numero - 1].mPathPartCount.Value = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1164,7 +1160,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istDistMovAssi[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istDistMovAssi[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.EndsWith("_Invers"))
|
||||
@@ -1180,12 +1176,12 @@ namespace MTC_Adapter
|
||||
// 2016.07.06 debug di valori che potrebbero essere nulli...
|
||||
try
|
||||
{
|
||||
valRead = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
valRead = tabDatiMtz[i];
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
valRead = 0;
|
||||
lg.Error(string.Format("Errore in recupero num inversioni:{0}parametro: {1}{0}shift: {2}{0}i: {3}{0}Exc: {4}", Environment.NewLine, maintData[i].varName, shift, i, exc));
|
||||
lg.Error(string.Format("Errore in recupero num inversioni:{0}parametro: {1}{0}i: {2}{0}Exc: {3}", Environment.NewLine, maintData[i].varName, i, exc));
|
||||
}
|
||||
istNumInvAssi[numero - 1] = valRead;
|
||||
}
|
||||
@@ -1203,12 +1199,12 @@ namespace MTC_Adapter
|
||||
// 2016.07.06 debug di valori che potrebbero essere nulli...
|
||||
try
|
||||
{
|
||||
valRead = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
valRead = tabDatiMtz[i];
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
valRead = 0;
|
||||
lg.Error(string.Format("Errore in recupero num inversioni:{0}parametro: {1}{0}shift: {2}{0}i: {3}{0}Exc: {4}", Environment.NewLine, maintData[i].varName, shift, i, exc));
|
||||
lg.Error(string.Format("Errore in recupero num inversioni:{0}parametro: {1}{0}i: {2}{0}Exc: {3}", Environment.NewLine, maintData[i].varName, i, exc));
|
||||
}
|
||||
istAccTimeAssi[numero - 1] = valRead;
|
||||
}
|
||||
@@ -1226,7 +1222,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istGiriElettrom[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istGiriElettrom[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
else if (maintData[i].varName.EndsWith("_NumCambiUT"))
|
||||
@@ -1239,7 +1235,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istNumCambiUt[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istNumCambiUt[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1255,7 +1251,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istVacPumpWrkTime[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istVacPumpWrkTime[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1267,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istVacActCount[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istVacActCount[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1287,7 +1283,7 @@ namespace MTC_Adapter
|
||||
{ }
|
||||
if (numero > 0)
|
||||
{
|
||||
istLubroCount[numero - 1] = BitConverter.ToUInt32(tabDatiMtz, shift * i);
|
||||
istLubroCount[numero - 1] = tabDatiMtz[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1310,11 +1306,9 @@ namespace MTC_Adapter
|
||||
|
||||
// salvo se necessario!
|
||||
if (needSave) parentForm.persistData();
|
||||
// -------------------------------------------
|
||||
#endif
|
||||
// -------------------------------------------
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione lettura dati status da PLC
|
||||
/// </summary>
|
||||
@@ -1452,7 +1446,7 @@ namespace MTC_Adapter
|
||||
// anche il secondo!
|
||||
procPathOverride(1, currPathData, ref sb);
|
||||
}
|
||||
|
||||
|
||||
// se ho allarmi li accodo...
|
||||
if (allNcData.lastncerror != 0)
|
||||
{
|
||||
@@ -1514,7 +1508,6 @@ namespace MTC_Adapter
|
||||
/// </summary>
|
||||
private void loadMaintData()
|
||||
{
|
||||
#if false
|
||||
// carico dati x Maintenance
|
||||
if (utils.CRB("verbose")) lg.Info("Inizio caricamento vettore variabili manutenzione gestite");
|
||||
int totRighe = 0;
|
||||
@@ -1533,7 +1526,7 @@ namespace MTC_Adapter
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
//elencoAllarmi[rumRiga] = decodeAlarmLine(linea, ':');
|
||||
maintData[numRiga] = decodeOtherData(linea, utils.CRC("testCharSep"), "R", 14000, 4);
|
||||
maintData[numRiga] = decodeOtherData(linea, utils.CRC("testCharSep"), "MW", 19166, 2);
|
||||
numRiga++;
|
||||
}
|
||||
}
|
||||
@@ -1542,8 +1535,7 @@ namespace MTC_Adapter
|
||||
// ora trimmo vettore al solo numero VERO dei valori caricati...
|
||||
Array.Resize<otherData>(ref maintData, numRiga);
|
||||
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore di {0} variabili manutenzione gestite", numRiga));
|
||||
#endif
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore di {0} variabili manutenzione gestite", numRiga));
|
||||
}
|
||||
/// <summary>
|
||||
/// Lettura file gestione dati status da PLC
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<add key="windowCanMax" value="true"/>
|
||||
<add key="trayClose" value="true"/>
|
||||
<add key="autoSaveSec" value="60"/>
|
||||
<add key="waitRecMSec" value="5000"/>
|
||||
<add key="waitRecMSec" value="10000"/>
|
||||
<add key="testCharSep" value="|"/>
|
||||
<add key="fattdecimale" value="1000"/>
|
||||
<add key="fattConvDistAssi" value="1000"/>
|
||||
|
||||
@@ -159,12 +159,12 @@ namespace MTC_Adapter
|
||||
// se abilitato autoload conf leggo file corretto...
|
||||
if (utils.CRB("autoLoadConf"))
|
||||
{
|
||||
loadXmlFile(defConfFilePath);
|
||||
lg.Info("XML LOADED");
|
||||
loadPersistLayer(defPersLayerFile);
|
||||
lg.Info("PersLayerFile READ");
|
||||
agObj.loadPersData();
|
||||
lg.Info("PersLayerFile LOADED");
|
||||
loadXmlFile(defConfFilePath);
|
||||
lg.Info("XML LOADED");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace MTC_Adapter
|
||||
gather.Interval = utils.CRI("timerIntMs");
|
||||
gather.Enabled = true;
|
||||
|
||||
displayTaskAndWait("Running");
|
||||
displayTaskAndWait("Program Running");
|
||||
createTrayMenu();
|
||||
displayTaskAndWait("Tray Menu OK");
|
||||
|
||||
@@ -1131,9 +1131,12 @@ namespace MTC_Adapter
|
||||
if (userClickedOK == DialogResult.OK)
|
||||
{
|
||||
string XmlConfFile = openFileDial.FileName;
|
||||
loadXmlFile(XmlConfFile);
|
||||
loadPersistLayer(defPersLayerFile);
|
||||
lg.Info("PersLayerFile READ");
|
||||
agObj.loadPersData();
|
||||
lg.Info("PersLayerFile LOADED");
|
||||
loadXmlFile(XmlConfFile);
|
||||
lg.Info("XML LOADED");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user