BaoKai_202508-Wms-Jingwang..../WMS.SqlServerData/BaseData/DecStsData.cs

112 lines
4.9 KiB
C#
Raw Permalink Normal View History

2025-08-24 09:35:55 +08:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.IData;
using WMS.IData.IBase;
namespace WMS.SqlServerData.BaseData
{
/// <summary>
/// 设备处理类
/// </summary>
public class DecStsData:IDecStsData
{
/// <summary>
/// 查询输送机的状态
/// </summary>
/// <returns></returns>
public DataTable GetDecDataTable()
{
string sqlStr =@"select t.* , ISNULL(a.LOCATION_ID,'')as loc, ISNULL(b.LOC_ID,'')as loc2,a.UPGOODS_ID,b.PICKINGID from [dbo].[T_ConveyorStatus] t
left join T_ONGOODSSHELF a on t.PlcID = a.PlcID
left join T_CK_PICKINGWAVEGOODS_BACK b on t.PlcID = b.plcId ";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
/// <summary>
/// 入库模式还是出库模式
/// </summary>
/// <param name="plcId"></param>
/// <param name="sts"></param>
public DataTable GetStationRk(string stand )
{
string sqlStr =@" select * from T_ConveyorStatus where ConveyorID='"+stand+"'";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
/// <summary>
/// 根据配置查询站台
/// </summary>
/// <param name="desciption"></param>
/// <returns></returns>
public DataTable GetStationErpCong(string desciption)
{
string sqlStr =@" select ConveyorID from T_ConveyorStatus where desciption ='" + desciption + "'";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
public DataTable GetDecIPDecData(string pcIp)
{
string sqlStr =@"select pcip,ledip, ConveyorID ,desciption,optype from T_ConveyorStatus where pcIp='" + pcIp + "' ";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
public int UpdateDecStsSet(string decID,string LedIp,string pcip,string dec,string optype)
{
string sqlStr = "update T_ConveyorStatus set Ledip='"+LedIp+"',pcip='"+pcip+"' ,desciption='"+dec+ "' ,optype='"+ optype + "' where ConveyorID='" + decID + "'";
return SystemDataObject.Instance.ExecuteSqlCommit(sqlStr);
}
public DataTable GetDecStsData()
{
string sqlStr = "select * from T_DevMessage";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
public DataTable GetDecSts(string decId )
{
string sqlStr =@"select * from T_DevMessage t left join T_errorInfor a on t.deverrid = a.errorID where devid="+decId+"";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
public DataTable GetLogError(string STORAGE_ID)
{
string sqlStr = "select decid, (case sts when '0' then '入空托' when '1' then '可入不可出' when '2' then '可出不可入' when '3' then '锁死' end) sts from t_decname ";
return SystemDataObject.Instance.GetDataTable(sqlStr);
}
public DataSet GetDecLocSts(string decid,string row)
{
string sqlStr =@" select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION "
+ " where decId='"+ decid + "' and row='"+row+"' and layer='01' order by SORT;"
+ " select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION " +
" where decId = '" + decid + "' and row = '" + row + "' and layer = '02' order by SORT;"
+ " select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION " +
"where decId = '" + decid + "' and row = '" + row + "' and layer = '03' order by SORT;"
+ " select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION" +
" where decId ='" + decid + "' and row = '" + row + "' and layer = '04' order by SORT;"
+ " select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION where" +
" decId = '" + decid + "'and row = '" + row + "' and layer = '05' order by SORT;"
+ " select LOCATION_ID as loc,status,HASVOLUME from T_BASE_STORAGE_AREA_LOCATION where" +
" decId = '" + decid + "' and row ='" + row + "' and layer = '06' order by SORT; ";
return SystemDataObject.Instance.GetDataSet(sqlStr);
}
/// <summary>
/// 更新输送机模式
/// </summary>
public void WriteCayMode(string mode,string decID)
{
string sqlStr = "update T_ConveyorStatus set writeMode='" + mode + "' where ConveyorID=" + decID + "";
SystemDataObject.Instance.ExecuteSqlCommit(sqlStr);
}
}
}