79 lines
2.4 KiB
C#
79 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using WMS.IData;
|
|
using WMS.IData.IBase;
|
|
|
|
namespace WMS.SqlServerData.BaseData
|
|
{
|
|
public class BaseLtkSts : IBaseLtkSts
|
|
{
|
|
/// <summary>
|
|
/// 获取站台
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataTable GetStandSts(string sts)
|
|
{
|
|
string sqlStr = "select standid,standtype,(CASE sts when '0' then '关闭' when '1' THEN '空闲' when '2' then '占用' end ) sts from T_Base_LTK_STAND order by standid asc";
|
|
if (sts.Trim().Length > 0)
|
|
{
|
|
sqlStr = sqlStr + " where sts='"+sts+"'";
|
|
}
|
|
|
|
return SystemDataObject.Instance.GetDataTable(sqlStr);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 更新站台Status
|
|
/// </summary>
|
|
public void UpStandSts(string stdId,string sts)
|
|
{
|
|
string sqlStr = "update t_base_ltk_stand set sts='" + sts + "' where standid ='" + stdId + "'";
|
|
|
|
SystemDataObject.Instance.ExecuteSql(sqlStr);
|
|
}
|
|
/// <summary>
|
|
/// 返回空闲的站台
|
|
/// </summary>
|
|
/// <param name="standType"></param>
|
|
/// <returns></returns>
|
|
public string GetStandNext(string standType)
|
|
{
|
|
string val = "120";
|
|
string sqlStr = "select standid from T_Base_LTK_STAND where standtype='" + standType + "' and sts='1'";
|
|
DataTable table = SystemDataObject.Instance.GetDataTable(sqlStr);
|
|
if (table != null )
|
|
{
|
|
if (table.Rows.Count > 0)
|
|
{
|
|
val = table.Rows[0]["standid"].ToString();
|
|
}
|
|
else
|
|
{
|
|
val = "001";
|
|
}
|
|
}
|
|
|
|
return val;
|
|
}
|
|
/// <summary>
|
|
/// 返回空闲的站台
|
|
/// </summary>
|
|
/// <param name="standType"></param>
|
|
/// <returns></returns>
|
|
public string GetStandNext()
|
|
{
|
|
string val = "1";
|
|
string sqlStr = "select NEXT VALUE FOR SEQ_LTK_STAND";
|
|
DataTable table = SystemDataObject.Instance.GetDataTable(sqlStr);
|
|
if (table != null || table.Rows.Count > 0)
|
|
{
|
|
val = table.Rows[0]["val"].ToString();
|
|
}
|
|
return val;
|
|
}
|
|
}
|
|
}
|