72 lines
2.8 KiB
C#
72 lines
2.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Text;
|
|||
|
using System.Data;
|
|||
|
using ICommLayer;
|
|||
|
using CommLayerFactory;
|
|||
|
using DBFactory;
|
|||
|
namespace ControlSystem
|
|||
|
{
|
|||
|
public class CMonitorDeviceState
|
|||
|
{
|
|||
|
CParsePLCData cppd = new CParsePLCData();
|
|||
|
DBOperator dbo = new DBOperator();
|
|||
|
DBOperator dboM = new DBOperator("ManConnString", "ManDBFactory");
|
|||
|
private string _monitorDeviceStateError = "";
|
|||
|
/// <summary>
|
|||
|
/// ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD><EFBFBD>豸״̬ʱ<CCAC><CAB1><EFBFBD><EFBFBD><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
|
|||
|
/// </summary>
|
|||
|
public string MonitorDeviceStateError
|
|||
|
{
|
|||
|
get { return _monitorDeviceStateError; }
|
|||
|
set { _monitorDeviceStateError = value; }
|
|||
|
}
|
|||
|
|
|||
|
public CMonitorDeviceState()
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// ʵʱ<CAB5><CAB1><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>RGV<47><56><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>ϡ<EFBFBD><CFA1><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD><EFBFBD><EFA1A2><EFBFBD><EFBFBD>̽<EFBFBD>
|
|||
|
/// <20><><EFBFBD><EFBFBD>ʵʱ״̬<D7B4><CCAC>FrmControlMonitor<6F><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>IO_ROUTEPATH<54>͵<EFBFBD><CDB5><EFBFBD>T_Base_Device<63><65>F_ErrorCode
|
|||
|
/// </summary>
|
|||
|
public void RealTimeMonitorDeviceState()
|
|||
|
{
|
|||
|
string sql = "SELECT F_DeviceIndex, F_DeviceKindIndex, F_BindingDevice, F_BindingDeviceOut,F_DeviceVisual, F_ControlName, F_Picture, F_ErrorCode, F_HaveGoods FROM T_Base_Device WHERE (F_DeviceKindIndex = 1) OR (F_DeviceKindIndex = 2) OR (F_DeviceKindIndex = 4)";
|
|||
|
DataView dv = dbo.ExceSQL(sql).Tables[0].DefaultView;
|
|||
|
for (int i = 0; i < dv.Count; i++)
|
|||
|
{
|
|||
|
int[] states= cppd.GetDeviceState(Convert.ToInt32(dv[i]["F_DeviceIndex"]));
|
|||
|
if (states == null) continue;
|
|||
|
if (states[1] == 1)//<2F><><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (states[1] >= 30)//<2F><><EFBFBD><EFBFBD>
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
if (dv[i]["F_BindingDevice"] != DBNull.Value)//<2F>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_ControlName
|
|||
|
{
|
|||
|
string sqlb = "SELECT F_DeviceIndex, F_DeviceKindIndex, F_BindingDevice, F_BindingDeviceOut,F_DeviceVisual, F_ControlName, F_Picture, F_ErrorCode, F_HaveGoods FROM T_Base_Device WHERE (F_DeviceKindIndex = " + dv[i]["F_BindingDevice"] + ") ";
|
|||
|
DataView dvb = dbo.ExceSQL(sqlb).Tables[0].DefaultView;
|
|||
|
if (dvb.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
if (dv[i]["F_BindingDeviceOut"] != DBNull.Value)//<2F>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>F_ControlName
|
|||
|
{
|
|||
|
string sqlb = "SELECT F_DeviceIndex, F_DeviceKindIndex, F_BindingDevice, F_BindingDeviceOut,F_DeviceVisual, F_ControlName, F_Picture, F_ErrorCode, F_HaveGoods FROM T_Base_Device WHERE (F_DeviceKindIndex = " + dv[i]["F_BindingDeviceOut"] + ") ";
|
|||
|
DataView dvb = dbo.ExceSQL(sqlb).Tables[0].DefaultView;
|
|||
|
if (dvb.Count > 0)
|
|||
|
{
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|