You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
410 lines
13 KiB
410 lines
13 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using DBFactory;
|
|
namespace CommonLib
|
|
{
|
|
using System;
|
|
using System.Data;
|
|
using System.ComponentModel;
|
|
/// <summary>
|
|
/// 20110405自定义数据视图变化事件
|
|
/// </summary>
|
|
public class CDataChangeEventArgs : EventArgs
|
|
{
|
|
#region 数据更新事件
|
|
private readonly DataView _manDataSource;
|
|
|
|
public DataView ManDataSource
|
|
{
|
|
get { return _manDataSource; }
|
|
}
|
|
|
|
private readonly DataView _monDataSource;
|
|
|
|
public DataView MonDataSource
|
|
{
|
|
get { return _monDataSource; }
|
|
}
|
|
|
|
public CDataChangeEventArgs(DataView manDataSource,DataView monDataSource)
|
|
{
|
|
this._manDataSource = manDataSource;
|
|
this._monDataSource = monDataSource;
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
public class CDeviceStateChangeEventArgs : EventArgs
|
|
{
|
|
#region 设备状态数据更新事件
|
|
Model.MDevice _devinfo;
|
|
|
|
public Model.MDevice Devinfo
|
|
{
|
|
get { return _devinfo; }
|
|
set { _devinfo = value; }
|
|
}
|
|
|
|
public CDeviceStateChangeEventArgs(Model.MDevice devinfo)
|
|
{
|
|
this._devinfo = devinfo;
|
|
}
|
|
#endregion
|
|
|
|
}
|
|
/// <summary>
|
|
/// 20110608自定义更新数据库的变化事件(执行SQL,报告完成)
|
|
/// </summary>
|
|
public class CUpdateDBChangeEventArgs : EventArgs
|
|
{
|
|
|
|
#region 数据库更新事件(执行SQL,报告完成)
|
|
private readonly int _taskindex=-1;
|
|
|
|
public int Taskindex
|
|
{
|
|
get { return _taskindex; }
|
|
}
|
|
private readonly int _deviceindex = -1;
|
|
|
|
public int Deviceindex
|
|
{
|
|
get { return _deviceindex; }
|
|
}
|
|
|
|
private readonly int _taskstate = -1;
|
|
/// <summary>
|
|
/// 任务执行状态:0空闲,1运行,2动作完成 ,大于30故障
|
|
/// </summary>
|
|
public int Taskstate
|
|
{
|
|
get { return _taskstate; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 光电开关被拆分的字节值
|
|
/// </summary>
|
|
private readonly byte[] _splitbyteValue ;
|
|
/// <summary>
|
|
/// 命令
|
|
/// </summary>
|
|
public byte[] SplitbyteValue
|
|
{
|
|
get { return _splitbyteValue; }
|
|
}
|
|
private readonly DBFactory.DBOperator _dbo;
|
|
|
|
public DBFactory.DBOperator Dbo
|
|
{
|
|
get { return _dbo; }
|
|
}
|
|
|
|
|
|
private readonly byte[] _devicestates;
|
|
public byte[] Devicestates
|
|
{
|
|
get { return _devicestates; }
|
|
}
|
|
private readonly StringBuilder _exeSQL = new StringBuilder();
|
|
public StringBuilder ExeSQL
|
|
{
|
|
get { return _exeSQL; }
|
|
}
|
|
private readonly StringBuilder[] _exeSQLArray;
|
|
public StringBuilder[] ExeSQLArray
|
|
{
|
|
get { return _exeSQLArray; }
|
|
}
|
|
private readonly StringBuilder[] _DBFactoryArray;
|
|
public StringBuilder[] DBFactoryArray
|
|
{
|
|
get { return _DBFactoryArray; }
|
|
}
|
|
private readonly DBFactory.DBOperator[] _dboArray;
|
|
public DBFactory.DBOperator[] DboArray
|
|
{
|
|
get { return _dboArray; }
|
|
}
|
|
/// <summary>
|
|
/// 一个周期内一个订阅组发送所有标签的个数
|
|
|
|
/// <summary>
|
|
/// 每个订阅组里对应设备发送标签名称集合
|
|
/// </summary>
|
|
public StringBuilder[] OPCItemNamesDicInfo { get => _oPCItemNamesDicInfo; set => _oPCItemNamesDicInfo = value; }
|
|
/// <summary>
|
|
/// 每个订阅组里对应设备发送标签数值集合
|
|
/// </summary>
|
|
public StringBuilder[] OPCItemValuesDicInfo { get => _oPCItemValuesDicInfo; set => _oPCItemValuesDicInfo = value; }
|
|
/// <summary>
|
|
/// 加载到内存中的设备返回状态信息集合:key设备号,Value内容:指令索引,状态,申请类型/命令字,条码,检尺高度/数量,重量;
|
|
/// 状态(0空闲;1运行;2完成;30以上故障)
|
|
/// </summary>
|
|
public StringBuilder[]DeviceStateInfos { get => _deviceStateInfos; set => _deviceStateInfos = value; }
|
|
|
|
/// <summary>
|
|
/// 一个周期内一个订阅组发送所有标签的个数
|
|
/// </summary>
|
|
int _opcSubsTagCount ;
|
|
/// <summary>
|
|
/// 每个订阅组里对应设备发送标签名称集合
|
|
/// </summary>
|
|
StringBuilder[] _oPCItemNamesDicInfo ;
|
|
|
|
/// <summary>
|
|
/// 每个订阅组里对应设备发送标签数值集合
|
|
/// </summary>
|
|
StringBuilder[] _oPCItemValuesDicInfo ;
|
|
/// <summary>
|
|
/// 加载到内存中的设备返回状态信息集合:key设备号,Value内容:指令索引,状态,申请类型/命令字,条码,检尺高度/数量,重量;
|
|
/// 状态(0空闲;1运行;2完成;30以上故障)
|
|
/// </summary>
|
|
static StringBuilder[] _deviceStateInfos ;
|
|
|
|
public CUpdateDBChangeEventArgs(DBFactory.DBOperator dbo, StringBuilder exeSQL)
|
|
{
|
|
_dbo = dbo;
|
|
_exeSQL = exeSQL;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="dbFactoryArray">sql语句对应的数据库工厂值:"DBFactory"或者"ManDBFactory"</param>
|
|
/// <param name="exeSQLArray">sql语句数组</param>
|
|
public CUpdateDBChangeEventArgs(StringBuilder[] dbFactoryArray, StringBuilder[] exeSQLArray)
|
|
{
|
|
_DBFactoryArray = dbFactoryArray;
|
|
_exeSQLArray = exeSQLArray;
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="deviceindex">设备索引</param>
|
|
/// <param name="taskindex">设备指令索引</param>
|
|
/// <param name="taskstate">任务执行状态:0空闲,1运行,2动作完成 ,大于30故障</param>
|
|
public CUpdateDBChangeEventArgs(int deviceindex, int taskindex, int taskstate)
|
|
{
|
|
_deviceindex = deviceindex;
|
|
_taskindex = taskindex;
|
|
_taskstate = taskstate;//richard.liu20181205原来一直是taskindex
|
|
}
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="deviceindex">设备索引</param>
|
|
/// <param name="taskindex">设备指令索引</param>
|
|
/// <param name="taskstate">任务执行状态:0空闲,1运行,2动作完成 ,大于30故障</param>
|
|
/// <param name="xCoor">X坐标</param>
|
|
/// <param name="yCoor">Y坐标</param>
|
|
public CUpdateDBChangeEventArgs(int deviceindex,byte[] splitbyteValue,byte[] devicestates)
|
|
{
|
|
|
|
_deviceindex = deviceindex;
|
|
_splitbyteValue = splitbyteValue;
|
|
_devicestates = devicestates;
|
|
}
|
|
|
|
public CUpdateDBChangeEventArgs(int deviceindex, StringBuilder[] deviceStateInfos, StringBuilder[] oPCItemNamesDicInfo, StringBuilder[] oPCItemValuesDicInfo)
|
|
{
|
|
_deviceindex = deviceindex;
|
|
_deviceStateInfos = deviceStateInfos;
|
|
|
|
_oPCItemNamesDicInfo = oPCItemNamesDicInfo;
|
|
_oPCItemValuesDicInfo = oPCItemValuesDicInfo;
|
|
}
|
|
public CUpdateDBChangeEventArgs()//gjn
|
|
{
|
|
}
|
|
#endregion
|
|
}
|
|
public class CStringInfoEventArgs : EventArgs
|
|
{
|
|
|
|
private int _deviceindex;
|
|
|
|
public int Deviceindex
|
|
{
|
|
get { return _deviceindex; }
|
|
set { _deviceindex = value; }
|
|
}
|
|
private string _barcode;
|
|
|
|
public string Barcode
|
|
{
|
|
get { return _barcode; }
|
|
set { _barcode = value; }
|
|
}
|
|
private int _confirm;
|
|
|
|
public int Confirm
|
|
{
|
|
get { return _confirm; }
|
|
set { _confirm = value; }
|
|
}
|
|
public CStringInfoEventArgs(int deviceindex, string barcode, int confirm)
|
|
{
|
|
_deviceindex = deviceindex;
|
|
_barcode = barcode;
|
|
_confirm = confirm;
|
|
}
|
|
}
|
|
public class CWriteDarkCasketEventArgs : EventArgs
|
|
{//20121108
|
|
private string _wrnamespace;
|
|
|
|
public string Wrnamespace
|
|
{
|
|
get { return _wrnamespace; }
|
|
set { _wrnamespace = value; }
|
|
}
|
|
private string _wrmethod;
|
|
|
|
public string Wrmethod
|
|
{
|
|
get { return _wrmethod; }
|
|
set { _wrmethod = value; }
|
|
}
|
|
private string _wrkeyRemark;
|
|
|
|
public string WrkeyRemark
|
|
{
|
|
get { return _wrkeyRemark; }
|
|
set { _wrkeyRemark = value; }
|
|
}
|
|
private string _wrdevice;
|
|
|
|
public string Wrdevice
|
|
{
|
|
get { return _wrdevice; }
|
|
set { _wrdevice = value; }
|
|
}
|
|
private int[] _wrinfo;
|
|
|
|
public int[] Wrinfo
|
|
{
|
|
get { return _wrinfo; }
|
|
set { _wrinfo = value; }
|
|
}
|
|
public CWriteDarkCasketEventArgs(string wrnamespace, string wrmethod,string wrdevice, string wrkeyRemark, int[] wrinfo)
|
|
{
|
|
_wrnamespace = wrnamespace;
|
|
_wrmethod = wrmethod;
|
|
_wrdevice = wrdevice;
|
|
_wrkeyRemark = wrkeyRemark;
|
|
_wrinfo = wrinfo;
|
|
}
|
|
|
|
public CWriteDarkCasketEventArgs(string wrnamespace, string wrmethod, string wrdevice, string wrkeyRemark, byte[] wrinfo)
|
|
{
|
|
_wrnamespace = wrnamespace;
|
|
_wrmethod = wrmethod;
|
|
_wrdevice = wrdevice;
|
|
_wrkeyRemark = wrkeyRemark;
|
|
_wrinfo = new int[wrinfo.Length];
|
|
Array.Copy(wrinfo, _wrinfo, wrinfo.Length);
|
|
}
|
|
}
|
|
public class CSendDeviceOrderEventArgs : EventArgs
|
|
{//20121108
|
|
private int _deviceindex;
|
|
|
|
public int Deviceindex
|
|
{
|
|
get { return _deviceindex; }
|
|
set { _deviceindex = value; }
|
|
}
|
|
private string _remoteIP;
|
|
|
|
public string RemoteIP
|
|
{
|
|
get { return _remoteIP; }
|
|
set { _remoteIP = value; }
|
|
}
|
|
private int _remotePort;
|
|
|
|
public int RemotePort
|
|
{
|
|
get { return _remotePort; }
|
|
set { _remotePort = value; }
|
|
}
|
|
|
|
private byte[] _sendrinfo;
|
|
|
|
public byte[] Sendrinfo
|
|
{
|
|
get { return _sendrinfo; }
|
|
set { _sendrinfo = value; }
|
|
}
|
|
private string _dBBlock;
|
|
|
|
public string DBBlock
|
|
{
|
|
get { return _dBBlock; }
|
|
set { _dBBlock = value; }
|
|
}
|
|
private string _writeData;
|
|
|
|
public string WriteData
|
|
{
|
|
get { return _writeData; }
|
|
set { _writeData = value; }
|
|
}
|
|
private StringBuilder[] _opcItemNamesDicInfo;
|
|
public StringBuilder[] OpcItemNamesDicInfo
|
|
{
|
|
get { return _opcItemNamesDicInfo; }
|
|
set { _opcItemNamesDicInfo = value; }
|
|
}
|
|
private StringBuilder[] _opcItemValuesDicInfo;
|
|
public StringBuilder[] OpcItemValuesDicInfo
|
|
{
|
|
get { return _opcItemValuesDicInfo; }
|
|
set { _opcItemValuesDicInfo = value; }
|
|
}
|
|
private int[] _deviceArray;
|
|
public int[] DeviceArray
|
|
{
|
|
get { return _deviceArray; }
|
|
set { _deviceArray = value; }
|
|
}
|
|
private int[] _sendDataArray;
|
|
public int[] SendDataArray
|
|
{
|
|
get { return _sendDataArray; }
|
|
set { _sendDataArray = value; }
|
|
}
|
|
|
|
public CSendDeviceOrderEventArgs(int deviceindex, string remoteIP, int remotePort, byte[] sendrinfo)
|
|
{
|
|
_deviceindex = deviceindex;
|
|
_remoteIP = remoteIP;
|
|
_remotePort = remotePort;
|
|
_sendrinfo = sendrinfo;
|
|
}
|
|
public CSendDeviceOrderEventArgs(int deviceIndex, string dBBlock, string writeData)
|
|
{
|
|
_deviceindex = deviceIndex;
|
|
_dBBlock = dBBlock;
|
|
_writeData = writeData;
|
|
|
|
}
|
|
public CSendDeviceOrderEventArgs(int S7FirstDevice, StringBuilder[] opcItemNamesDicInfo, StringBuilder[] opcItemValuesDicInfo)
|
|
{
|
|
_deviceindex = S7FirstDevice;
|
|
_opcItemNamesDicInfo = opcItemNamesDicInfo;
|
|
_opcItemValuesDicInfo = opcItemValuesDicInfo;
|
|
}
|
|
public CSendDeviceOrderEventArgs(int[] deviceArray, int[] sendDataArray)
|
|
{
|
|
_deviceArray = deviceArray;
|
|
_sendDataArray = sendDataArray;
|
|
}
|
|
}
|
|
public delegate void CWriteDarkCasketEventHandler(object sender, CWriteDarkCasketEventArgs e);//20121108
|
|
public delegate void CSendDeviceOrderEventHandler(object sender, CSendDeviceOrderEventArgs e);//20121108
|
|
public delegate void CDataSourceChangeEventHandler(object sender, CDataChangeEventArgs e);
|
|
public delegate void CUpdateDBEventHandler(object sender, CUpdateDBChangeEventArgs e);
|
|
public delegate void CDeviceStateChangeEventHandler(object sender,CDeviceStateChangeEventArgs e);
|
|
public delegate void CStringInfoEventHandler(object sender,CStringInfoEventArgs e);
|
|
}
|