74 lines
2.7 KiB
C#
74 lines
2.7 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 基础数据
|
|
/// </summary>
|
|
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;
|
|
}
|
|
/// <summary>
|
|
/// 获取所有人员
|
|
/// </summary>
|
|
/// <param name="CompanyId"></param>
|
|
/// <returns></returns>
|
|
public async Task<List<SysStaffResponse>> GetStaffListAsync(int CompanyId)
|
|
{
|
|
var result = await _singleDataService.GetSysConfigData<ResultList<SysStaffResponse>, SingleDataRequest>
|
|
(new SingleDataRequest(CompanyId),
|
|
SysConfigAction.GetStaffByCompany);
|
|
if (!result.Success)
|
|
return null;
|
|
return result.Data.ToList();
|
|
}
|
|
|
|
public async Task<List<UcStockResponse>> GetSubUcStockAsync(int id, string name)
|
|
{
|
|
var result = await _singleDataService.GetSysConfigData<ResultList<UcStockResponse>, SubStockRequest>
|
|
(new SubStockRequest(id, name, _loginService.CompanyId),
|
|
SysConfigAction.GetWareouseByCustomerAndCompany);
|
|
if (!result.Success)
|
|
return null;
|
|
return result.Data.ToList();
|
|
}
|
|
|
|
public async Task<List<UcStockResponse>> GetUcStockAsync(string name, int companyId)
|
|
{
|
|
var result = await _singleDataService.GetSysConfigData<ResultList<UcStockResponse>, NameRequest>
|
|
(new NameRequest(name, companyId),
|
|
SysConfigAction.GetWarehouseByNameAndCompany);
|
|
if (!result.Success)
|
|
return null;
|
|
return result.Data.ToList();
|
|
}
|
|
}
|
|
}
|