fix preliminare gestione copia vettore allarmi

This commit is contained in:
Samuele Locatelli
2020-04-17 18:45:26 +02:00
parent 56fe715c08
commit 5ebbd1280a
5 changed files with 49 additions and 18 deletions
+26 -1
View File
@@ -500,9 +500,34 @@ namespace SCMA.AdapterPLC.CMS
// leggo e salvo allarmi ALM, TUTTI!!!
byte[] tabDatiAlarm = new byte[1024];
// calcolo limite x non copiare oltre livello allarmi disponibili...
int nByteAlarm = currGateway.AlarmFlags.Length;
for (int i = 0; i < 32; i++)
{
Buffer.BlockCopy(BitConverter.GetBytes(ncDevice.SCMA_MMan_ALM.data[i]), 0, currGateway.AlarmFlags, i * 4, 4);
if ((i+1) * 4 > nByteAlarm)
{
// copio un subset di byte
int nByte = nByteAlarm - (i* 4);
try
{
Buffer.BlockCopy(BitConverter.GetBytes(ncDevice.SCMA_MMan_ALM.data[i]), 0, currGateway.AlarmFlags, i * 4, nByte);
}
catch (Exception exc)
{ }
// esco
break;
}
else
{
// copio 4 byte
try
{
Buffer.BlockCopy(BitConverter.GetBytes(ncDevice.SCMA_MMan_ALM.data[i]), 0, currGateway.AlarmFlags, i * 4, 4);
}
catch (Exception exc)
{ }
}
}
// leggo e salvo Counters CNT
+9 -6
View File
@@ -4159,13 +4159,16 @@ namespace SCMA.AdapterPLC
{
if (_maintDataMaxNum == 0)
{
// prima stima
int idx = maintData.Length;
// ora ciclo...
foreach (var item in maintData)
if (maintData != null)
{
int.TryParse(item.codNum, out idx);
_maintDataMaxNum = idx > _maintDataMaxNum ? idx : _maintDataMaxNum;
// prima stima
int idx = maintData.Length;
// ora ciclo...
foreach (var item in maintData)
{
int.TryParse(item.codNum, out idx);
_maintDataMaxNum = idx > _maintDataMaxNum ? idx : _maintDataMaxNum;
}
}
}
return _maintDataMaxNum;
+13 -10
View File
@@ -212,7 +212,10 @@
<EmbeddedResource Include="SetupAdapter.resx">
<DependentUpon>SetupAdapter.cs</DependentUpon>
</EmbeddedResource>
<None Include="App.CMS-ESA.config" />
<None Include="App.CMS-ESA.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="DATA\CONF\NameRepRolesList.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -253,11 +256,11 @@
<Content Include="Readme\Analisi tempi.txt" />
<None Include="App.CMS-OSAI.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="App.CMS-SIEMENS.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="DATA\CONF\AlarmListCNC.map">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -267,12 +270,12 @@
</None>
<None Include="App.CMS-FANUC.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="App.SCM-ESA.config">
<DependentUpon>App.config</DependentUpon>
<SubType>Designer</SubType>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="DATA\CmsGeneralStatus.mtc" />
<None Include="DATA\CONF\EsaKvara.ini">
@@ -343,11 +346,11 @@
</Content>
<None Include="App.Debug.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="App.Release.config">
<DependentUpon>App.config</DependentUpon>
<IsTransformFile>True</IsTransformFile>
<IsTransformFile>true</IsTransformFile>
</None>
<None Include="Resources\SCM\app.msg" />
<None Include="Resources\SCM\convertScmAlarm.ps1" />
@@ -432,7 +435,7 @@
<Target Name="AfterBuild">
</Target>
-->
<!-- <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" /> -->
<UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterCompile" Condition="Exists('App.$(Configuration).config')">
<!--Generate transformed app config in the intermediate directory-->
<TransformXml Source="App.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="App.$(Configuration).config" />
@@ -472,11 +475,11 @@
<SlowCheetahTargets Condition=" '$(SlowCheetah_EnableImportFromNuGet)'=='true' and Exists('$(SlowCheetah_NuGetImportPath)') ">$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
</PropertyGroup>
<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />
<Import Project="..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets" Condition="Exists('..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets')" />
<Import Project="..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SlowCheetah.2.5.48\build\SlowCheetah.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.VisualStudio.SlowCheetah.3.2.26\build\Microsoft.VisualStudio.SlowCheetah.targets'))" />
</Target>
</Project>
+1 -1
View File
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.VisualStudio.SlowCheetah" version="3.2.26" targetFramework="net452" developmentDependency="true" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="NLog" version="4.6.6" targetFramework="net452" />
<package id="NLog.Schema" version="4.6.6" targetFramework="net452" />
<package id="PrettyBin" version="1.1.0" targetFramework="net452" />
<package id="SlowCheetah" version="2.5.48" targetFramework="net452" />
<package id="StackExchange.Redis" version="1.2.6" targetFramework="net452" />
</packages>