using System; using System.Collections.Generic; using SlnMesnac.Model.domain; namespace SlnMesnac.Repository.service.Impl { public class CwssMaterialInfoServiceImpl:ICwssMaterialInfoService { private readonly Repository _rep; public CwssMaterialInfoServiceImpl(Repository rep) { _rep = rep; } public List GetCwssMaterialInfoList() { try { return _rep.GetList(); } catch (Exception e) { throw new ArgumentException($"获取CWSS物料信息异常:{e.Message}"); } } public CwssMaterialInfo GetCwssMaterialInfoByMatCode(string MatCode) { try { //return _rep.GetList(x => x.MatCode == MatCode).OrderByDescending(x => x.WriteTime).First(); return _rep.GetFirst(x => x.MaterialCode == MatCode); } catch (Exception e) { throw new ArgumentException($"根据物料代码获取物料信息异常:{e.Message}"); } } } }