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.

40 lines
1.4 KiB

using FactorySystemCommon;
using FactorySystemModel.SqlSugarModel;
using SqlSugar;
using System.Collections.Generic;
using FactorySystemModel.EnumModel;
namespace FactorySystemBll
{
public class FactoryBll
{
/// <summary>
/// 获取配置信息
/// </summary>
public static List<TFS_Factory> GetFactoryList()
{
int isDelete = (int)Constant.DeleteCode.;
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_Factory>().Where(s => s.FDeleted != isDelete).ToList();
}
/// <summary>
/// 验证工厂代码是否重复
/// </summary>
public object CheckHasCode(Dictionary<string, object> insertData)
{
SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
int isDelete = (int)Constant.DeleteCode.;
string code = insertData["FCode"].ToString();
if (int.TryParse(insertData["FID"].ToString(), out int dataId) && dataId > 0)
{
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_Factory>().Where(s => s.FDeleted != isDelete
&& s.FCode == code && s.FID != dataId).Count();
}
else
{
return AppSettingsHelper.GetSqlSugar().Queryable<TFS_Factory>().Where(s => s.FDeleted != isDelete && s.FCode == code).Count();
}
}
}
}