林豪 左 il y a 3 ans
Parent
commit
f7fdfefa47

BIN
DLL/PLC.Siemens.dll


+ 12 - 14
Projects/永冠OPP/WCS.Service/PLCAccessors/SiemensS7PLC.cs

@@ -1,22 +1,19 @@
 using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+using HslCommunication.Profinet.Siemens;
 using WCS.Core;
-using WCS.Entity;
-using HslCommunication.Profinet.Siemens; 
 
 namespace WCS.Service.PLCAccessors
-{ 
+{
     public class SiemensS7PLC : IPLCAccessor
-    { 
-        PLC.Siemens.O.SimenssPlc plc;
-        public SiemensS7PLC(string ip,int port,int rack,int slot)
+    {
+        private PLC.Siemens.O.SimenssPlc plc;
+
+        public SiemensS7PLC(string ip, int port, int rack, int slot)
         {
             plc = new PLC.Siemens.O.SimenssPlc(ip, rack, slot);
-            plc.Connect();          
+            plc.Connect();
         }
+
         public byte[] ReadBytes(ushort db, ushort address, ushort length)
         {
             if (!plc.Connected)
@@ -39,15 +36,16 @@ namespace WCS.Service.PLCAccessors
 
     public class SiemensS7PLCHsl : IPLCAccessor
     {
-        SiemensS7Net plc;
+        private SiemensS7Net plc;
+
         public SiemensS7PLCHsl(string ip)
         {
             plc = new SiemensS7Net(SiemensPLCS.S1500, ip);
             plc.ConnectTimeOut = 3000;
             //plc.ReceiveTimeOut = 500;
             plc.ConnectServer();
-
         }
+
         public byte[] ReadBytes(ushort db, ushort address, ushort length)
         {
             var addr = "DB" + db + "." + address;
@@ -65,4 +63,4 @@ namespace WCS.Service.PLCAccessors
                 throw new Exception("写入PLC数据失败:" + res.Message);
         }
     }
-}
+}

+ 7 - 5
Projects/永冠OPP/WCS.Service/WCS.Service.csproj

@@ -35,19 +35,21 @@
   <ItemGroup>
     <ProjectReference Include="..\..\..\DBHelper\DBHelper.csproj" />
     <ProjectReference Include="..\..\..\Logs\Logs.csproj" />
-    <ProjectReference Include="..\..\..\PLC.Siemens\PLC.Siemens.csproj" />
     <ProjectReference Include="..\..\..\WCS.Core\WCS.Core.csproj" />
     <ProjectReference Include="..\..\..\WCS.Entity\WCS.Entity.csproj" />
     <ProjectReference Include="..\WCS.Entity.Protocol\WCS.Entity.Protocol.csproj" />
   </ItemGroup>
 
   <ItemGroup>
-    <Reference Include="PLCConnecter">
-      <HintPath>DLL\PLCConnecter.dll</HintPath>
-    </Reference>
+    <Folder Include="Log\" />
   </ItemGroup>
 
   <ItemGroup>
-    <Folder Include="Log\" />
+    <Reference Include="PLC.Siemens">
+      <HintPath>..\..\..\PLC.Siemens\bin\Debug\PLC.Siemens.dll</HintPath>
+    </Reference>
+    <Reference Include="PLCConnecter">
+      <HintPath>..\..\..\DLL\PLCConnecter.dll</HintPath>
+    </Reference>
   </ItemGroup>
 </Project>

+ 7 - 7
WCS Pedestal.sln

@@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DBHelper", "DBHelper\DBHelp
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WCS.DebugTool", "WCS.DebugTool\WCS.DebugTool.csproj", "{6E83138E-F92B-40FB-BEB4-F5E02383B823}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PLC.Siemens", "PLC.Siemens\PLC.Siemens.csproj", "{8F6C4A79-98EA-4019-B72A-29290328185A}"
-EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.Entity", "WCS.Entity\WCS.Entity.csproj", "{15418D7B-CA4F-4FE3-8179-E7D84FF9C167}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.Entity.Protocol", "Projects\永冠OPP\WCS.Entity.Protocol\WCS.Entity.Protocol.csproj", "{B5BA1EC4-EAA5-4003-B687-3159FB02E636}"
@@ -30,6 +28,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WCS.Service", "Projects\永
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Logs", "Logs\Logs.csproj", "{31B6E0FC-524C-4B52-9088-6EA4690E6B36}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PLC.Siemens", "PLC.Siemens\PLC.Siemens.csproj", "{8F6C4A79-98EA-4019-B72A-29290328185A}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -48,10 +48,6 @@ Global
 		{6E83138E-F92B-40FB-BEB4-F5E02383B823}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{6E83138E-F92B-40FB-BEB4-F5E02383B823}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{6E83138E-F92B-40FB-BEB4-F5E02383B823}.Release|Any CPU.Build.0 = Release|Any CPU
-		{8F6C4A79-98EA-4019-B72A-29290328185A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{8F6C4A79-98EA-4019-B72A-29290328185A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{8F6C4A79-98EA-4019-B72A-29290328185A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{8F6C4A79-98EA-4019-B72A-29290328185A}.Release|Any CPU.Build.0 = Release|Any CPU
 		{15418D7B-CA4F-4FE3-8179-E7D84FF9C167}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{15418D7B-CA4F-4FE3-8179-E7D84FF9C167}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{15418D7B-CA4F-4FE3-8179-E7D84FF9C167}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -68,6 +64,10 @@ Global
 		{31B6E0FC-524C-4B52-9088-6EA4690E6B36}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{31B6E0FC-524C-4B52-9088-6EA4690E6B36}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{31B6E0FC-524C-4B52-9088-6EA4690E6B36}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8F6C4A79-98EA-4019-B72A-29290328185A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8F6C4A79-98EA-4019-B72A-29290328185A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8F6C4A79-98EA-4019-B72A-29290328185A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8F6C4A79-98EA-4019-B72A-29290328185A}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -76,12 +76,12 @@ Global
 		{609C1A57-7CFF-4BC1-B0C6-DA679C530D43} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
 		{6658427B-CB28-4F30-94D7-54541EB7D7FC} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
 		{6E83138E-F92B-40FB-BEB4-F5E02383B823} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
-		{8F6C4A79-98EA-4019-B72A-29290328185A} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
 		{15418D7B-CA4F-4FE3-8179-E7D84FF9C167} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
 		{B5BA1EC4-EAA5-4003-B687-3159FB02E636} = {37B86E98-86D4-41C0-A380-F56DD9431EFF}
 		{37B86E98-86D4-41C0-A380-F56DD9431EFF} = {B500324F-34BF-4A32-ACDF-F1D4F3DE0889}
 		{0C1638C8-68C1-4493-A731-186E58CEC4F0} = {37B86E98-86D4-41C0-A380-F56DD9431EFF}
 		{31B6E0FC-524C-4B52-9088-6EA4690E6B36} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
+		{8F6C4A79-98EA-4019-B72A-29290328185A} = {2C6BCFE4-581D-4BC8-91EC-BD9FA91B9605}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {75D30B04-ADD6-4FC6-8D7E-FAD45B731BB4}