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.

73 lines
2.6 KiB
C#

using Admin.Core.Common;
using Admin.Core.IRepository;
using Admin.Core.IService;
using Admin.Core.Model;
using Admin.Core.Model.ViewModels;
using Admin.Core.Service;
using log4net;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Admin.Core.IService
{
/// <summary>
/// SysUserInfoServices
/// </summary>
public class SysUserInfoServices : BaseServices<SysUserInfo>, ISysUserInfoServices
{
private readonly IBaseRepository<SysUserInfo> _dal;
private readonly ISysUserInfoRepository _sysUserInfoRepository;
public SysUserInfoServices(IBaseRepository<SysUserInfo> dal, ISysUserInfoRepository sysUserInfoRepository)
{
this._dal = dal;
base.BaseDal = dal;
_sysUserInfoRepository = sysUserInfoRepository;
}
public async Task<List<CurrentTeamTimeView>> GetTeamData()
{
return await _sysUserInfoRepository.GetTeamData();
}
public async Task<CurrentTeamTimeView> GetTeamData(DateTime nowDate)
{
var list = await _sysUserInfoRepository.GetTeamData();
if (list.Count() == 0) return null;
CurrentTeamTimeView view = list.SingleOrDefault(d => d.StartTime <= nowDate && nowDate <= d.EndTime);
if (view != null)
return view;
else
return null;
}
/// <summary>
/// 根据工位获取所有值
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public async Task<ProductInfoView> GetStationData(string code)
{
string productLineCode = Appsettings.app("StationInfo", "ProductLineCode");
var list = await _sysUserInfoRepository.GetStationData(code);
if (list == null) return null;
var obj = list.SingleOrDefault(d => d.ProductLineCode == "productLineCode");
return obj;
}
/// <summary>
/// 根据产线查询 公司、产线、工序、工位
/// </summary>
/// <param name="productLineCode"></param>
/// <returns></returns>
public async Task<ProductLineInfoView> GetProductLineInfo(string productLineCode)
{
var list = await _sysUserInfoRepository.GetProductLineInfo(productLineCode);
if (list == null) return null;
var obj = list.SingleOrDefault(d => d.ProductlineCode == productLineCode);
return obj;
}
}
}