using Microsoft.Extensions.Logging; using SlnMesnac.Model.domain; using SlnMesnac.Repository.service.@base; using System; using System.Collections.Generic; using System.Text; namespace SlnMesnac.Repository.service.Impl { public class ProdPlanDetailServiceImpl : BaseServiceImpl, ProdPlanDetailService { private ILogger _logger; public ProdPlanDetailServiceImpl(Repository repository, ILogger logger) : base(repository) { _logger = logger; } public List GetPlanDetails() { List pLanDetails = null; try { pLanDetails = base._rep.GetList(); pLanDetails.Reverse(); } catch (Exception ex) { _logger.LogError($"获取员工打卡信息异常{ex.Message}"); } return pLanDetails; } public bool InsertPlanDetails(List planDetails) { bool result = false; try { base._rep.AsTenant().BeginTran(); result = base._rep.InsertRange(planDetails); base._rep.AsTenant().CommitTran(); } catch (Exception ex) { base._rep.AsTenant().RollbackTran(); _logger.LogError($"员工打卡信息添加异常:{ex.Message}"); } return result; } public ProdPlanDetail GetPlanDetailsByPlanCode(string planCode) { ProdPlanDetail prodPlanDetail = _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(planCode),x=>x.PlanCode == planCode).First(); return prodPlanDetail; } } }