|
@ -208,7 +208,14 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran |
|
|
var qty = balance.Qty + data.Qty; |
|
|
var qty = balance.Qty + data.Qty; |
|
|
balance.InjectFrom(data); |
|
|
balance.InjectFrom(data); |
|
|
balance.Qty = 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); |
|
|
await _logRepository.InsertAsync(log).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
@ -253,7 +260,14 @@ public class VmiAppService : ApplicationService, IVmiService, IJobService, ITran |
|
|
{ |
|
|
{ |
|
|
var qty = balance.Qty - data.Qty; |
|
|
var qty = balance.Qty - data.Qty; |
|
|
balance.Qty = 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); |
|
|
await _logRepository.InsertAsync(log).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|