|
|
using CommonFunc.Tools;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
namespace XGL.Data.DBService
|
|
|
{
|
|
|
public class DringRoomService
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 获取烘房列表
|
|
|
/// </summary>
|
|
|
/// <param name="bdt"></param>
|
|
|
/// <param name="edt"></param>
|
|
|
/// <returns></returns>
|
|
|
public DataTable GetDringRoomInfo(string list)
|
|
|
{
|
|
|
string[] str = list.Split(',');
|
|
|
string where = "";
|
|
|
foreach (string str2 in str)
|
|
|
{
|
|
|
where += $"'{str2}',";
|
|
|
}
|
|
|
where = "("+where.Trim(',')+")";
|
|
|
string sql = $@"select equipment_code as quipCode,equipment_name as quipName,equipment_type_code from base_equipment where equipment_type_code = 'equ_type_hf' and equipment_code in {where} order by create_time";
|
|
|
|
|
|
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
|
|
|
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
return dtset.Tables[0];
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取烘房内数据
|
|
|
/// </summary>
|
|
|
/// <param name="bdt"></param>
|
|
|
/// <param name="edt"></param>
|
|
|
/// <returns></returns>
|
|
|
public DataTable GetDringRoomData(string devicecode,int inout)
|
|
|
{
|
|
|
string sqlHF = $@"SELECT * FROM [dbo].[base_equipment_attached] where device_code='{devicecode}' and property='Intheoven' ;";
|
|
|
////获取绑定中,且RFID没有出烘房(在烘房内)的数据
|
|
|
//// string sql = $@"SELECT rfid,workorder_code,product_name,product_code,isnull(car_num,0) as car_num,isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status FROM [dbo].[mes_material_transfer_result] res
|
|
|
////LEFT JOIN pro_order_workorder ord on res.OrderCode = ord.workorder_id where equipmentCode = '{devicecode}' and rfid_status = '1' and rfid not in(select rfid from mes_material_transfer_result where taskcode = '1' and rfid_status = '1')";
|
|
|
////where rfid !=null and equipmentCode = '{devicecode}' and rfid_status = '1' and rfid not in(select rfid from mes_material_transfer_result where taskcode = '1' and rfid_status = '1')
|
|
|
|
|
|
|
|
|
DataSet dtsetresult = Utils.netClientDBHelper.getDataSet(sqlHF);
|
|
|
string adwdwad = dtsetresult.Tables[0].Rows[0][5].ToString();
|
|
|
//int number = Convert.ToInt32();
|
|
|
string sql = $@"SELECT TOP {adwdwad} ROW_NUMBER() OVER (ORDER BY dry.create_time desc) AS RowNumber,rfid_no,device_code,type,dry.create_time,dry.update_time,factory_no,dry.workorder_code,material_code,product_name FROM [dbo].[mes_dryinghouse_info] dry
|
|
|
LEFT JOIN pro_order_workorder workorder on dry.workorder_code = workorder.workorder_code where device_code = '{devicecode}' and type = '{inout}' and dry.del_flag='0' order by dry.create_time desc ;";
|
|
|
//获取绑定中,且RFID没有出烘房(在烘房内)的数据
|
|
|
// string sql = $@"SELECT rfid,workorder_code,product_name,product_code,isnull(car_num,0) as car_num,isnull([begin],'1900-01-01 08:00:00') as [begin],ord.status FROM [dbo].[mes_material_transfer_result] res
|
|
|
//LEFT JOIN pro_order_workorder ord on res.OrderCode = ord.workorder_id where equipmentCode = '{devicecode}' and rfid_status = '1' and rfid not in(select rfid from mes_material_transfer_result where taskcode = '1' and rfid_status = '1')";
|
|
|
//where rfid !=null and equipmentCode = '{devicecode}' and rfid_status = '1' and rfid not in(select rfid from mes_material_transfer_result where taskcode = '1' and rfid_status = '1')
|
|
|
|
|
|
|
|
|
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
|
|
|
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
return dtset.Tables[0];
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 获取烘房温湿度
|
|
|
/// </summary>
|
|
|
/// <param name="bdt"></param>
|
|
|
/// <param name="edt"></param>
|
|
|
/// <returns></returns>
|
|
|
public DataTable GetTemperAndHumilly(string devicecode)
|
|
|
{
|
|
|
|
|
|
string sql = $@"select isnull(isvalue,0) from base_equipment_attached where device_code = '{devicecode}' and (property='temperature' or property = 'humidity') ; ";
|
|
|
|
|
|
DataSet dtset = Utils.netClientDBHelper.getDataSet(sql);
|
|
|
if (dtset != null && dtset.Tables.Count > 0 && dtset.Tables[0].Rows.Count > 0)
|
|
|
{
|
|
|
return dtset.Tables[0];
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
}
|