using RGD.DBUtility;
using RGD.Model;
using System;
using System.Data;
namespace RGD.DataService
{
///
///
///
public class CommonService
{
#region T_Base_LaneInfo 巷道
///
/// 根据垛机号获取巷道号
///
/// 垛机
///
public int GetLaneWay(int StackDeviceIndex)
{
DataView dv = DbHelperSQL.Query("SELECT F_LaneDeviceIndex FROM T_Base_LaneInfo WHERE (F_StackIndex = " + StackDeviceIndex + ")").Tables[0].DefaultView;
if (dv.Count > 0)
{
return Convert.ToInt32(dv[0][0]);
}
else
{
return -1;
}
}
#endregion T_Base_LaneInfo 巷道
#region T_Base_Device 设备相关
///
/// 没看明白 暂时保留 [双叉有关]
///
///
///
///
public int GetUpAndDownDevices(int devinx, int DB1Address)
{
string sql = string.Format("SELECT F_DeviceIndex FROM T_Base_Device WHERE (F_DeviceIndex != {0}) and F_DBW1Address ={1}", devinx, DB1Address);
object ob = DbHelperSQL.GetSingle(sql);
if (ob != null)
{
return Convert.ToInt32(ob);
}
else
{
return -1;
}
}
///
/// 堆垛机是否双叉关联控制
///
///
///
public string GetIfCorrelDoubleFork(int devinx)
{
MDevice devinfo = BaseDeviceService.GetDeviceInfo(devinx);
if (devinfo == null)
{
return "0";
}
else
{
return devinfo.IfCorrelDoubleFork;
}
}
#endregion T_Base_Device 设备相关
#region T_ITEMTASKTYPE 搬运路径类型
///
/// 获得搬运路径类型 1入库2出库3移库4输送5盘库6拣选7贴标
///
/// 调度任务下发的搬运任务类型
///
public string GetIOType(string FCONTROLTASKTYPE)
{
DataSet ds;
try
{
ds = DbHelperSQL.Query("SELECT FCODE, FINTERCODE FROM T_ITEMTASKTYPE where FCODE='" + FCONTROLTASKTYPE + "'");
if (ds.Tables[0].DefaultView.Count > 0)
{
return ds.Tables[0].DefaultView[0]["FINTERCODE"].ToString();
}
else
return "";
}
catch (Exception ex)
{
throw ex;
}
finally
{
ds = null;
}
}
#endregion T_ITEMTASKTYPE 搬运路径类型
}
}