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.
149 lines
4.7 KiB
149 lines
4.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Data;
|
|
using DBFactory;
|
|
|
|
namespace wcfControlMonitorClient
|
|
{
|
|
/// <summary>
|
|
/// Creator:Richard.liu
|
|
///
|
|
/// 命令开关等全局变量的定义
|
|
/// </summary>
|
|
public static class CStaticClass
|
|
{
|
|
|
|
public static WcfControlMonitorLib.SControlMonitor WcfControl = new WcfControlMonitorLib.SControlMonitor();
|
|
static string _userID;
|
|
/// <summary>
|
|
/// 用户编号
|
|
/// </summary>
|
|
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 ";//默认,显示设备指令全部队列
|
|
/// <summary>
|
|
/// 显示调度任务全部队列" F_Status<>-1 ";等待队列" F_Status=0 ";运行队列" F_Status=1 ";
|
|
/// </summary>
|
|
public static string Manstatus
|
|
{
|
|
get { return CStaticClass._manstatus; }
|
|
set { CStaticClass._manstatus = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 显示设备指令全部队列" F_Status<>-1 ";等待队列" F_Status=0 ";运行队列" F_Status=1 ";
|
|
/// </summary>
|
|
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; }
|
|
}
|
|
|
|
|
|
///// <summary>
|
|
///// 命令开关是否打开
|
|
///// </summary>
|
|
//public static bool Order{get;set;}
|
|
|
|
///// <summary>
|
|
///// 是否获取调度任务
|
|
///// </summary>
|
|
//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;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 获得当前连接数据库的名字
|
|
/// </summary>
|
|
/// <param name="appKey"></param>
|
|
/// <returns></returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|