AHTC/RGD/RGD.DataService/MonitorTaskService.cs

71 lines
2.1 KiB
C#
Raw Permalink Normal View History

2025-05-19 09:22:33 +08:00
using RGD.DBUtility;
using System;
using System.Data;
namespace RGD.DataService
{
/// <summary>
/// 设备指令服务类
/// </summary>
public class MonitorTaskService
{
/// <summary>
/// 获取指令队列里的箱条码
/// </summary>
/// <param name="Monitorindex"></param>
/// <returns></returns>
public string GetBarCodeFromMonitor(int Monitorindex)
{
object ob = DbHelperSQL.GetSingle("SELECT F_TxtParam FROM T_Monitor_Task WHERE (F_MonitorIndex = " + Monitorindex + ")");
if (ob != null)
{
return ob.ToString();
}
else
{
return "0";
}
}
/// <summary>
/// 根据前面得到的MonitorIndex值取得"关联调度任务"
/// </summary>
/// <returns>关联调度任务索引0表示没有 0就不会发送该指令</returns>
public int GetAssociateMonitor(int MonitorIndex)
{
DataView dv;
DataView dvv;
try
{
string sql = "select F_Associate from T_Monitor_Task where (F_Associate IS NOT NULL) and F_MonitorIndex=" + MonitorIndex;
dv = DbHelperSQL.Query(sql).Tables[0].DefaultView;
if (dv.Count > 0)
{
string sql1 = "select F_MonitorIndex from T_Monitor_Task where F_MonitorIndex=" + dv[0]["F_Associate"];
dvv = DbHelperSQL.Query(sql1).Tables[0].DefaultView;
if (dvv.Count > 0)
{
return Convert.ToInt32(dvv[0]["F_MonitorIndex"].ToString());
}
else
{
return 0;
}
}
else
{
return 0;
}
}
catch (Exception ex)
{
throw ex;
}
finally
{
dv = null;
dvv = null;
}
}
}
}