天津投入产出系统后端
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.
 
 
 
 
 
 

64 lines
2.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QMAPP.FJC.Entity.Operation;
using QMFrameWork.Data;
using QMAPP.DAL;
using System.Data;
namespace QMAPP.FJC.DAL.Operation
{
/// <summary>
/// 电检记录
/// </summary>
public class ElectricalCheckDAL:BaseDAL
{
/// <summary>
/// 校验电检结果是否合格
/// return 0:无电检记录;1:电检合格; -1:电检不合格
/// </summary>
/// <param name="productcode"></param>
/// <returns>0:无电检记录;1:电检合格; -1:电检不合格</returns>
public int ValidElectricalCheck(string productcode)
{
try
{
StringBuilder sql = new StringBuilder();
sql.AppendLine("SELECT [ID]");
sql.AppendLine(" ,[Barcode]");
sql.AppendLine(" ,[Result]");
sql.AppendLine(" ,[Time]");
sql.AppendLine(" FROM [T_ID_DIANJIAN]");
sql.AppendLine(" WHERE [Barcode] LIKE '%'+@productcode");
List<DataParameter> parameters = new List<DataParameter>();
parameters.Add(new DataParameter("productcode",productcode));
using (IDataSession session = AppDataFactory.CreateMainSession())
{
var record = session.GetTable(sql.ToString(), parameters.ToArray());
if (record.Rows.Count < 1)
{
return 0;
}
var r = (from DataRow row in record.Rows
where row["Result"].ToString() == "OK"
select row["ID"]).Count();
if (r > 0)
{
return 1;
}
else
{
return -1;
}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}