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 { /// /// 进项发票相关 /// public class InInvoiceService : IInInvoiceService { private readonly IServiceProvider _serviceProvider; private readonly ISaasDbService saasService; private readonly IUser user; private readonly ISqlSugarClient db; /// /// 初始化 /// /// public InInvoiceService(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; saasService = _serviceProvider.GetRequiredService(); db = _serviceProvider.GetRequiredService(); user = _serviceProvider.GetRequiredService(); } /// /// 获取进项发票数据列表 /// /// /// /// public async Task>> GetInInvoicetList(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var result = await tenantDb.Queryable() .Where(t => t.OrgId == user.OrgId) .Select(t => new GetInInvoiceListOutPut { Id = t.Id, },true) .ToQueryPageAsync(request.PageCondition); return result; } /// /// 获取发票详情详细信息 /// /// /// public async Task> GetInInvoicetDetailInfo(GetDetailInfoInput request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var Data = await tenantDb.Queryable() .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().Where(p => p.PId == Data.Id).ToList(); } return DataResult.Success(Data); } } }