You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using Production_Oil.DbModel;
|
|
using ProductionSystem_Log;
|
|
using System;
|
|
|
|
namespace Production_Oil.Services
|
|
{
|
|
public class OilService : DbContext
|
|
{
|
|
/// <summary>
|
|
/// 根据产品条码查询注油工位压缩机空重
|
|
/// </summary>
|
|
/// <param name="productCode"></param>
|
|
/// <returns></returns>
|
|
public T_Oil QueryOilByProductCode(string productCode)
|
|
{
|
|
try
|
|
{
|
|
return db.Queryable<T_Oil>().First(m => m.ProductCode == productCode);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex, "执行OilService下QueryOilByProductCode时异常");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 注油工位压缩机空重记录
|
|
/// </summary>
|
|
/// <param name="t_Oil"></param>
|
|
/// <returns></returns>
|
|
public int AddOil(T_Oil t_Oil)
|
|
{
|
|
try
|
|
{
|
|
return db.Insertable(t_Oil).ExecuteCommand();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error(ex, "执行OilService下AddOil时异常");
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
}
|