You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
1.6 KiB
C#
75 lines
1.6 KiB
C#
using Aucma.Core.Scanner;
|
|
using Aucma.Scada.HikRobot;
|
|
using HighWayIot.Config;
|
|
using HighWayIot.Log4net;
|
|
using HighWayIot.Plc;
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Aucma.Scada.Business
|
|
{
|
|
public sealed class MainBusiness
|
|
{
|
|
#region 单例实现
|
|
private static readonly Lazy<MainBusiness> lazy = new Lazy<MainBusiness>(() => new MainBusiness());
|
|
|
|
public static MainBusiness Instance
|
|
{
|
|
get
|
|
{
|
|
return lazy.Value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 对象引用
|
|
private AppConfig appConfig = AppConfig.Instance;
|
|
|
|
private PlcConfig plcConfig = PlcConfig.Instance;
|
|
|
|
private PlcPool plcPool = PlcPool.Instance;
|
|
|
|
#endregion
|
|
|
|
private MainBusiness()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化PLC
|
|
/// </summary>
|
|
public void InitPlc()
|
|
{
|
|
//初始化Plc
|
|
plcPool.InitPlc("MelsecBinaryPlc", plcConfig.foam_Plc_Ip, plcConfig.foam_Plc_Port, appConfig.foamStoreCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 关闭PLC
|
|
/// </summary>
|
|
public void DisConnectPlc()
|
|
{
|
|
plcPool.disConnectAll();
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 关闭海康扫码器
|
|
/// </summary>
|
|
public void ExitHikRobot()
|
|
{
|
|
try
|
|
{
|
|
// MvCodeHelper.CloseAllDevice();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|