Fix scada

WIP upload tool from NC
This commit is contained in:
Lucio Maranta
2019-05-13 17:19:14 +02:00
parent 240f27bb76
commit 3a386849a3
9 changed files with 74 additions and 55 deletions
-9
View File
@@ -109,15 +109,6 @@
<Reference Include="ChromiumWebBrowser">
<HintPath>..\Client.Chromium\ChromiumWebBrowser.dll</HintPath>
</Reference>
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
</Reference>
<Reference Include="MetroFramework.Design, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Design.dll</HintPath>
</Reference>
<Reference Include="MetroFramework.Fonts, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
</Reference>
-1
View File
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
Binary file not shown.
+8 -14
View File
@@ -88,12 +88,12 @@
<xs:element name="size" type="xyType" minOccurs='1' maxOccurs='1'/>
<xs:element name="status" minOccurs='1' maxOccurs='1'>
<xs:complexType>
<xs:all>
<xs:element name="negate" type="xs:boolean" minOccurs='1' maxOccurs='1'/>
<xs:element name="clickEnabled" type="xs:boolean" minOccurs='1' maxOccurs='1'/>
<xs:all>
<xs:element name="memClickIndex" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="memVisibleIndex" type="xs:string" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:all>
<xs:attribute name="negate" type="xs:boolean"/>
<xs:attribute name="clickEnabled" type="xs:boolean"/>
</xs:complexType>
</xs:element>
</xs:all>
@@ -130,20 +130,17 @@
<xs:element name="action" type="inputAction" minOccurs='1' maxOccurs='1'/>
<xs:element name="memEnabledIndex" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="memValueIndex" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="round" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="round" type="xs:int" minOccurs='0' maxOccurs='1'/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
<!-- XY type -->
<xs:complexType name="xyType">
<xs:all>
<xs:element name="x" type="xs:int" minOccurs='1' maxOccurs='1'/>
<xs:element name="y" type="xs:int" minOccurs='1' maxOccurs='1'/>
</xs:all>
<xs:attribute name="x" type="xs:int" use="required"/>
<xs:attribute name="y" type="xs:int" use="required"/>
</xs:complexType>
<!-- subLabel type -->
@@ -152,14 +149,11 @@
<xs:element name="backgroundColor" type="hexcolorType" minOccurs='1' maxOccurs='1'/>
<xs:element name="textAlign" type="alignType" minOccurs='1' maxOccurs='1'/>
<xs:element name="textColor" type="hexcolorType" minOccurs='1' maxOccurs='1'/>
<xs:element name="textContent" type="xs:string" minOccurs='1' maxOccurs='1'/>
<xs:element name="textContent" type="xs:string" minOccurs='0' maxOccurs='1'/>
<xs:element name="textSize" type="xs:int" minOccurs='1' maxOccurs='1'/>
</xs:all>
</xs:complexType>
<!-- inputAction simpleType -->
<xs:simpleType name="inputAction" final="restriction" >
<xs:restriction base="xs:string">
+54 -25
View File
@@ -1037,37 +1037,66 @@ namespace Step.NC
});
}
if (layer.Inputs.ElementAtOrDefault(i) != null && layer.Inputs[i].Status.Action.ToLower() == "read")
if (layer.Inputs.ElementAtOrDefault(i) != null)
{
// Read isVisible from PLC
//cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val);
//if (cmsError.IsError())
// return cmsError;
SCADA_MEM_TYPE type = SupportFunctions.GetMemTypeFromString(layer.Inputs[i].Status.Type);
// Read value from PLC
cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2);
if (cmsError.IsError())
return cmsError;
// if type is real approximate to configurated decimal digits
if (type == SCADA_MEM_TYPE.REAL)
if (layer.Inputs.ElementAtOrDefault(i) != null && layer.Inputs[i].Status.Action.ToLower() == "read")
{
double tmpVal = Math.Round(Convert.ToDouble(val2), layer.Inputs[i].Status.Round);
val2 = tmpVal;
}
// Read isVisible from PLC
//cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val);
//if (cmsError.IsError())
// return cmsError;
// Populate & add new object into scada model
scadaValue.Inputs.Add(new DTOScadaInputModel()
{
Id = layer.Inputs[i].Id,
Value = new DTOScadaValueModel()
SCADA_MEM_TYPE type = SupportFunctions.GetMemTypeFromString(layer.Inputs[i].Status.Type);
// Read value from PLC
cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2);
if (cmsError.IsError())
return cmsError;
// if type is real approximate to configurated decimal digits
if (type == SCADA_MEM_TYPE.REAL)
{
IsEnabled = false, //Convert.ToBoolean(val),
Value = val2
double tmpVal = Math.Round(Convert.ToDouble(val2), layer.Inputs[i].Status.Round);
val2 = tmpVal;
}
});
// Populate & add new object into scada model
scadaValue.Inputs.Add(new DTOScadaInputModel()
{
Id = layer.Inputs[i].Id,
Value = new DTOScadaValueModel()
{
IsEnabled = false, //Convert.ToBoolean(val),
Value = val2
}
});
}
else
{
// Read isVisible from PLC
cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val);
if (cmsError.IsError())
return cmsError;
SCADA_MEM_TYPE type = SupportFunctions.GetMemTypeFromString(layer.Inputs[i].Status.Type);
// Read value from PLC
cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2);
if (cmsError.IsError())
return cmsError;
// Populate & add new object into scada model
scadaValue.Inputs.Add(new DTOScadaInputModel()
{
Id = layer.Inputs[i].Id,
Value = new DTOScadaValueModel()
{
IsEnabled = Convert.ToBoolean(val), //Convert.ToBoolean(val),
Value = val2
}
});
}
}
}
}
+1 -1
View File
@@ -102,7 +102,7 @@
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="app.config" />
<None Include="readme.md" />
</ItemGroup>
<ItemGroup>
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.10.4.0" newVersion="6.10.4.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net462" />
</packages>
-1
View File
@@ -2,7 +2,6 @@
<packages>
<package id="EntityFramework" version="6.2.0" targetFramework="net462" />
<package id="jQuery" version="3.2.1" targetFramework="net462" />
<package id="MetroModernUI" version="1.4.0.0" targetFramework="net462" />
<package id="Microsoft.AspNet.Cors" version="5.2.3" targetFramework="net462" />
<package id="Microsoft.AspNet.Razor" version="2.0.20505.0" targetFramework="net462" />
<package id="Microsoft.AspNet.SignalR" version="2.2.2" targetFramework="net462" />