using System; using System.Collections.Generic; using System.Text; using System.Data; using DBFactory; namespace wcfControlMonitorClient { /// /// Creator:Richard.liu /// /// 命令开关等全局变量的定义 /// public static class CStaticClass { public static WcfControlMonitorLib.SControlMonitor WcfControl = new WcfControlMonitorLib.SControlMonitor(); static string _userID; /// /// 用户编号 /// public static string UserID { get { return CStaticClass._userID; } set { CStaticClass._userID = value; } } public static string ClientID { get; set; } public static bool IfRemind { get; set; } public static DBOperator dbo = CommonClassLib.AppSettings.dbo; //20130510 static string _manstatus = " F_Status<>-1 ";//默认,显示调度任务全部队列 static string _monstatus = " F_Status<>-1 ";//默认,显示设备指令全部队列 /// /// 显示调度任务全部队列" F_Status<>-1 ";等待队列" F_Status=0 ";运行队列" F_Status=1 "; /// public static string Manstatus { get { return CStaticClass._manstatus; } set { CStaticClass._manstatus = value; } } /// /// 显示设备指令全部队列" F_Status<>-1 ";等待队列" F_Status=0 ";运行队列" F_Status=1 "; /// public static string Monstatus { get { return CStaticClass._monstatus; } set { CStaticClass._monstatus = value; } } static string _SystemName = "【沈阳新松自动化立体仓库监控调度系统服务端】"; public static string SystemName { get { return CStaticClass._SystemName; } set { CStaticClass._SystemName = value; } } ///// ///// 命令开关是否打开 ///// //public static bool Order{get;set;} ///// ///// 是否获取调度任务 ///// //public static bool ObtainManageTask { get; set; } public static int GetDeviceKindIdx(int devIdx) { try { string strSql = "SELECT F_DeviceIndex, F_DeviceKindIndex FROM T_Base_Device WHERE F_DeviceIndex=" + devIdx; DataSet ds = dbo.ExceSQL(strSql); DataView dv = ds.Tables[0].DefaultView; if (dv.Count > 0) { return Convert.ToInt32(dv[0]["F_DeviceKindIndex"]); } else return -1; } catch (Exception ex) { throw ex; } } public static int GetLaneWay(int StackDeviceIndex) { //20101124 StringBuilder sql = new StringBuilder(); sql.Append("SELECT F_LaneDeviceIndex FROM T_Base_LaneInfo WHERE (F_StackIndex = ").Append(StackDeviceIndex).Append(")"); DataView dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView; if (dv.Count > 0) { return Convert.ToInt32(dv[0][0]); } else { return -1; } } public static int GetStackIndexFromLaneInfo(int LaneIndex) { //20101124 StringBuilder sql = new StringBuilder(); sql.Append("SELECT F_StackIndex FROM T_Base_LaneInfo WHERE (F_LaneDeviceIndex = ").Append(LaneIndex).Append(")"); DataView dv = dbo.ExceSQL(sql.ToString()).Tables[0].DefaultView; if (dv.Count > 0) { return Convert.ToInt32(dv[0][0]); } else { return -1; } } /// /// 获得当前连接数据库的名字 /// /// /// public static string GetDBName() { string strRetVal = string.Empty; try { //DBOperator dbo = new DBOperator(); string temp = dbo.GetValue("ConnString"); if (temp != string.Empty) { int i = temp.IndexOf("database"); temp = temp.Substring(i); i = temp.IndexOf(";"); temp = temp.Substring(0, i); strRetVal = temp.Substring((temp.IndexOf("=") + 1)).Trim(); } return strRetVal; } catch (Exception) { return strRetVal; } } } }