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 DS.WMS.Core.Invoice.Entity; 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; namespace DS.WMS.Core.Invoice.Method { /// /// 进项发票相关 /// public class InInvoiceService : IInInvoiceService { //public override TaskBaseTypeEnum AuditType => TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT; 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>> GetListAsync(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var result = await tenantDb.Queryable() .Where(t => t.OrgId == user.OrgId) .Select(t => new GetListOutPut { Id = t.Id, InvoicingDate = t.InvoicingDate, InvoiceTypeCode = t.InvoiceTypeCode, InvoiceNumber = t.InvoiceNumber, TotalAmount = t.TotalAmount, TotalTax = t.TotalTax, TotalWithTax = t.TotalWithTax, InvoiceStatus = t.InvoiceStatus, Invoicer = t.Invoicer, OriginalInvoiceNumber = t.OriginalInvoiceNumber, BuyerInvoiceName = t.BuyerInvoiceName, BuyerInvoiceTaxNumber = t.BuyerInvoiceTaxNumber, SellerInvoiceName = t.SellerInvoiceName, SellerInvoiceTaxNumber = t.SellerInvoiceTaxNumber, IsDetailObtained = t.IsDetailObtained, SellerIdentificationNumber = t.SellerIdentificationNumber, FinalCheckCode = t.FinalCheckCode, BuyerName = t.BuyerName, CurrentTime = t.CurrentTime, DeductionAmount = t.DeductionAmount, VehicleInvoiceTypeCode = t.VehicleInvoiceTypeCode, TaxControlCode = t.TaxControlCode, BuyerTaxNumber = t.BuyerTaxNumber, PaperInvoiceNumber = t.PaperInvoiceNumber, Payee = t.Payee, ItemFlag = t.ItemFlag, InvoiceUnitCode = t.InvoiceUnitCode, BuyerBankAccount = t.BuyerBankAccount, Amount = t.Amount, SellerName = t.SellerName, SpecialElements = t.SpecialElements, ReimbursementStatus = t.ReimbursementStatus, BuyerBankAccountNumber = t.BuyerBankAccountNumber, SpecialElementTypeCode = t.SpecialElementTypeCode, OperatorCode = t.OperatorCode, BuyerAddressPhone = t.BuyerAddressPhone, IsPaperInvoice = t.IsPaperInvoice, InvoiceRequestNumber = t.InvoiceRequestNumber, TaxAmount = t.TaxAmount, Remarks = t.Remarks, BuyerIdentificationNumber = t.BuyerIdentificationNumber, BuyerFullName = t.BuyerFullName, SellerTaxNumber = t.SellerTaxNumber, InvoiceCode = t.InvoiceCode, SellerAddressPhone = t.SellerAddressPhone, DetailList = t.DetailList, SellerAddressPhoneExtra = t.SellerAddressPhoneExtra, SellerBankAccountNumber = t.SellerBankAccountNumber, Reviewer = t.Reviewer, BuyerAddressPhoneExtra = t.BuyerAddressPhoneExtra, SellerFullName = t.SellerFullName, MachineCode = t.MachineCode, ItemOrServiceName = t.ItemOrServiceName, SellerBankAccount = t.SellerBankAccount, PdfFilePath = t.PdfFilePath, OfdFilePath = t.OfdFilePath, XmlFilePath = t.XmlFilePath, AllFileDownloadPath = t.AllFileDownloadPath }) .ToQueryPageAsync(request.PageCondition); return result; } /// /// 获取发票详情详细信息 /// /// /// public async Task>> GetDetailInfo(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var result = await tenantDb.Queryable() .Where(t => t.OrgId == user.OrgId&&t.PId== request.OtherQueryCondition.Id).ToQueryPageAsync(request.PageCondition); return result; } } }