审核支持通过后驳回

dev
嵇文龙 2 weeks ago
parent 736620d546
commit e03dbb9db4

@ -55,7 +55,6 @@ namespace DS.WMS.Core.Settlement.Dtos
/// </summary>
public decimal InvoiceAmount { get; set; }
/// <summary>
/// 原始金额
/// </summary>
@ -71,6 +70,26 @@ namespace DS.WMS.Core.Settlement.Dtos
/// </summary>
public decimal? USDApplyAmount { get; set; }
/// <summary>
/// RMB结算金额
/// </summary>
public decimal? RMBStlAmount { get; set; }
/// <summary>
/// USD结算金额
/// </summary>
public decimal? USDStlAmount { get; set; }
/// <summary>
/// RMB未结金额
/// </summary>
public decimal? RMBStlRestAmount { get; set; }
/// <summary>
/// USD未结金额
/// </summary>
public decimal? USDStlRestAmount { get; set; }
/// <summary>
/// 申请日期
/// </summary>

@ -12,6 +12,7 @@ using DS.WMS.Core.Settlement.Dtos;
using DS.WMS.Core.Settlement.Entity;
using DS.WMS.Core.Settlement.Interface;
using DS.WMS.Core.Sys.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
namespace DS.WMS.Core.Settlement.Method
@ -141,17 +142,30 @@ namespace DS.WMS.Core.Settlement.Method
protected override async Task<List<SettlementDetailGroup>> GetSettlementDetails(long id)
{
var list = await TenantDb.Queryable<PaymentApplication>()
.InnerJoin<ApplicationDetail>((i, d1) => i.Id == d1.ApplicationId)
.InnerJoin<ApplicationDetail>((i, d1, d2) => d1.ApplicationId == d2.RefId)
.Where((i, d1, d2) => d2.ApplicationId == id &&
d2.Category == DetailCategory.PaidApplicationSettlement || d1.Category == DetailCategory.ChargeApplicationSettlement)
.InnerJoin<ApplicationDetail>((i, d1) => i.Id == d1.ApplicationId) //d1=申请明细
.InnerJoin<ApplicationDetail>((i, d1, d2) => d2.DetailId == d1.Id) //d2=结算明细
.Where((i, d1, d2) => d2.ApplicationId == id)
.GroupBy((i, d1, d2) => i.Id)
.Select((i, d1, d2) => new SettlementDetailGroup
{
SettlementAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(d3 => d3.ApplicationId == i.Id).Sum(d3 => d3.ApplyAmount),
Status = (int)i.Status,
BillNO = i.ApplicationNO,
PaymentDate = i.PaymentDate,
RMBApplyAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == d2.RefId && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount),
USDApplyAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == d2.RefId && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
RMBStlAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount),
USDStlAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount),
RMBStlRestAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.RMB_CODE).Sum(x => x.ApplyAmount - x.ProcessedAmount),
USDStlRestAmount = SqlFunc.Subqueryable<ApplicationDetail>().Where(x => x.ApplicationId == i.Id && x.Currency == FeeCurrency.USD_CODE).Sum(x => x.ApplyAmount - x.ProcessedAmount),
//ApplicationNOList = SqlFunc.Subqueryable<PaymentApplication>().Where(a => a.Id == d1.RefId.Value).ToList(a => a.ApplicationNO)
}, true).ToListAsync();
foreach (var item in list)
{
PaymentApplicationStatus status = (PaymentApplicationStatus)item.Status;
item.StatusText = status.GetDescription();
}
return list;
}
@ -186,6 +200,7 @@ namespace DS.WMS.Core.Settlement.Method
FeeType = d.FeeType,
Amount = d.Amount, //总金额
ApplyAmount = d.ApplyAmount, //已结算金额
SettlementAmount = d.ApplyAmount,
RestAmount = d.ApplyAmount - d.ProcessedAmount, //剩余结算金额
CustomerId = d.CustomerId,
CustomerName = d.CustomerName,

@ -114,6 +114,9 @@ namespace DS.WMS.Core.Settlement.Method
{
var detailCategory = settlement.Mode == SettlementMode.Payment ? DetailCategory.PaidApplication : DetailCategory.ChargeApplication;
details1 = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.ApplicationId) && x.Category == detailCategory)
.WhereIF(request.Documents.Any(x => x.SettlementRMB.HasValue), x => x.Currency == FeeCurrency.RMB_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementUSD.HasValue), x => x.Currency == FeeCurrency.USD_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementOther.HasValue), x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE)
.Select(x => new ApplicationDetail
{
ApplicationId = settlement.Id,
@ -157,6 +160,9 @@ namespace DS.WMS.Core.Settlement.Method
else if (settlement.Mode == SettlementMode.InvoiceSettlement || settlement.Mode == SettlementMode.PaymentInvoiceSettlement)
{
details1 = await TenantDb.Queryable<ApplicationDetail>().Where(x => ids.Contains(x.ApplicationId) && x.Category == DetailCategory.InvoiceIssuance)
.WhereIF(request.Documents.Any(x => x.SettlementRMB.HasValue), x => x.Currency == FeeCurrency.RMB_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementUSD.HasValue), x => x.Currency == FeeCurrency.USD_CODE)
.WhereIF(request.Documents.Any(x => x.SettlementOther.HasValue), x => x.Currency != FeeCurrency.RMB_CODE && x.Currency != FeeCurrency.USD_CODE)
.Select(x => new ApplicationDetail
{
ApplicationId = settlement.Id,

@ -1,4 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Enums;
using DS.WMS.Core.Application.Entity;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
using DS.WMS.Core.TaskInteraction.Dtos;
@ -34,12 +36,12 @@ namespace DS.WMS.Core.TaskInteraction.Method
DataResult result = DataResult.Success;
var tasks = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Create);
//var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete);
var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete);
await TenantDb.Ado.BeginTranAsync();
try
{
//状态待审核的任务
if (tasksList.Count > 0)
if (tasks.Count > 0)
{
var flowIds = tasks.Select(x => x.FlowId.Value);
var flowInstances = await Db.Queryable<FlowInstance>().Where(x => flowIds.Contains(x.Id)).ToListAsync();
@ -72,21 +74,32 @@ namespace DS.WMS.Core.TaskInteraction.Method
}
}
////已完成审核的任务
//if (task2.Count > 0)
//{
// switch (request.TaskType)
// {
// case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT:
// break;
//已完成审核的任务
if (task2.Count > 0)
{
var ids = task2.Where(x => x.TaskType == request.TaskType).Select(x => x.BusinessId);
switch (request.TaskType)
{
case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT:
await TenantDb.Updateable<PaymentApplication>().Where(x => ids.Contains(x.Id))
.SetColumns(x => x.Status == PaymentApplicationStatus.AuditRejected)
.SetColumns(x => x.Reason == request.Remark)
.ExecuteCommandAsync();
break;
case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT:
await TenantDb.Updateable<InvoiceApplication>().Where(x => ids.Contains(x.Id))
.SetColumns(x => x.Status == InvoiceApplicationStatus.AuditRejected)
.SetColumns(x => x.Reason == request.Remark)
.ExecuteCommandAsync();
break;
default:
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.BusinessNotSupported));
}
// case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT:
// break;
// default:
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
// }
//}
}
await TenantDb.Ado.CommitTranAsync();
return result;

Loading…
Cancel
Save