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.
93 lines
3.2 KiB
C#
93 lines
3.2 KiB
C#
using DS.Module.Core;
|
|
using DS.WMS.Core.Fee.Entity;
|
|
using DS.WMS.Core.Sys.Entity;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DS.Module.Core.Extensions;
|
|
using DS.Module.SqlSugar;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using DS.Module.UserModule;
|
|
using DS.Module.Core.Enums;
|
|
using NPOI.SS.Formula.Functions;
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
using DS.WMS.Core.Invoice.Interface;
|
|
using DS.WMS.ContainerManagement.Info.Dtos;
|
|
using DS.WMS.ContainerManagement.Info.Entity;
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
namespace DS.WMS.Core.Invoice.Method
|
|
{
|
|
/// <summary>
|
|
/// 进项发票相关
|
|
/// </summary>
|
|
public class InInvoiceService : IInInvoiceService
|
|
{
|
|
private readonly IServiceProvider _serviceProvider;
|
|
private readonly ISaasDbService saasService;
|
|
private readonly IUser user;
|
|
private readonly ISqlSugarClient db;
|
|
/// <summary>
|
|
/// 初始化
|
|
/// </summary>
|
|
/// <param name="serviceProvider"></param>
|
|
public InInvoiceService(IServiceProvider serviceProvider)
|
|
{
|
|
_serviceProvider = serviceProvider;
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取进项发票数据列表
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
public async Task<DataResult<List<GetInInvoiceListOutPut>>> GetInInvoicetList(PageRequest<GetInInvoicetInput> request)
|
|
{
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
var result = await tenantDb.Queryable<InInvoice>()
|
|
.Where(whereList)
|
|
.Where(t => t.OrgId == user.OrgId)
|
|
.Select(t => new GetInInvoiceListOutPut
|
|
{
|
|
Id = t.Id,
|
|
|
|
}, true)
|
|
.ToQueryPageAsync(request.PageCondition);
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取发票详情详细信息
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
public async Task<DataResult<GetDetailInfo>> GetInInvoicetDetailInfo(GetDetailInfoInput request)
|
|
{
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
var Data = await tenantDb.Queryable<InInvoice>()
|
|
.Where(t => t.OrgId == user.OrgId && t.Id == request.Id)
|
|
.Select(t => new GetDetailInfo()
|
|
{
|
|
Id = t.Id
|
|
}, true).FirstAsync();
|
|
if (Data != null)
|
|
{
|
|
Data.Data = tenantDb.Queryable<InInvoiceDetail>().Where(p => p.PId == Data.Id).ToList();
|
|
}
|
|
return DataResult<GetDetailInfo>.Success(Data);
|
|
}
|
|
}
|
|
}
|