using HighWayIot.Log4net; using HighWayIot.Repository.domain; using Models; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; namespace HighWayIot.Repository.service { public class ZxRecipePositionParaService { private static readonly Lazy lazy = new Lazy(() => new ZxRecipePositionParaService()); public static ZxRecipePositionParaService Instance { get { return lazy.Value; } } private LogHelper log = LogHelper.Instance; Repository _repository => new Repository("sqlserver"); /// /// 查询工位配方字段信息 /// /// public List GetRecipePositionParaInfos() { try { List entity = _repository.GetList(); return entity; } catch (Exception ex) { log.Error("工位配方字段信息获取异常", ex); return null; } } /// /// 查询工位配方字段信息 /// /// public List GetRecipePositionParaInfos(Expression> whereExpression) { try { List entity = _repository.GetList(whereExpression); return entity; } catch (Exception ex) { log.Error("工位配方字段信息获取异常", ex); return null; } } /// /// 根据配方号查询工位配方字段信息 /// /// 工位配方编号 /// public List GetRecipePositionParaInfoByRecipeCode(string recipeCode) { try { List entity = _repository.GetList(x => x.RecipeCode == recipeCode); return entity; } catch (Exception ex) { log.Error("工位配方字段信息获取异常", ex); return new List(); } } /// /// 修改工位配方字段信息 /// /// /// public bool UpdateRecipePositionParaInfo(ZxRecipePositionParaEntity entity) { try { return _repository.Update(entity); } catch (Exception ex) { log.Error("工位配方字段信息修改异常", ex); return false; } } /// /// 添加工位配方字段信息 /// /// /// public bool InsertRecipePositionParaInfo(ZxRecipePositionParaEntity entity) { try { return _repository.Insert(entity); } catch (Exception ex) { log.Error("工位配方字段信息修改异常", ex); return false; } } /// /// ID删除工位配方字段信息 /// /// /// public bool DeleteRecipePositionParaInfoById(int id) { try { return _repository.DeleteById(id); } catch (Exception ex) { log.Error("工位配方字段信息删除异常", ex); return false; } } } }