恒石成品库WCS
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.

150 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 = "��TJBS�Զ��������ֿ����ص���ϵͳ�����ˡ�";
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;
}
}
}
}