using HighWayIot.Config; using HighWayIot.Plc; using System; namespace Aucma.Scada.Business { public class MainBusiness { private static readonly Lazy lazy = new Lazy(() => new MainBusiness()); public static MainBusiness Instance { get { return lazy.Value; } } private AppConfig appConfig = AppConfig.Instance; private PlcConfig plcConfig = PlcConfig.Instance; private PlcPool plcPool = PlcPool.Instance; private MainBusiness() { //初始化扫码器 //初始化货道信息,保证系统内的库存信息与实物一致 } /// /// 初始化PLC /// public void InitPlc() { //初始化Plc plcPool.InitPlc("MelsecBinaryPlc", plcConfig.shell_Plc_Ip, plcConfig.shell_Plc_Port, appConfig.shellStoreCode); plcPool.InitPlc("MelsecBinaryPlc", plcConfig.liner_Plc_Ip, plcConfig.liner_Plc_Port, appConfig.linerStoreCode); } /// /// 关闭PLC /// public void DisConnectPlc() { plcPool.disConnectAll(); } } }