济宁李尔调度
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.

105 lines
3.6 KiB

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using ICommLayer;
using DBFactory;
namespace IOControlStatus
{
/// <summary>
/// 20100617��ȡ���������ij�������ȷ��������ͨѶ�ӿ�������
/// �����豸״̬��
/// �����ߣ�Richard.Liu
/// </summary>
public class CGetDeviceState:IGetDeviceState
{
StringBuilder sql = new StringBuilder();
string _commLayerError;
public string CommLayerError
{
get { return _commLayerError; }
set { _commLayerError = value; }
}
public DBOperator dbo = CommonClassLib.AppSettings.dbo; //20130510
public DBOperator dboM = CommonClassLib.AppSettings.dboM; //20130510
public CGetDeviceState()
{
dbo.Open();
}
//~CGetDeviceState()
//{
// dbo.Close();
//}
/// <summary>
/// �������ؿ�ֵ����û�гɹ�����������Ϣ(��λ��->��λ��)
/// ��1�ֽڣ� ���кţ�����λ����������0��ʼ��ÿ����һ����Ϣ���кż�1��
/// ������С��240(0XF0)��ѭ��ʹ�á�
/// ��2��3�ֽڣ������ţ�����λ���´�����ʱ�������ţ���λ�������ϱ�����ʱ���̶�
/// ��255(0XFF)��255(0XFF)��
/// ��4�ֽڣ� ��Ϣ�� 1-��������
/// 2-�������꣨���ڶѶ�����
/// 3-���⿪��״̬���������ͻ��ȣ�
/// ����ֵ-����
/// ��5�ֽڣ� �豸�ţ�������Ŀ�������¹滮��
/// ��6�ֽڣ�
/// �Ѷ�����
/// x���꣬��-�ع���������
/// ���⿪�أ�
/// 0-�޻�
/// 1-�л�
/// ��7�ֽڣ�y���꣬��-�߶ȷ�����
/// 6�ֽ������ͻ��ȱ������⿪��״̬ʱ��ʵ��ֵ��6��7�ֽ��ڶѶ��������������ɺͱ�������ʱ��ʵ��ֵ������������Ϣ���ǿ���������ֵ��
/// ��8-14�ֽڣ����ã�����������ֵ��
/// </summary>
/// <param name="DeviceIndex">�豸����</param>
/// <returns>����������Ϣ�ɹ��󣬷���Ӧ����Ϣ�󷵻�14���ֽ���״̬</returns>
public int[] GetDeviceState(int DeviceIndex, int TaskIndex)
{
try
{
int fid = Model.CGeneralFunction.GetManageTaskIndexfromMonitor(TaskIndex);
int mankind = Model.CGeneralFunction.GetManageTaskKindIndexFromMonitor(TaskIndex);
if (mankind == 1)
{
sql.Remove(0, sql.Length);
sql.Append("SELECT CONTROL_ID FROM IO_CONTROL WHERE (CONTROL_ID = ").Append(fid).Append(") AND (CONTROL_STATUS = " ).Append( Model.CGeneralFunction.TASKOUTCONFIRM ).Append( ")");
object ob = dboM.GetSingle(sql.ToString());
if (ob != null)
{
int[] states = new int[6];
states[0] = 0;//��д��־
states[1] = Model.CGeneralFunction.TASKOUTCONFIRM;//״̬:ȷ������
states[2] = TaskIndex;//������
states[3] = 0;
states[4] = 0;
states[5] = DeviceIndex;//�豸������
return states;
}
else
{
return null;
}
}
else
{
return null;
}
}
catch(Exception ex)
{
_commLayerError = this.ToString() + ":GetDeviceState---" + ex.Message ;
return null;
}
}
public string GetStringData(int DeviceIndex, int TaskIndex)
{
return "";
}
}
}