using FactorySystemCommon;
using FactorySystemModel.SqlSugarModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using FactorySystemModel.EnumModel;
using FactorySystemModel.RequestModel;
using FactorySystemModel.ResponseModel;
namespace FactorySystemBll
{
public class FormulaBll
{
///
/// 获取配置信息
///
public object GetBasicList(int type)
{
return AppSettingsHelper.GetSqlSugar().Queryable().Where(s => s.FType == type && s.FState == 1).ToList();
}
///
/// 获取配置信息
///
public static List GetFormulaList()
{
int isDelete = (int)Constant.DeleteCode.已删除;
return AppSettingsHelper.GetSqlSugar().Queryable().Where(s => s.FDeleted != isDelete).Distinct().ToList();
}
///
/// 获取修改配方信息
///
public static List GetUpdateFormulaList()
{
return AppSettingsHelper.GetSqlSugar().Queryable().Distinct().OrderByDescending(m=>m.Change_Time).ToList();
}
///
/// 获取修改配方信息更具ID获取
///
public static TFS_UpdateFormula GetUpdateFormulaByFID(int fid)
{
return AppSettingsHelper.GetSqlSugar().Queryable().Where(m=>m.FID==fid).Distinct().OrderByDescending(m => m.Change_Time).ToList().LastOrDefault();
}
public List GetFormulaListById(int id)
{
int isDelete = (int)Constant.DeleteCode.已删除;
return AppSettingsHelper.GetSqlSugar().Queryable().Where(s => s.FID == id && s.FDeleted != isDelete).Distinct().ToList();
}
public object GetFormulaByFTestCode(string code)
{
int isDelete = (int)Constant.DeleteCode.已删除;
return AppSettingsHelper.GetSqlSugar().Queryable().Where(s => s.FDeleted != isDelete&&s.FTestCode==code).First();
}
public List GetList(FormulaQuery tr, out int totalNumber)
{
totalNumber = 0;
var db = AppSettingsHelper.GetSqlSugar();
return db.Queryable().Where(s => s.FTestCode != "")
.WhereIF(tr.FName != null, s => s.FName.Contains(tr.FName) || s.FPlmCode.Contains(tr.FPlmCode) || s.FTestCode.Contains(tr.FTestCode) || s.FVersionCode.Contains(tr.FVersionCode))
.Select("*").ToPageList(tr.FPageIndex, tr.FPageSize, ref totalNumber);
}
///
/// 获取配方变更列表
///
///
///
///
public List