|
|
|
@ -1,5 +1,4 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
@ -90,7 +89,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = await src.ToListAsync();
|
|
|
|
|
return new DataResult<List<FeeRecord>>(ResultCode.Success) { Data = data };
|
|
|
|
|
return DataResult<List<FeeRecord>>.Success(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -139,7 +138,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
var first = items.Select(x => new { x.BusinessType, x.BusinessId }).FirstOrDefault();
|
|
|
|
|
if (await IsFeeLockedAsync(first.BusinessId, first.BusinessType))
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeLocked);
|
|
|
|
|
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
@ -162,7 +161,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
if (fe.FeeStatus != FeeStatus.Entering && fe.FeeStatus != FeeStatus.RejectSubmission)
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"费用【{fe.FeeName}】状态不正确,无法修改;");
|
|
|
|
|
sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -212,13 +211,13 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
|
|
var list = createList.Union(updateList).Select(x => x.Adapt<FeeRecordRes>());
|
|
|
|
|
return DataResult.Successed("保存成功", list, MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.Failed("保存失败", MultiLanguageConst.DataUpdateFailed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
finally
|
|
|
|
|
{
|
|
|
|
@ -239,7 +238,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.FeeId == y.FeeId && x.FeeType == y.FeeType).Any(
|
|
|
|
|
(x, y) => x.BusinessId == bid && x.BusinessType == businessType && tidArray.Contains(y.TemplateId));
|
|
|
|
|
if (hasExists)
|
|
|
|
|
return DataResult.Failed("费用记录已存在", MultiLanguageConst.FeeRecordExist);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordExist);
|
|
|
|
|
|
|
|
|
|
var details = await TenantDb.Queryable<FeeTemplateDetail>().Where(x => tidArray.Contains(x.TemplateId) && !x.Deleted).Select(x => new
|
|
|
|
|
{
|
|
|
|
@ -281,7 +280,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
await WriteBackStatusAsync(bid, businessType);
|
|
|
|
|
|
|
|
|
|
return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return result > 0 ? DataResult.Success : DataResult.Successed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -293,16 +292,16 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
var model = await TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).FirstAsync();
|
|
|
|
|
if (await IsFeeLockedAsync(model.BusinessId, model.BusinessType))
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeLocked);
|
|
|
|
|
|
|
|
|
|
if (await TenantDb.Queryable<FeeRecord>().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission)))
|
|
|
|
|
return DataResult.Failed("只能删除状态为‘录入’或‘驳回提交’的费用", MultiLanguageConst.FeeRecordDelete);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordDelete);
|
|
|
|
|
|
|
|
|
|
int result = await TenantDb.Deleteable<FeeRecord>(x => ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await WriteBackStatusAsync(model.BusinessId, model.BusinessType);
|
|
|
|
|
|
|
|
|
|
return result > 0 ? DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess) : DataResult.Failed("删除失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return result > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -325,21 +324,21 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
BusinessType = x.BusinessType
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
if (fees.IsNullOrEmpty())
|
|
|
|
|
return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordNotExist);
|
|
|
|
|
|
|
|
|
|
var bid = fees[0].BusinessId;
|
|
|
|
|
var bType = fees[0].BusinessType;
|
|
|
|
|
//业务状态检测
|
|
|
|
|
if (await IsFeeLockedAsync(bid, bType))
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeLocked);
|
|
|
|
|
|
|
|
|
|
if (fees.Any(x => x.FlowId.HasValue))
|
|
|
|
|
return DataResult.Failed("当前费用包含正在审批中的费用,无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordIsAuditing);
|
|
|
|
|
|
|
|
|
|
if (fees.Any(x => x.FeeStatus == FeeStatus.PartialSettlement || x.FeeStatus == FeeStatus.SettlementCompleted))
|
|
|
|
|
return DataResult.Failed("当前审批费用包含已结算/部分结算的费用,无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordIsSettled);
|
|
|
|
|
|
|
|
|
|
DataResult result = DataResult.Failed(string.Empty, MultiLanguageConst.Operation_Failed);
|
|
|
|
|
DataResult result = DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -367,13 +366,13 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.FlowId
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -385,7 +384,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
if (fe.FeeStatus != FeeStatus.Entering && fe.FeeStatus != FeeStatus.RejectSubmission)
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;");
|
|
|
|
|
sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -394,7 +393,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.FeeAudit);
|
|
|
|
|
if (template == null)
|
|
|
|
|
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.TemplateNotFound);
|
|
|
|
|
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
foreach (var item in fees)
|
|
|
|
@ -429,7 +428,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
if (fe.FeeStatus != FeeStatus.AuditPassed && fe.FeeStatus != FeeStatus.RejectApplication)
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;");
|
|
|
|
|
sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -438,7 +437,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.FeeDelete);
|
|
|
|
|
if (template == null)
|
|
|
|
|
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.TemplateNotFound);
|
|
|
|
|
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
foreach (var item in fees)
|
|
|
|
@ -481,14 +480,14 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
FeeStatus = x.FeeStatus
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
if (fees.Count == 0)
|
|
|
|
|
return DataResult.Failed("未能获取费用信息", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordNotExist);
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
foreach (var fe in fees)
|
|
|
|
|
{
|
|
|
|
|
if (fe.FeeStatus != FeeStatus.AuditPassed && fe.FeeStatus != FeeStatus.RejectApplication)
|
|
|
|
|
{
|
|
|
|
|
sb.Append($"费用【{fe.FeeName}】状态不正确,无法提交审批;");
|
|
|
|
|
sb.AppendFormat(MultiLanguageConst.FeeRecordStatus, fe.FeeName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -497,7 +496,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.FeeModify);
|
|
|
|
|
if (template == null)
|
|
|
|
|
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.TemplateNotFound);
|
|
|
|
|
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
@ -530,13 +529,13 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
await TenantDb.Updateable(fees).UpdateColumns(x => new { x.FeeStatus, x.FlowId }).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -557,14 +556,14 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
|
if (fees.Count == 0)
|
|
|
|
|
return DataResult.Failed("未能找到费用记录", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.TemplateNotFound);
|
|
|
|
|
|
|
|
|
|
//未在审批状态中
|
|
|
|
|
var fees2 = fees.FindAll(x => x.FlowId == null).ToList();
|
|
|
|
|
if (fees2.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string msg = string.Join("; ", fees2.Select(x => $"{x.FeeName}"));
|
|
|
|
|
return DataResult.Failed($"以下费用项:{msg} 未在审批状态中,无需撤销", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(string.Format(MultiLanguageConst.NoNeedWithdraw, msg));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var flows = fees.Select(x => new FlowInstance { Id = x.FlowId.Value, FlowStatus = (int)FlowStatusEnum.Draft, MakerList = string.Empty }).ToList();
|
|
|
|
@ -605,13 +604,13 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
await TenantDb.Updateable(fees).UpdateColumns(x => new { x.Id, x.FeeStatus, x.SubmitBy, x.SubmitDate, x.FlowId }).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.Failed("提交失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -628,23 +627,25 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.BusinessType == BusinessType.OceanShippingExport).Select(x => new BusinessFeeStatus
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
BusinessId = x.BusinessId,
|
|
|
|
|
BusinessType = x.BusinessType,
|
|
|
|
|
IsFeeLocking = x.IsFeeLocking,
|
|
|
|
|
BillAuditStatus = x.BillAuditStatus,
|
|
|
|
|
FlowId = x.FlowId
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
|
|
|
|
|
if (entity == null)
|
|
|
|
|
return DataResult.Failed("未能找到业务信息", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.BusinessNotFound);
|
|
|
|
|
if (entity.IsFeeLocking.GetValueOrDefault())
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeLocked);
|
|
|
|
|
if (entity.FlowId.HasValue)
|
|
|
|
|
return DataResult.Failed($"当前业务正在审批中,无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.FeeRecordIsAuditing);
|
|
|
|
|
if (entity.BillAuditStatus == BillAuditStatus.AuditPassed)
|
|
|
|
|
return DataResult.Failed($"当前业务的费用状态为:{entity.BillAuditStatus.GetDescription()},无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(string.Format(MultiLanguageConst.BusinessStatusError, entity.BillAuditStatus.GetDescription()));
|
|
|
|
|
|
|
|
|
|
var template = await FindTemplateAsync(AuditType.FeeBusiness);
|
|
|
|
|
if (template == null)
|
|
|
|
|
return DataResult.Failed("未能找到审批模板", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.TemplateNotFound);
|
|
|
|
|
|
|
|
|
|
var result = flowService.CreateFlowInstance(new CreateFlowInstanceReq
|
|
|
|
|
{
|
|
|
|
@ -670,12 +671,13 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//修改关联费用状态为提交审核
|
|
|
|
|
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == entity.BusinessId && x.BusinessType == entity.BusinessType)
|
|
|
|
|
.SetColumns(x => x.FeeStatus, FeeStatus.AuditSubmitted).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("提交成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Failed("创建工作流失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -688,7 +690,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
var list = idArray.Select(x => new FeeRecord { Id = x, IsInvoice = enabled }).ToList();
|
|
|
|
|
int rows = await TenantDb.Updateable(list).UpdateColumns(x => new { x.IsInvoice }).ExecuteCommandAsync();
|
|
|
|
|
return rows > 0 ? DataResult.Successed("设置成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("设置失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -707,7 +709,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.Name
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
if (model == null)
|
|
|
|
|
return DataResult.Failed("未能找到费用对象信息,设置失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.ItemNotFound);
|
|
|
|
|
|
|
|
|
|
var list = idArray.Select(x => new FeeRecord
|
|
|
|
|
{
|
|
|
|
@ -718,7 +720,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
CustomerType = customerType
|
|
|
|
|
}).ToList();
|
|
|
|
|
int rows = await TenantDb.Updateable(list).UpdateColumns(x => new { x.CustomerId, x.CustomerCode, x.CustomerName, x.CustomerType }).ExecuteCommandAsync();
|
|
|
|
|
return rows > 0 ? DataResult.Successed("设置成功!", MultiLanguageConst.DataUpdateSuccess) : DataResult.Failed("设置失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -739,8 +741,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return DataResult<CostAccountingForm>.Failed(
|
|
|
|
|
$"不支持业务类型为【{businessType.GetDescription()}】的费用打印", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
return DataResult<CostAccountingForm>.Failed(string.Format(
|
|
|
|
|
MultiLanguageConst.BusinessNotSupported, businessType.GetDescription()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (form != null)
|
|
|
|
@ -748,17 +750,17 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
long UserId = long.Parse(User.UserId);
|
|
|
|
|
form.Creator = Db.Queryable<SysUser>().Where(x => x.Id == UserId).Select(x => x.NickName).First();
|
|
|
|
|
|
|
|
|
|
form.ReceivableRMB = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == "CNY").Sum(x => x.Amount);
|
|
|
|
|
form.PayableRMB = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == "CNY").Sum(x => x.Amount);
|
|
|
|
|
form.ReceivableUSD = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == "USD").Sum(x => x.Amount);
|
|
|
|
|
form.PayableUSD = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == "USD").Sum(x => x.Amount);
|
|
|
|
|
form.ReceivableOther = form.Details.FindAll(x => x.Type == FeeType.Receivable && (x.Currency != "CNY" && x.Currency != "USD")).Sum(x => x.Amount);
|
|
|
|
|
form.PayableOther = form.Details.FindAll(x => x.Type == FeeType.Payable && (x.Currency == "CNY" && x.Currency != "USD")).Sum(x => x.Amount);
|
|
|
|
|
form.ReceivableRMB = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == RMB_CODE).Sum(x => x.Amount);
|
|
|
|
|
form.PayableRMB = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == RMB_CODE).Sum(x => x.Amount);
|
|
|
|
|
form.ReceivableUSD = form.Details.FindAll(x => x.Type == FeeType.Receivable && x.Currency == USD_CODE).Sum(x => x.Amount);
|
|
|
|
|
form.PayableUSD = form.Details.FindAll(x => x.Type == FeeType.Payable && x.Currency == USD_CODE).Sum(x => x.Amount);
|
|
|
|
|
form.ReceivableOther = form.Details.FindAll(x => x.Type == FeeType.Receivable && (x.Currency != RMB_CODE && x.Currency != USD_CODE)).Sum(x => x.Amount);
|
|
|
|
|
form.PayableOther = form.Details.FindAll(x => x.Type == FeeType.Payable && (x.Currency == RMB_CODE && x.Currency != USD_CODE)).Sum(x => x.Amount);
|
|
|
|
|
|
|
|
|
|
//获取美元汇率
|
|
|
|
|
var fees = new List<FeeRecord> {
|
|
|
|
|
new FeeRecord { Currency = "USD", FeeType = FeeType.Receivable },
|
|
|
|
|
new FeeRecord { Currency = "USD", FeeType = FeeType.Payable }
|
|
|
|
|
new FeeRecord { Currency = USD_CODE, FeeType = FeeType.Receivable },
|
|
|
|
|
new FeeRecord { Currency = USD_CODE, FeeType = FeeType.Payable }
|
|
|
|
|
};
|
|
|
|
|
await FetchExchangeRateAsync(fees);
|
|
|
|
|
form.ExchangeRate = fees[0].ExchangeRate.HasValue ? fees[0].ExchangeRate.Value : 1;
|
|
|
|
|