using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows;
|
using System.Windows.Controls;
|
using System.Windows.Data;
|
using System.Windows.Documents;
|
using System.Windows.Input;
|
using System.Windows.Markup;
|
using System.Windows.Media;
|
using System.Windows.Media.Imaging;
|
using System.Windows.Navigation;
|
using System.Windows.Shapes;
|
using System.Runtime.Serialization;
|
using System.Collections.Concurrent;
|
using System.ServiceModel;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using System.Net;
|
using NLog;
|
using NLog.Config;
|
using NLog.Targets;
|
using GZ.DB.Map.OIDATABASE;
|
using GZ.DB.App.OIDATABASE;
|
using GZ.DB.Repository.OIDATABASE;
|
using GZ.DB.IRepository.OIDATABASE;
|
using GZ.DB.Entity.OIDATABASE;
|
namespace GZ.Projects.S7
|
{
|
#region 设备通信
|
/// <summary>
|
/// 设备通信
|
/// </summary>
|
public class Device
|
{
|
public GZ.Device.PLC.PlcBase PLC1=null;
|
public GZ.Device.PLC.PlcBase 西门子2=null;
|
public GZ.Device.PLC.PlcBase wxwp=null;
|
public GZ.Device.PLC.PlcBase wxrp=null;
|
public GZ.Device.PLC.PlcBase warp=null;
|
public GZ.Device.PLC.PlcBase ssx2xPlcRead=null;
|
public GZ.Device.PLC.PlcBase ssx1xPlcRead=null;
|
public GZ.Device.PLC.PlcBase ssx3xPlcRead=null;
|
public GZ.Device.PLC.PlcBase 维希尔抓臂1=null;
|
public GZ.Device.PLC.PlcBase 维希尔抓臂2=null;
|
public GZ.Device.PLC.PlcBase 捷瞬抓臂1=null;
|
public GZ.Device.PLC.PlcBase 捷瞬抓臂2=null;
|
public GZ.Device.PLC.PlcBase PLC3=null;
|
public GZ.Device.PLC.PlcBase PLC4=null;
|
public Device()
|
{
|
PLC1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC1"),
|
null
|
);
|
西门子2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "西门子2"),
|
null
|
);
|
wxwp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "wxwp"),
|
null
|
);
|
wxrp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "wxrp"),
|
null
|
);
|
warp = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "warp"),
|
null
|
);
|
ssx2xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx2xPlcRead"),
|
null
|
);
|
ssx1xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx1xPlcRead"),
|
null
|
);
|
ssx3xPlcRead = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "ssx3xPlcRead"),
|
null
|
);
|
维希尔抓臂1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "维希尔抓臂1"),
|
null
|
);
|
维希尔抓臂2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "维希尔抓臂2"),
|
null
|
);
|
捷瞬抓臂1 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "捷瞬抓臂1"),
|
null
|
);
|
捷瞬抓臂2 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "捷瞬抓臂2"),
|
null
|
);
|
PLC3 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC3"),
|
null
|
);
|
PLC4 = GZ.Device.PLC.PlcFactory.CreateInstanceByFile
|
(
|
System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Configs", "PLC4"),
|
null
|
);
|
if(System.Configuration.ConfigurationManager.AppSettings["AutoRunPLC"]=="1")
|
{
|
if(PLC1!=null){PLC1.Run();}
|
if(西门子2!=null){西门子2.Run();}
|
if(wxwp!=null){wxwp.Run();}
|
if(wxrp!=null){wxrp.Run();}
|
if(warp!=null){warp.Run();}
|
if(ssx2xPlcRead!=null){ssx2xPlcRead.Run();}
|
if(ssx1xPlcRead!=null){ssx1xPlcRead.Run();}
|
if(ssx3xPlcRead!=null){ssx3xPlcRead.Run();}
|
if(维希尔抓臂1!=null){维希尔抓臂1.Run();}
|
if(维希尔抓臂2!=null){维希尔抓臂2.Run();}
|
if(捷瞬抓臂1!=null){捷瞬抓臂1.Run();}
|
if(捷瞬抓臂2!=null){捷瞬抓臂2.Run();}
|
if(PLC3!=null){PLC3.Run();}
|
if(PLC4!=null){PLC4.Run();}
|
}
|
}
|
}
|
#endregion
|
|
#region 简单PLC
|
|
/// <summary>
|
/// PLC变量组
|
/// </summary>
|
public class EasyPLC
|
{
|
#region PLC1
|
public _PLC1 PLC1 = new _PLC1();
|
/// <summary>
|
/// xxx
|
/// </summary>
|
public class _PLC1
|
{
|
public _Group1 Group1 = new _Group1();
|
/// <summary>
|
///
|
/// </summary>
|
public class _Group1
|
{
|
public string Param2 = "";
|
public string Param3 = "";
|
|
public bool Write()
|
{
|
return true;
|
}
|
}
|
public _Group2 Group2 = new _Group2();
|
/// <summary>
|
///
|
/// </summary>
|
public class _Group2
|
{
|
public string Param4 = "";
|
public string Param5 = "";
|
|
public bool Write()
|
{
|
return true;
|
}
|
}
|
}
|
#endregion
|
|
#region 西门子2
|
public _西门子2 西门子2 = new _西门子2();
|
/// <summary>
|
///
|
/// </summary>
|
public class _西门子2
|
{
|
}
|
#endregion
|
|
#region wxwp
|
public _wxwp wxwp = new _wxwp();
|
/// <summary>
|
/// wcs write plc
|
/// </summary>
|
public class _wxwp
|
{
|
}
|
#endregion
|
|
#region wxrp
|
public _wxrp wxrp = new _wxrp();
|
/// <summary>
|
/// wcs read plc
|
/// </summary>
|
public class _wxrp
|
{
|
}
|
#endregion
|
|
#region warp
|
public _warp warp = new _warp();
|
/// <summary>
|
/// wcs read turn agv
|
/// </summary>
|
public class _warp
|
{
|
}
|
#endregion
|
|
#region ssx2xPlcRead
|
public _ssx2xPlcRead ssx2xPlcRead = new _ssx2xPlcRead();
|
/// <summary>
|
/// 出烤箱区
|
/// </summary>
|
public class _ssx2xPlcRead
|
{
|
}
|
#endregion
|
|
#region ssx1xPlcRead
|
public _ssx1xPlcRead ssx1xPlcRead = new _ssx1xPlcRead();
|
/// <summary>
|
/// 进烤区
|
/// </summary>
|
public class _ssx1xPlcRead
|
{
|
}
|
#endregion
|
|
#region ssx3xPlcRead
|
public _ssx3xPlcRead ssx3xPlcRead = new _ssx3xPlcRead();
|
/// <summary>
|
/// 部件区
|
/// </summary>
|
public class _ssx3xPlcRead
|
{
|
}
|
#endregion
|
|
#region 维希尔抓臂1
|
public _维希尔抓臂1 维希尔抓臂1 = new _维希尔抓臂1();
|
/// <summary>
|
///
|
/// </summary>
|
public class _维希尔抓臂1
|
{
|
}
|
#endregion
|
|
#region 维希尔抓臂2
|
public _维希尔抓臂2 维希尔抓臂2 = new _维希尔抓臂2();
|
/// <summary>
|
///
|
/// </summary>
|
public class _维希尔抓臂2
|
{
|
}
|
#endregion
|
|
#region 捷瞬抓臂1
|
public _捷瞬抓臂1 捷瞬抓臂1 = new _捷瞬抓臂1();
|
/// <summary>
|
///
|
/// </summary>
|
public class _捷瞬抓臂1
|
{
|
}
|
#endregion
|
|
#region 捷瞬抓臂2
|
public _捷瞬抓臂2 捷瞬抓臂2 = new _捷瞬抓臂2();
|
/// <summary>
|
///
|
/// </summary>
|
public class _捷瞬抓臂2
|
{
|
}
|
#endregion
|
|
#region PLC3
|
public _PLC3 PLC3 = new _PLC3();
|
/// <summary>
|
///
|
/// </summary>
|
public class _PLC3
|
{
|
}
|
#endregion
|
|
#region PLC4
|
public _PLC4 PLC4 = new _PLC4();
|
/// <summary>
|
///
|
/// </summary>
|
public class _PLC4
|
{
|
}
|
#endregion
|
|
}
|
|
#endregion
|
}
|