1
0
Fork 0

fix - 小优化

master
SoulStar 4 weeks ago
parent 3f6ff46246
commit 54f4c75834

@ -32,10 +32,6 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="HslCommunication, Version=12.1.3.0, Culture=neutral, PublicKeyToken=3d72ad3b6b5ec0e3, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\HighWayIot.Library\HslCommunication.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -63,5 +59,8 @@
<ItemGroup> <ItemGroup>
<Folder Include="Impl\" /> <Folder Include="Impl\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

@ -38,10 +38,6 @@ namespace HighWayIot.Plc
}; };
var a = plc.ConnectServer(); var a = plc.ConnectServer();
logHelper.Info($"Plc连接 信息:[{a.Message}] 是否成功:[{a.IsSuccess.ToString()}] 错误代码:[{a.ErrorCode}]"); logHelper.Info($"Plc连接 信息:[{a.Message}] 是否成功:[{a.IsSuccess.ToString()}] 错误代码:[{a.ErrorCode}]");
if (!reslt.IsSuccess)
{
logHelper.Info("链接失败:"+reslt.Message);
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -54,22 +50,23 @@ namespace HighWayIot.Plc
return plc; return plc;
} }
///// <summary> /// <summary>
///// plc 是不是保持链接 /// plc 是不是保持链接
///// </summary> /// </summary>
//public static bool IsConnect public static bool IsConnect
//{ {
// get get
// { {
// if (MelsecInstance == null) return false; if (MelsecInstance == null) return false;
// var result = MelsecInstance.ReadPlcType(); var result = MelsecInstance.ReadPlcType();
// logHelper.Info($"PLC型号{result.Content}"); logHelper.Info($"PLC型号 信息:[{result.Message}] 内容:[{result.Message}]");
// return result.IsSuccess; return result.IsSuccess;
// } }
//} }
public static int Test() public static int Test()
{ {
var s = IsConnect;
return MelsecInstance.ReadInt16("D1").Content; return MelsecInstance.ReadInt16("D1").Content;
} }

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HslCommunication" version="12.1.3" targetFramework="net48" />
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
</packages>

@ -3,4 +3,16 @@
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup> </startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Oracle.ManagedDataAccess" publicKeyToken="89b483f429c47342" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.122.21.1" newVersion="4.122.21.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> </configuration>

@ -312,10 +312,5 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="HslCommunication">
<Version>12.1.3</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>
Loading…
Cancel
Save