You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.9 KiB
52 lines
1.9 KiB
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
|
|
{
|
|
/// <summary>
|
|
/// 查询配置表T_MD_WORKCELL_ORDER_QD中的信息.
|
|
/// </summary>
|
|
/// <param name="productCode">产品编号</param>
|
|
/// <returns></returns>
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 插入电表数据
|
|
/// </summary>
|
|
/// <param name="productCode">产品编号</param>
|
|
/// <returns></returns>
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|