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.

57 lines
1.8 KiB
C#

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<ProdPlanDetail>, ProdPlanDetailService
{
private ILogger<ProdPlanDetailServiceImpl> _logger;
public ProdPlanDetailServiceImpl(Repository<ProdPlanDetail> repository, ILogger<ProdPlanDetailServiceImpl> logger) : base(repository)
{
_logger = logger;
}
public List<ProdPlanDetail> GetPlanDetails()
{
List<ProdPlanDetail> pLanDetails = null;
try
{
pLanDetails = base._rep.GetList();
pLanDetails.Reverse();
}
catch (Exception ex)
{
_logger.LogError($"获取员工打卡信息异常{ex.Message}");
}
return pLanDetails;
}
public bool InsertPlanDetails(List<ProdPlanDetail> 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;
}
}
}