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)) //初始化运行引擎
{
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)
@ -120,9 +125,6 @@ namespace MCRun
};
WorkbenchSingleton.InitializeWorkbench();
PlcBusiness.Instance.InitPlcConnect(PlcType.SiemensPlc, "127.0.0.1", 12);
DoControl.Instance.ComOn();
ICSharpCode.Core.LoggingService<Program>.Debug("starting workbench...");
Form frmMain = WorkbenchSingleton.Workbench as Form;

@ -38,9 +38,16 @@ namespace Mesnac.DoUtils
/// </summary>
public void ComOn()
{
if (!serialPort.IsOpen)
try
{
serialPort.Open();
if (!serialPort.IsOpen)
{
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>

@ -34,6 +34,12 @@
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
</PropertyGroup>
<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.Core" />
<Reference Include="System.Xml.Linq" />

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

Loading…
Cancel
Save