发起开票请求获取用户证件

usertest
嵇文龙 3 months ago
parent 029a64e18e
commit 1c147f4169

@ -21,6 +21,18 @@ namespace DS.WMS.Core.Application.Entity
[SugarColumn(ColumnDescription = "申请单ID", IsNullable = false)]
public long ApplicationId { get; set; }
/// <summary>
/// 发票商品编码ID
/// </summary>
[SugarColumn(ColumnDescription = "发票商品编码ID", IsNullable = true)]
public long? CodeId { get; set; }
///// <summary>
///// 发票商品编码
///// </summary>
//[Navigate(NavigateType.OneToOne, nameof(CodeId))]
//public CodeInvoice? CodeInvoice { get; set; }
/// <summary>
/// 明细项名称
/// </summary>

@ -5,6 +5,7 @@ using DS.Module.Core.Extensions;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Entity;
@ -511,7 +512,7 @@ namespace DS.WMS.Core.Application.Method
await TenantDb.Deleteable<InvoiceDetail>().Where(x => x.ApplicationId == application.Id).ExecuteCommandAsync();
//然后根据申请单明细重新生成
await CreateInvoiceDetailsAsync([application]);
await FillInvoiceDetailsAsync([application]);
if (application.InvoiceDetails?.Count > 0)
{
@ -528,8 +529,8 @@ namespace DS.WMS.Core.Application.Method
await base.OnSaveAsync(application, fees);
}
//生成发票明细
async Task CreateInvoiceDetailsAsync(IEnumerable<InvoiceApplication> applications)
//根据费用明细填充发票明细
async Task FillInvoiceDetailsAsync(IEnumerable<InvoiceApplication> applications)
{
foreach (var application in applications)
{
@ -539,7 +540,8 @@ namespace DS.WMS.Core.Application.Method
if (application.Details.Count > 0 && (application.InvoiceDetails == null || application.InvoiceDetails.Count == 0))
{
var ids = application.Details.Select(x => x.RecordId).ToList();
var feesCodes = await TenantDb.Queryable<FeeRecord>().InnerJoin<FeeCode>((f, c) => f.FeeId == c.Id && ids.Contains(f.Id))
var feesCodes = await TenantDb.Queryable<FeeRecord>()
.InnerJoin<FeeCode>((f, c) => f.FeeId == c.Id && ids.Contains(f.Id))
.Select((f, c) => new
{
FeeId = c.Id,
@ -551,10 +553,24 @@ namespace DS.WMS.Core.Application.Method
Name = x.Key,
FeeIds = x.Select(y => y.FeeId)
}).ToList();
var goodsNames = list.Select(x => x.Name);
var invCodes = await TenantDb.Queryable<CodeInvoice>().Where(x => goodsNames.Contains(x.Name))
.Select(x => new
{
x.Id,
x.Name,
x.DefaultCurrency,
x.TaxRate,
x.Specification,
x.Unit
}).ToListAsync();
application.InvoiceDetails = new List<InvoiceDetail>(list.Count);
foreach (var item in list)
{
var invDetail = new InvoiceDetail
var invCode = invCodes.Find(x => x.Name == item.Name);
var detail = new InvoiceDetail
{
ApplicationId = application.Id,
Name = item.Name,
@ -563,10 +579,18 @@ namespace DS.WMS.Core.Application.Method
TaxUnitPrice = application.Details.FindAll(x => item.FeeIds.Contains(x.FeeId)).Sum(x => x.ApplyAmount),
Category = DetailCategory.InvoiceApplication
};
invDetail.TaxAmount = invDetail.TaxUnitPrice * application.TaxRate;
invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount;
invDetail.Amount = invDetail.TaxUnitPrice * invDetail.Quantity;
application.InvoiceDetails.Add(invDetail);
if (invCode != null)
{
detail.TaxRate = invCode.TaxRate;
detail.Specification = invCode.Specification;
detail.Unit = invCode.Unit;
}
detail.TaxAmount = detail.TaxUnitPrice * application.TaxRate;
detail.UnitPrice = detail.TaxUnitPrice - detail.TaxAmount;
detail.Amount = detail.TaxUnitPrice * detail.Quantity;
application.InvoiceDetails.Add(detail);
}
}
}
@ -615,7 +639,7 @@ namespace DS.WMS.Core.Application.Method
await TenantDb.Deleteable<InvoiceDetail>().Where(x => appIds.Contains(x.ApplicationId)).ExecuteCommandAsync();
await CreateInvoiceDetailsAsync(applications);
await FillInvoiceDetailsAsync(applications);
var invDetails = applications.SelectMany(x => x.InvoiceDetails).ToList();
if (invDetails.Count > 0)
await TenantDb.Insertable(invDetails).ExecuteCommandAsync();

@ -40,12 +40,36 @@ namespace DS.WMS.Core.Code.Entity
[SugarColumn(ColumnDescription = "零税率标识")]
public ZeroTaxRateIdentification Identification { get; set; }
/// <summary>
/// 税收分类编码
/// </summary>
[SugarColumn(ColumnDescription = "税收分类编码", Length = 100, IsNullable = true)]
public string? TaxClassificationCode { get; set; }
/// <summary>
/// 税收分类名称
/// </summary>
[SugarColumn(ColumnDescription = "税收分类名称", Length = 100, IsNullable = true)]
public string? TaxClassificationName { get; set; }
/// <summary>
/// 是否含税
/// </summary>
[SugarColumn(ColumnDescription = "是否含税")]
public bool IsIncludingTax { get; set; }
/// <summary>
/// 是否享受优惠政策
/// </summary>
[SugarColumn(ColumnDescription = "是否享受优惠政策")]
public bool HasPreferentialPolicy { get; set; }
/// <summary>
/// 优惠政策说明
/// </summary>
[SugarColumn(ColumnDescription = "优惠政策说明", Length = 200, IsNullable = true)]
public string? PreferentialPolicyDescription { get; set; }
/// <summary>
/// 是否默认商品名
/// </summary>

@ -23,13 +23,6 @@ public interface IFeeCustTemplateDetailService
/// <returns></returns>
Task<DataResult> EditAsync(FeeCustTemplateDetailReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<FeeCustTemplateDetailRes> GetFeeCustTemplateDetailInfo(string id);
/// <summary>
/// 根据ID批量删除
/// </summary>

@ -61,20 +61,6 @@ namespace DS.WMS.Core.Fee.Method
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<FeeCustTemplateDetailRes> GetFeeCustTemplateDetailInfo(string id)
{
var data = TenantDb.Queryable<FeeCustTemplateDetail>()
.Where(x => x.Id == long.Parse(id))
.Select<FeeCustTemplateDetailRes>()
.First();
return DataResult<FeeCustTemplateDetailRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 根据ID批量删除
/// </summary>

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.WMS.Core.Application.Method;
using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Sys.Entity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -33,6 +34,12 @@ namespace DS.WMS.Core.Invoice.Method
{
ArgumentNullException.ThrowIfNull(ids, nameof(ids));
long userId = long.Parse(User.UserId);
var userInfo = await Db.Queryable<SysUser>().Where(x => x.Id == userId).Select(x => new
{
x.Id,
}).FirstAsync();
//请求参数设置
InvoiceIssuanceRequest request = new()
{

Loading…
Cancel
Save