change - 初始化引擎时加载Hsl、报警灯模块

master
wenjy 1 year ago
parent 1faaf589c4
commit c29239fef0

@ -102,6 +102,11 @@ namespace MCRun
if (Mesnac.Gui.Common.RunEngine.Instance.Init(projectPath, true, true, true)) //初始化运行引擎 if (Mesnac.Gui.Common.RunEngine.Instance.Init(projectPath, true, true, true)) //初始化运行引擎
{ {
AppConfigHandler.Instance.InitCustomerMenuAndToolStrip(WorkbenchSingleton.Workbench.TopMenu, WorkbenchSingleton.Workbench.ToolStrip); //初始化自定义系统菜单和工具栏 AppConfigHandler.Instance.InitCustomerMenuAndToolStrip(WorkbenchSingleton.Workbench.TopMenu, WorkbenchSingleton.Workbench.ToolStrip); //初始化自定义系统菜单和工具栏
//初始化HslCommunication 11.0.6.0
PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc, "127.0.0.1", 12);
//初始化连接报警器
DoControl.Instance.ComOn();
} }
//if (!Mesnac.Basic.InfluxDbHelper.Instance.IsStartDbServer) //if (!Mesnac.Basic.InfluxDbHelper.Instance.IsStartDbServer)
@ -120,9 +125,6 @@ namespace MCRun
}; };
WorkbenchSingleton.InitializeWorkbench(); WorkbenchSingleton.InitializeWorkbench();
PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc, "127.0.0.1", 12);
DoControl.Instance.ComOn();
ICSharpCode.Core.LoggingService<Program>.Debug("starting workbench..."); ICSharpCode.Core.LoggingService<Program>.Debug("starting workbench...");
Form frmMain = WorkbenchSingleton.Workbench as Form; Form frmMain = WorkbenchSingleton.Workbench as Form;

@ -37,10 +37,17 @@ namespace Mesnac.DoUtils
/// 串口启动 /// 串口启动
/// </summary> /// </summary>
public void ComOn() public void ComOn()
{
try
{ {
if (!serialPort.IsOpen) if (!serialPort.IsOpen)
{ {
serialPort.Open(); serialPort.Open();
ICSharpCode.Core.LoggingService<DoControl>.Debug($"打开报警器串口成功,串口:{serialPort.PortName};波特率:{serialPort.BaudRate}");
}
}catch (Exception ex)
{
ICSharpCode.Core.LoggingService<DoControl>.Error($"报警器串口打开异常,串口:{serialPort.PortName};波特率:{serialPort.BaudRate};异常信息:{ex.Message}");
} }
} }
/// <summary> /// <summary>

@ -34,6 +34,12 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ICSharpCode.Core">
<HintPath>Z:\Desktop\日常代码\榄菊项目\程序设计\lj_plc\PlugInPlatform\ICSharpCode.Core.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.Data.Core">
<HintPath>Z:\Desktop\日常代码\榄菊项目\程序设计\lj_plc\PlugInPlatform\ICSharpCode.Data.Core.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" />

@ -9,7 +9,7 @@ using System.Threading.Tasks;
namespace Mesnac.PlcUtils.Impl namespace Mesnac.PlcUtils.Impl
{ {
public class OmronNJPlc public class OmronNJPlc:IPlc
{ {
private StringChange stringChange = StringChange.Instance; private StringChange stringChange = StringChange.Instance;

Loading…
Cancel
Save