|
|
|
@ -382,11 +382,13 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
if (settlement.Details.Exists(x => x.OriginalCurrency.IsNullOrEmpty()))
|
|
|
|
|
return DataResult<TEntity>.FailedWithDesc(nameof(MultiLanguageConst.OriginalCurrencyCanNotNull));
|
|
|
|
|
|
|
|
|
|
settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount);
|
|
|
|
|
result = await PreSaveAsync(settlement);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult<TEntity>.Failed(result.Message, result.MultiCode);
|
|
|
|
|
|
|
|
|
|
if (settlement.Details.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result = await PreSaveAsync(settlement);
|
|
|
|
|
if (!result.Succeeded)
|
|
|
|
|
return DataResult<TEntity>.Failed(result.Message, result.MultiCode);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var details = settlement.Details.FindAll(x => x.Id == 0);
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
try
|
|
|
|
@ -394,6 +396,8 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
//关联导航属性插入
|
|
|
|
|
if (settlement.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount);
|
|
|
|
|
|
|
|
|
|
//创建时需要生成申请单编号
|
|
|
|
|
var sequence = CommonService.Value. GetSequenceNext<TEntity>();
|
|
|
|
|
if (!sequence.Succeeded)
|
|
|
|
@ -410,6 +414,10 @@ namespace DS.WMS.Core.Settlement.Method
|
|
|
|
|
if (details.Count > 0)
|
|
|
|
|
await TenantDb.Insertable(details).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
////更新结算金额
|
|
|
|
|
//var dbDetails = await TenantDb.Queryable<ApplicationDetail>().Where(x => x.ApplicationId == settlement.Id)
|
|
|
|
|
// .Select(x => new { x.ApplyAmount, x.Currency }).ToListAsync();
|
|
|
|
|
|
|
|
|
|
await TenantDb.Updateable(settlement).IgnoreColumns(x => new
|
|
|
|
|
{
|
|
|
|
|
x.ApplicationNO,
|
|
|
|
|