using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WMS.Web.Core.Dto.SingleData;
using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Values;
using WMS.Web.Domain.Values.Single;
using WMS.Web.Repositories.Configuration;
namespace WMS.Web.Repositories
{
///
/// 基础数据
///
public class BasicsRepositories : IBasicsRepositories
{
private readonly IMapper _mapper;
private readonly IServiceProvider _serviceProvider;
private RepositoryDbContext _context;
private readonly ILoginRepositories _loginService;
private readonly ISingleDataService _singleDataService;
public BasicsRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
ILoginRepositories loginService, ISingleDataService singleDataService)
{
_context = context;
_mapper = mapper;
_serviceProvider = serviceProvider;
_loginService = loginService;
_singleDataService = singleDataService;
}
///
/// 获取所有人员
///
///
///
public async Task> GetStaffListAsync(int CompanyId)
{
var result = await _singleDataService.GetSysConfigData, SingleDataRequest>
(new SingleDataRequest(CompanyId),
SysConfigAction.GetStaffByCompany);
if (!result.Success)
return null;
return result.Data.ToList();
}
public async Task> GetSubUcStockAsync(int id, string name)
{
var result = await _singleDataService.GetSysConfigData, SubStockRequest>
(new SubStockRequest(id, name, _loginService.CompanyId),
SysConfigAction.GetWareouseByCustomerAndCompany);
if (!result.Success)
return null;
return result.Data.ToList();
}
public async Task> GetUcStockAsync(string name, int companyId)
{
var result = await _singleDataService.GetSysConfigData, NameRequest>
(new NameRequest(name, companyId),
SysConfigAction.GetWarehouseByNameAndCompany);
if (!result.Success)
return null;
return result.Data.ToList();
}
}
}