using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebAPI.Controllers;
using WebAPI.Models;
namespace WebAPI.App_Start
{
class SqlData
{
///
/// 查询配置表T_MD_WORKCELL_ORDER_QD中的信息.
///
/// 产品编号
///
public static DataTable SelectClass(string GroupId)
{
DataTable returnVal = new DataTable();
string sqlScript = $"select * from T_AW_QDElectricityClass where GroupNumber = '{GroupId}'";
DataSet dataSet = SqlHelper.ExecuteDataset(Config.maindbConnectionString, CommandType.Text, sqlScript);
if (dataSet.Tables.Count > 0)
{
returnVal = dataSet.Tables[0];
}
return returnVal;
}
///
/// 插入泡沫点检数据
///
/// 产品编号
///
public static void InsertMachine(MachineValue machineValue)
{
DataTable returnVal = new DataTable();
var sqlScript = $"INSERT INTO [dbo].[T_MD_PutMachineValue] ([PID], [MachineCode], [Name], [Type], [MValue], [Group], [UserName], [CreateData], [Remark1], [Remark2], [Remark3], [PValue]) VALUES (" +
$"N'{Guid.NewGuid()}', N'{machineValue.MachineCode}', N'{machineValue.Name}', N'{machineValue.Type}', N'{machineValue.MValue}', N'{machineValue.Group}', N'{machineValue.UserName}', '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fffffff")}', NULL, NULL, NULL, N'{machineValue.PValue}');";
SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript);
}
///
/// 插入泡沫点检数据
///
/// 产品编号
///
public static void InsertWare(string sql)
{
var sqlScript = sql;
SqlHelper.ExecuteNonQuery(Config.maindbConnectionString, CommandType.Text, sqlScript);
}
}
}