Commit c733aa7c LN

io模块更新

1 个父辈 8a531401
...@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Com ...@@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "source\Common\Com
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeviceLibrary", "source\DeviceLibrary\DeviceLibrary.csproj", "{513BC1C9-800D-43A6-9499-3700BAEC3554}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UserFromControl", "source\UserFromControl\UserFromControl.csproj", "{F018462A-D9BC-4365-97F2-F6D71751641E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoadCSVLibrary", "source\LoadCVSLibrary\LoadCSVLibrary.csproj", "{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DUOStore", "source\DUOStore\DUOStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DUOStore", "source\DUOStore\DUOStore.csproj", "{0D2542F5-DD62-4352-82D0-383D9A045E74}"
...@@ -27,10 +25,6 @@ Global ...@@ -27,10 +25,6 @@ Global
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Debug|Any CPU.Build.0 = Debug|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Debug|Any CPU.Build.0 = Debug|Any CPU
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.ActiveCfg = Release|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.ActiveCfg = Release|Any CPU
{513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.Build.0 = Release|Any CPU {513BC1C9-800D-43A6-9499-3700BAEC3554}.Release|Any CPU.Build.0 = Release|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F018462A-D9BC-4365-97F2-F6D71751641E}.Release|Any CPU.Build.0 = Release|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Debug|Any CPU.Build.0 = Debug|Any CPU
{064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU {064BEBF5-8FAA-4EA2-A5F3-A06E6E7D9251}.Release|Any CPU.ActiveCfg = Release|Any CPU
......
此文件类型无法预览
...@@ -83,10 +83,10 @@ ...@@ -83,10 +83,10 @@
<level value="Info" /> <level value="Info" />
<appender-ref ref="AIOBOX" /> <appender-ref ref="AIOBOX" />
</logger> </logger>
<root> <!--<root>
<level value="Info" /> <level value="Info" />
<appender-ref ref="RollingLogFileAppender" /> <appender-ref ref="RollingLogFileAppender" />
</root> </root>-->
</log4net> </log4net>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
......
...@@ -61,6 +61,9 @@ ...@@ -61,6 +61,9 @@
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" /> <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="UserFromControl">
<HintPath>..\..\dll\UserFromControl.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="FormManager.cs" /> <Compile Include="FormManager.cs" />
...@@ -205,16 +208,27 @@ ...@@ -205,16 +208,27 @@
<Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project> <Project>{064bebf5-8faa-4ea2-a5f3-a06e6e7d9251}</Project>
<Name>LoadCSVLibrary</Name> <Name>LoadCSVLibrary</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\UserFromControl\UserFromControl.csproj">
<Project>{f018462a-d9bc-4365-97f2-f6d71751641e}</Project>
<Name>UserFromControl</Name>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="AuToRunManager.exe"> <Content Include="AuToRunManager.exe">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="box.ico" /> <Content Include="box.ico" />
<Content Include="image\gray.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="image\gray1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="image\gray2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="image\green.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="image\green1.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="记录.txt" /> <Content Include="记录.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
...@@ -303,7 +303,7 @@ namespace OnlineStore.DUOStore ...@@ -303,7 +303,7 @@ namespace OnlineStore.DUOStore
//位置配置 //位置配置
string appPath = Application.StartupPath; string appPath = Application.StartupPath;
//如果总配置文件存在,保存到总的配置文件 //如果总配置文件存在,保存到总的配置文件
string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.BOX_ConfigPath); string positionConfigFile = appPath + ConfigAppSettings.GetValue(Setting_Init.Store_Position_Config);
if (!File.Exists(positionConfigFile)) if (!File.Exists(positionConfigFile))
{ {
string nameStr = BoxBean.ID.ToString(); string nameStr = BoxBean.ID.ToString();
......
...@@ -32,6 +32,7 @@ namespace OnlineStore.DUOStore ...@@ -32,6 +32,7 @@ namespace OnlineStore.DUOStore
startTimer.Interval = 1000; startTimer.Interval = 1000;
startTimer.Enabled = false; startTimer.Enabled = false;
startTimer.AutoReset = false; startTimer.AutoReset = false;
Control.CheckForIllegalCrossThreadCalls = false;
} }
......
...@@ -53,7 +53,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -53,7 +53,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("关闭Io模块【" + ioIp + "】出错:", ex); LogUtil.error("关闭Io模块【" + ioIp + "】出错:" + ex.ToString());
} }
AIOMap.Remove(ioIp); AIOMap.Remove(ioIp);
} }
...@@ -74,7 +74,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -74,7 +74,7 @@ namespace OnlineStore.DeviceLibrary
aioBox = new AIOBOX("AIOBOX"); aioBox = new AIOBOX("AIOBOX");
aioBox.SetType(Asa.IOModule.Box_Type.DI, DILength, Asa.IOModule.Box_Type.DO, DOLength); aioBox.SetType(Asa.IOModule.Box_Type.DI, DILength, Asa.IOModule.Box_Type.DO, DOLength);
aioBox.IP = ioIp; aioBox.IP = ioIp;
aioBox.Upload = true; aioBox.Upload = false;
aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ; aioBox.DI_Changed_Event += AioBox_DI_Changed_Event; ;
...@@ -98,13 +98,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -98,13 +98,7 @@ namespace OnlineStore.DeviceLibrary
private DateTime lastLogTime = DateTime.Now; private DateTime lastLogTime = DateTime.Now;
private void AioBox_Log_Out_Event(AIOBOX box, string[] s)
{
foreach (string str in s)
{
LogUtil.AIOLog.Debug("[" + box.IP + "]" + str);
}
}
private void AioBox_DI_Changed_Event(AIOBOX box, Box_Sta[] sta) private void AioBox_DI_Changed_Event(AIOBOX box, Box_Sta[] sta)
{ {
...@@ -114,7 +108,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -114,7 +108,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("AioBox_DI_Changed_Event出错:", ex); LogUtil.error("AioBox_DI_Changed_Event出错:" + ex.ToString());
} }
} }
private void AioBox_DO_Changed_Event(AIOBOX box, Box_Sta[] sta) private void AioBox_DO_Changed_Event(AIOBOX box, Box_Sta[] sta)
...@@ -126,7 +120,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -126,7 +120,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("AioBox_DO_Changed_Event出错:", ex); LogUtil.error("AioBox_DO_Changed_Event出错:" + ex.ToString());
} }
} }
private void UpdateAllDI(string ip, Box_Sta[] sta) private void UpdateAllDI(string ip, Box_Sta[] sta)
...@@ -232,7 +226,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -232,7 +226,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("aio.Close出错:", ex); LogUtil.error("aio.Close出错:" + ex.ToString());
} }
} }
AIOMap.Clear(); AIOMap.Clear();
...@@ -258,7 +252,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -258,7 +252,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:", ex); LogUtil.error("AIO WriteSingleDO [" + ioIp + "] [" + StartAddress + "] 出错啦:" + ex.ToString());
} }
} }
public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds) public override void WriteSingleDO(string ioIp, byte slaveId, ushort StartAddress, IO_VALUE onOff, int mSeconds)
...@@ -282,7 +276,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -282,7 +276,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("**********定时回写入 出错:", ex); LogUtil.error("**********定时回写入 出错:" + ex.ToString());
} }
}; };
mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次; mytimer.AutoReset = false;//设置是否自动重启,即自动执行多次;
...@@ -359,7 +353,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -359,7 +353,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error("GetDOValue [" + ioIP + "] [" + StartAddress + "] 出错:", ex); LogUtil.error("GetDOValue [" + ioIP + "] [" + StartAddress + "] 出错:" + ex.ToString());
} }
return value; return value;
} }
...@@ -398,7 +392,7 @@ namespace OnlineStore.DeviceLibrary ...@@ -398,7 +392,7 @@ namespace OnlineStore.DeviceLibrary
} }
catch (Exception ex) catch (Exception ex)
{ {
LogUtil.error(" 第【" + i + "】次 GetDIValue [" + ioIP + "] [" + StartAddress + "] 出错:", ex); LogUtil.error(" 第【" + i + "】次 GetDIValue [" + ioIP + "] [" + StartAddress + "] 出错:" + ex.ToString());
} }
} }
return value; return value;
...@@ -446,17 +440,5 @@ namespace OnlineStore.DeviceLibrary ...@@ -446,17 +440,5 @@ namespace OnlineStore.DeviceLibrary
return aioBox; return aioBox;
} }
public override bool IsConnect(string ip)
{
if (AIOMap.ContainsKey(ip))
{
if (AIOMap[ip].IsConn)
{
return true;
}
return false;
}
return false;
}
} }
} }
...@@ -16,7 +16,6 @@ namespace OnlineStore.DeviceLibrary ...@@ -16,7 +16,6 @@ namespace OnlineStore.DeviceLibrary
#region KNDIO #region KNDIO
public static void IOMove(string ioType, IO_VALUE ioValue, int subType = 0) public static void IOMove(string ioType, IO_VALUE ioValue, int subType = 0)
{ {
ConfigIO configIo = GetDO(ioType, subType); ConfigIO configIo = GetDO(ioType, subType);
...@@ -158,15 +157,19 @@ namespace OnlineStore.DeviceLibrary ...@@ -158,15 +157,19 @@ namespace OnlineStore.DeviceLibrary
public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value); public abstract void WriteSingleDO(string deviceName, byte slaveId, ushort index, IO_VALUE value);
public abstract IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort v); public abstract IO_VALUE GetDIValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetDOValue(string deviceName, byte slaveID, ushort v); public abstract IO_VALUE GetDOValue(string deviceName, byte slaveID, ushort v);
public abstract IO_VALUE GetIOValue(ConfigIO configIO); public abstract IO_VALUE GetIOValue(ConfigIO configIO);
public abstract void CloseAllDO(); public abstract void CloseAllDO();
public abstract void CloseAllConnection(); public abstract void CloseAllConnection();
public abstract bool IsConnect(string ip);
} }
} }
...@@ -172,6 +172,8 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -172,6 +172,8 @@ namespace OnlineStore.LoadCSVLibrary
public static bool SavePostion(string filePath, T position) public static bool SavePostion(string filePath, T position)
{ {
try
{
Type type = typeof(T); Type type = typeof(T);
string tName = GetTName(); string tName = GetTName();
Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T)); Dictionary<string, string> proTitleMap = getProAttributeMap(typeof(T));
...@@ -220,6 +222,11 @@ namespace OnlineStore.LoadCSVLibrary ...@@ -220,6 +222,11 @@ namespace OnlineStore.LoadCSVLibrary
} }
index++; index++;
} }
}catch(Exception ex)
{
LogUtil.error("SavePostion [" + filePath + "] 失败");
return false;
}
return true; return true;
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!