From 4aeea4a94bbf1795783b8702fb135e614de7e86d Mon Sep 17 00:00:00 2001 From: wanggang <76527413@qq.com> Date: Mon, 7 Aug 2023 16:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AF=84=E5=94=AE=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E6=8E=A5=E5=8F=A3=EF=BC=8C=E6=B7=BB=E5=8A=A00?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/VmiAppService.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs index fcf43679..ca88eca7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs @@ -208,7 +208,14 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran var qty = balance.Qty + data.Qty; balance.InjectFrom(data); balance.Qty = qty; - this._balanceRepository.UpdateAsync(balance).Wait(); + if (balance.Qty == decimal.Zero) + { + await this._balanceRepository.DeleteAsync(balance).ConfigureAwait(false); + } + else + { + await this._balanceRepository.UpdateAsync(balance).ConfigureAwait(false); + } } await _logRepository.InsertAsync(log).ConfigureAwait(false); } @@ -253,7 +260,14 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran { var qty = balance.Qty - data.Qty; balance.Qty = qty; - this._balanceRepository.UpdateAsync(balance).Wait(); + if (balance.Qty == decimal.Zero) + { + await this._balanceRepository.DeleteAsync(balance).ConfigureAwait(false); + } + else + { + await this._balanceRepository.UpdateAsync(balance).ConfigureAwait(false); + } } await _logRepository.InsertAsync(log).ConfigureAwait(false); }