费用记录生成调整

usertest
嵇文龙 3 months ago
parent 91476617ec
commit 3e988102e6

@ -12,24 +12,6 @@ namespace DS.WMS.Core.Fee.Entity
[SugarTable("fee_cust_template", "往来单位费用模板")]
public class FeeCustTemplate : SharedOrgModel<long>
{
/// <summary>
/// 结算对象Id
/// </summary>
[SugarColumn(ColumnDescription = "结算对象Id")]
public long CustomerId { get; set; }
/// <summary>
/// 结算对象
/// </summary>
[SugarColumn(ColumnDescription = "结算对象", Length = 100, IsNullable = true)]
public string? CustomerName { get; set; }
/// <summary>
/// 结算对象类型
/// </summary>
[SugarColumn(ColumnDescription = "结算对象类型", IsNullable = true)]
public CustomerTypeEnum? CustomerType { get; set; }
/// <summary>
/// 业务类型
/// </summary>

@ -25,6 +25,21 @@ namespace DS.WMS.Core.Fee.Entity
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 结算对象Id
/// </summary>
[SugarColumn(ColumnDescription = "结算对象Id")]
public long CustomerId { get; set; }
/// <summary>
/// 结算对象
/// </summary>
[SugarColumn(ColumnDescription = "结算对象", Length = 100, IsNullable = true)]
public string? CustomerName { get; set; }
/// <summary>
/// 结算对象类型
/// </summary>
[SugarColumn(ColumnDescription = "结算对象类型", IsNullable = true)]
public CustomerTypeEnum? CustomerType { get; set; }
/// <summary>
/// 费用Id
/// </summary>
[SugarColumn(ColumnDescription = "费用Id")]
@ -62,12 +77,12 @@ namespace DS.WMS.Core.Fee.Entity
/// <summary>
/// 单价
/// </summary>
[SugarColumn(ColumnDescription = "单价", IsNullable = true, Length = 18, DecimalDigits = 4, DefaultValue = "0")]
[SugarColumn(ColumnDescription = "单价", IsNullable = true, Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal? UnitPrice { get; set; }
/// <summary>
/// 汇率
/// 汇率,为空时取默认汇率
/// </summary>
[SugarColumn(ColumnDescription = "汇率", IsNullable = true, Length = 18, DecimalDigits = 4, DefaultValue = "0")]
[SugarColumn(ColumnDescription = "汇率", IsNullable = true, Length = 18, DecimalDigits = 4)]
public decimal? ExchangeRate { get; set; }
/// <summary>
/// 费用默认税率
@ -87,7 +102,7 @@ namespace DS.WMS.Core.Fee.Entity
/// <summary>
/// 含税单价
/// </summary>
[SugarColumn(ColumnDescription = "含税单价", IsNullable = true, Length = 18, DecimalDigits = 4, DefaultValue = "0")]
[SugarColumn(ColumnDescription = "含税单价", IsNullable = true, Length = 18, DecimalDigits = 2, DefaultValue = "0")]
public decimal? TaxUnitPrice { get; set; }
/// <summary>
/// 是否开票

@ -397,7 +397,8 @@ namespace DS.WMS.Core.Fee.Entity
UnitPrice = TaxUnitPrice;
NoTaxAmount = Amount;
}
else {
else
{
var taxrateb = 1 + TaxRate / 100;
NoTaxAmount = Amount / taxrateb;
Tax = Amount - NoTaxAmount;
@ -412,6 +413,9 @@ namespace DS.WMS.Core.Fee.Entity
TaxUnitPrice = Amount;
}
}
NoTaxAmount = UnitPrice * Quantity;
Amount = TaxUnitPrice * Quantity;
}
}
}

@ -38,13 +38,6 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public async Task GenerateFeesAsync(long bsId, BusinessType businessType = BusinessType.OceanShippingExport)
{
var model = await TenantDb.Queryable<SeaExport>().Where(x => x.Id == bsId).Select(x => new
{
x.CustomerId
}).FirstAsync();
if (model == null)
return;
//switch (businessType)
//{
// case BusinessType.OceanShippingExport:
@ -56,16 +49,16 @@ namespace DS.WMS.Core.Fee.Method
try
{
var list = await TenantDb.Queryable<FeeCustTemplate>()
.Where(x => x.BusinessType == businessType && x.CustomerId == model.CustomerId && !SqlFunc.IsNullOrEmpty(x.Condition))
.Where(x => x.BusinessType == businessType && !SqlFunc.IsNullOrEmpty(x.Condition))
.Select(x => new
{
x.Id,
x.CustomerId,
x.CustomerName,
x.CustomerType,
x.Condition,
Details = SqlFunc.Subqueryable<FeeCustTemplateDetail>().Where(y => y.TemplateId == x.Id).ToList(y => new
{
y.CustomerId,
y.CustomerName,
y.CustomerType,
y.FeeId,
y.FeeCode,
y.FeeName,
@ -118,9 +111,9 @@ namespace DS.WMS.Core.Fee.Method
FeeId = x.FeeId,
FeeCode = x.FeeCode,
FeeName = x.FeeName,
CustomerId = item.CustomerId,
CustomerName = item.CustomerName,
CustomerType = item.CustomerType?.ToString(),
CustomerId = x.CustomerId,
CustomerName = x.CustomerName,
CustomerType = x.CustomerType?.ToString(),
Unit = x.Unit,
UnitPrice = x.UnitPrice.GetValueOrDefault(),
Quantity = x.IsCtn ? 0 : 1, //非箱型默认数量为1
@ -132,7 +125,6 @@ namespace DS.WMS.Core.Fee.Method
TaxUnitPrice = x.TaxUnitPrice.GetValueOrDefault(),
IsInvoice = x.IsInvoice,
IsAdvancedPay = x.IsAdvancedPay,
//Amount = x.UnitPrice.GetValueOrDefault()
});
//根据箱型箱量提取数量以计算总价
@ -141,7 +133,7 @@ namespace DS.WMS.Core.Fee.Method
if (fe.Quantity > 0)
continue;
if (fe.Unit.IsNullOrEmpty())
if (fe.Unit.IsNullOrEmpty()) //未设置费用标准则数量则为0
{
fe.Quantity = 0;
}

@ -42,8 +42,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
/// <returns></returns>
public bool IsMatch(object source, ConditionContent condition)
{
ArgumentNullException.ThrowIfNull(source, nameof(source));
ArgumentNullException.ThrowIfNull(condition, nameof(condition));
if (source == null || condition == null)
return false;
TaskFlowDataContext dataContext = new((TaskFlowDataNameConst.Business, source));
if (condition.SourceName.IsNullOrEmpty())

@ -138,7 +138,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public async Task<DataResult> CreateTaskAsync(TaskCreationRequest request, bool useTransaction = true)
{
if (!await HasAuthorized())
return DataResult.SuccessedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
if (request.HasCabin.GetValueOrDefault() && request.BusinessType.HasValue)
{
@ -372,7 +372,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
public async Task<DataResult> SetTaskStatusAsync(TaskUpdateRequest request, bool useTransaction = true)
{
if (!await HasAuthorized())
return DataResult.SuccessedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
return DataResult.FailedWithDesc(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.ModuleUnauthorized)));
if (useTransaction)
await TenantDb.Ado.BeginTranAsync();

Loading…
Cancel
Save