forked from wenjy/HighWayIot
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.
119 lines
3.4 KiB
C#
119 lines
3.4 KiB
C#
using HighWayIot.Log4net;
|
|
using HighWayIot.Repository.domain;
|
|
using Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HighWayIot.Repository.service
|
|
{
|
|
public class ZxRecipePositionParaService
|
|
{
|
|
private static readonly Lazy<ZxRecipePositionParaService> lazy = new Lazy<ZxRecipePositionParaService>(() => new ZxRecipePositionParaService());
|
|
|
|
public static ZxRecipePositionParaService Instance
|
|
{
|
|
get
|
|
{
|
|
return lazy.Value;
|
|
}
|
|
}
|
|
|
|
private LogHelper log = LogHelper.Instance;
|
|
Repository<ZxRecipePositionParaEntity> _repository => new Repository<ZxRecipePositionParaEntity>("sqlserver");
|
|
|
|
/// <summary>
|
|
/// 查询工位配方字段信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ZxRecipePositionParaEntity> GetRecipePositionParaInfos()
|
|
{
|
|
try
|
|
{
|
|
List<ZxRecipePositionParaEntity> entity = _repository.GetList();
|
|
return entity;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("工位配方字段信息获取异常", ex);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据ID查询工位配方字段信息
|
|
/// </summary>
|
|
/// <param name="id">工位配方编号</param>
|
|
/// <returns></returns>
|
|
public ZxRecipePositionParaEntity GetRecipePositionParaInfoById(int id)
|
|
{
|
|
try
|
|
{
|
|
ZxRecipePositionParaEntity entity = _repository.GetById(id);
|
|
return entity;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("工位配方字段信息获取异常", ex);
|
|
return new ZxRecipePositionParaEntity();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改工位配方字段信息
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateRecipePositionParaInfo(ZxRecipePositionParaEntity entity)
|
|
{
|
|
try
|
|
{
|
|
return _repository.Update(entity);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("工位配方字段信息修改异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加工位配方字段信息
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public bool InsertRecipePositionParaInfo(ZxRecipePositionParaEntity entity)
|
|
{
|
|
try
|
|
{
|
|
return _repository.Insert(entity);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("工位配方字段信息修改异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// ID删除工位配方字段信息
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
public bool DeleteRecipePositionParaInfoById(int id)
|
|
{
|
|
try
|
|
{
|
|
return _repository.DeleteById(id);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("工位配方字段信息删除异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|