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.

56 lines
1.6 KiB
C#

using SlnMesnac.Model.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SlnMesnac.Repository.service.Impl
{
public class McsMaterialInfoServiceImpl : IMcsMaterialInfoService
{
private readonly Repository<McsMaterialInfo> _rep;
public McsMaterialInfoServiceImpl(Repository<McsMaterialInfo> rep)
{
_rep = rep;
}
/// <summary>
/// 根据物料代码获取物料信息
/// </summary>
/// <param name="MatCode"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public McsMaterialInfo GetMcsMaterialInfoByMatCode(string MatCode)
{
try
{
//return _rep.GetList(x => x.MatCode == MatCode).OrderByDescending(x => x.WriteTime).First();
return _rep.GetFirst(x => x.MatCode == MatCode);
}
catch (Exception e)
{
throw new ArgumentException($"根据物料代码获取物料信息异常:{e.Message}");
}
}
/// <summary>
/// 获取MCS物料信息
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public List<McsMaterialInfo> GetMcsMaterialInfoList()
{
try
{
return _rep.GetList();
}
catch (Exception e)
{
throw new ArgumentException($"获取MCS物料信息异常:{e.Message}");
}
}
}
}