Browse Source

[CI SKIP] 发票同步Qad状态 列表查询、导出接口

master
mahao 1 year ago
parent
commit
4cf61c682c
  1. 131
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs
  3. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  4. 77
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs
  5. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  6. 26
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs

131
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/InvoiceSyncQadDto.cs

@ -0,0 +1,131 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{
/// <summary>
/// 发票同步Qad
/// </summary>
public class InvoiceSyncQadDto : AuditedEntityDto<Guid>
{
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public int TaskState { get; set; }
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
public Guid TaskID { get; set; }
/// <summary>
/// 表名
/// </summary>
[Display(Name = "表名")]
public string TaskName { get; set; }
/// <summary>
/// 信息
/// </summary>
[Display(Name = "信息")]
public string Failedinfo { get; set; }
/// <summary>
/// 域
/// </summary>
[Display(Name = "域")]
public string Domain { get; set; }
/// <summary>
/// 地点
/// </summary>
[Display(Name = "地点")]
public string Site { get; set; }
/// <summary>
/// 金税发票号
/// </summary>
[Display(Name = "金税发票号")]
public string InvoiceNumber { get; set; }
/// <summary>
/// 结算发票号
/// </summary>
[Display(Name = "结算发票号")]
public string SaslnvoiceNumber { get; set; }
/// <summary>
/// 客户
/// </summary>
[Display(Name = "客户")]
public string Customer { get; set; }
/// <summary>
/// 凭证号
/// </summary>
[Display(Name = "凭证号")]
public string Voucher { get; set; }
}
/// <summary>
/// 导出
/// </summary>
public class InvoiceSyncQadExportDto
{
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
[ExporterHeader(DisplayName = "状态")]
public int TaskState { get; set; }
/// <summary>
/// 任务ID
/// </summary>
[Display(Name = "任务ID")]
[ExporterHeader(DisplayName = "任务ID")]
public Guid TaskID { get; set; }
/// <summary>
/// 表名
/// </summary>
[Display(Name = "表名")]
[ExporterHeader(DisplayName = "表名")]
public string TaskName { get; set; }
/// <summary>
/// 信息
/// </summary>
[Display(Name = "信息")]
[ExporterHeader(DisplayName = "信息")]
public string Failedinfo { get; set; }
/// <summary>
/// 域
/// </summary>
[Display(Name = "域")]
[ExporterHeader(DisplayName = "域")]
public string Domain { get; set; }
/// <summary>
/// 地点
/// </summary>
[Display(Name = "地点")]
[ExporterHeader(DisplayName = "地点")]
public string Site { get; set; }
/// <summary>
/// 金税发票号
/// </summary>
[Display(Name = "金税发票号")]
[ExporterHeader(DisplayName = "金税发票号")]
public string InvoiceNumber { get; set; }
/// <summary>
/// 结算发票号
/// </summary>
[Display(Name = "结算发票号")]
[ExporterHeader(DisplayName = "结算发票号")]
public string SaslnvoiceNumber { get; set; }
/// <summary>
/// 客户
/// </summary>
[Display(Name = "客户")]
[ExporterHeader(DisplayName = "客户")]
public string Customer { get; set; }
/// <summary>
/// 凭证号
/// </summary>
[Display(Name = "凭证号")]
[ExporterHeader(DisplayName = "凭证号")]
public string Voucher { get; set; }
}
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Prices/PriceListDtoBase.cs

@ -470,9 +470,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
}
/// <summary>
/// 印度价格导出
/// 印度价格导出
/// </summary>
[Display(Name = "件价格")]
[Display(Name = "印度件价格")]
public class PriceListYinDuExportDto
{
/// <summary>

18
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -50,6 +50,8 @@ using static LinqToDB.Sql;
using Win.Sfs.Shared.Filter;
using Polly;
using DocumentFormat.OpenXml.Office2016.Drawing.ChartDrawing;
using Microsoft.Extensions.Logging;
using Castle.Core.Logging;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
@ -57,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/[controller]/[action]")]
public class INVOICE_SERVICE : BASE_SERVICE
{
private readonly ILogger<BASE_SERVICE> _logger;
/// <summary>
/// 数据上下文
/// </summary>
@ -81,6 +84,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INV_MNG _invMng;
private readonly BaseDomainService _baseservice;
public INVOICE_SERVICE(
ILogger<BASE_SERVICE> logger,
SettleAccountDbContext settleAccountDbContext,
WMSBJBMPTDbContext wmsBJBMPTContext,
ExChangeCenterDbContext exChangeCenterDbContext,
@ -100,6 +104,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
) : base(excelImportService, snowflakeIdGenerator, commonManager)
{
_logger = logger;
_settleAccountDbContext = settleAccountDbContext;
_wmsBJBMPTContext = wmsBJBMPTContext;
_exChangeCenterDbContext = exChangeCenterDbContext;
@ -221,7 +226,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
TimeSpan.FromSeconds(5)
}, (exception, timeSpan, retryCount, context) =>
{
Console.WriteLine($"执行失败,第 {retryCount} 次重试");
_logger.LogError($"提交到QAD,修改发票状态执行失败,第 {retryCount} 次重试");
});
await retryPolicyAsync.ExecuteAsync(async () => await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false)).ConfigureAwait(false);
}
@ -294,6 +299,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
}
/// <summary>
/// 构建发票同步Qad状态表数据
/// </summary>
[HttpPost]
public async Task InvoiceSyncQad(string invbillNum)
{
var invoiceSyncQad = new InvoiceSyncQad(GuidGenerator.Create(), "", "");
await _settleAccountDbContext.Set<InvoiceSyncQad>().AddAsync(invoiceSyncQad).ConfigureAwait(false);
await _settleAccountDbContext.SaveChangesAsync().ConfigureAwait(false);
}
/// <summary>
/// 通过审核
/// </summary>

77
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/InvoiceSyncQadService.cs

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using SettleAccount.Domain.BQ;
using Shouldly;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
/// <summary>
/// 发票同步Qad
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class InvoiceSyncQadService : SettleAccountApplicationBase<InvoiceSyncQad>
{
private readonly ILogger<InvoiceSyncQadService> _logger;
private readonly INormalEfCoreRepository<InvoiceSyncQad, Guid> _repository;
public InvoiceSyncQadService(
ILogger<InvoiceSyncQadService> logger,
INormalEfCoreRepository<InvoiceSyncQad, Guid> repository,
IDistributedCache<InvoiceSyncQad> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_logger = logger;
_repository = repository;
}
#region 导入、导出
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(RequestDto input)
{
var fileName = $"Qad发票同步状态_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<InvoiceSyncQad>, List<InvoiceSyncQadExportDto>>(entities);
var exportImporter = new ExportImporter();
var result = await exportImporter.ExcelExporter(dtos).ConfigureAwait(false);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result }).ConfigureAwait(false);
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<InvoiceSyncQadDto>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map<List<InvoiceSyncQad>, List<InvoiceSyncQadDto>>(entities);
return new PagedResultDto<InvoiceSyncQadDto>(totalCount, dtos);
}
#endregion
}
}

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -106,6 +106,7 @@ namespace Win.Sfs.SettleAccount
CreateMapPriceListBJ();
CreateMapPriceListYinDu();
CreateMapInvoiceSyncQad();
#endregion
#region 派格
CreateMapInvoice();
@ -520,6 +521,14 @@ namespace Win.Sfs.SettleAccount
CreateMap<PriceListYinDu, PriceListYinDuExportDto>().ReverseMap();
}
/// <summary>
/// 印度价格
/// </summary>
private void CreateMapInvoiceSyncQad()
{
CreateMap<InvoiceSyncQad, InvoiceSyncQadDto>();
}
private void CreateMapInvoiceSettledDiff()
{

26
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/InvoiceSyncQad.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
@ -13,7 +13,7 @@ namespace SettleAccount.Domain.BQ
/// 状态
/// </summary>
[Display(Name = "状态")]
public int TaskState { get; set; }
public int TaskState { get; protected set; }
/// <summary>
/// 任务ID
/// </summary>
@ -67,5 +67,27 @@ namespace SettleAccount.Domain.BQ
[Display(Name = "凭证号")]
[MaxLength(64)]
public string Voucher { get; set; }
protected InvoiceSyncQad()
{
}
public InvoiceSyncQad(Guid taskID, string invoiceNumber, string saslnvoiceNumber)
{
TaskID = taskID;
InvoiceNumber = invoiceNumber;
SaslnvoiceNumber = saslnvoiceNumber;
}
public void UpdateTaskState(int taskState)
{
TaskState = taskState;
}
public void UpdateFailedinfo(string failedinfo)
{
Failedinfo = failedinfo;
}
}
}

Loading…
Cancel
Save