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.

93 lines
2.7 KiB
C#

using Microsoft.Extensions.Logging;
using SlnMesnac.Model.domain;
using SlnMesnac.Repository.service.@base;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Security.Cryptography;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class VisionSettingServiceImpl : BaseServiceImpl<VisionSetting>, IVisionSettingService
{
private ILogger<VisionSettingServiceImpl> _logger;
public VisionSettingServiceImpl(Repository<VisionSetting> repository, ILogger<VisionSettingServiceImpl> logger) : base(repository)
{
_logger = logger;
}
public List<VisionSetting> GetList()
{
try
{
var res = _rep.GetList();
if (res == null)
{
return new List<VisionSetting>();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"获取视觉配置列表错误");
return new List<VisionSetting>();
}
}
public List<VisionSetting> GetList(Expression<Func<VisionSetting, bool>> expression)
{
try
{
var res = _rep.GetList(expression);
if (res == null)
{
return new List<VisionSetting>();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"获取视觉配置列表错误");
return new List<VisionSetting>();
}
}
public VisionSetting GetVisionSettingByAMRGUID(string guid)
{
try
{
var res = _rep.GetSingle(x => x.AMRGUID == guid);
if (res == null)
{
return new VisionSetting();
}
return res;
}
catch(Exception ex)
{
_logger.LogError($"根据AMRGUID获取视觉配置错误");
return new VisionSetting();
}
}
public VisionSetting GetVisionSettingByID(string id)
{
try
{
var res = _rep.GetSingle(x => x.VisionID == id);
if (res == null)
{
return new VisionSetting();
}
return res;
}
catch (Exception ex)
{
_logger.LogError($"根据VisionID获取视觉配置错误");
return new VisionSetting();
}
}
}
}