From bfc14604b3fc36a28998e0c43f86353443a7c8f4 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 28 Aug 2024 11:54:54 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BalanceRecordCheckBackgroundService.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Src/Dlhis.Middle/Services/Implements/BalanceRecordCheckBackgroundService.cs b/Src/Dlhis.Middle/Services/Implements/BalanceRecordCheckBackgroundService.cs index 99b71a3c..a117b24b 100644 --- a/Src/Dlhis.Middle/Services/Implements/BalanceRecordCheckBackgroundService.cs +++ b/Src/Dlhis.Middle/Services/Implements/BalanceRecordCheckBackgroundService.cs @@ -69,18 +69,18 @@ public class BalanceRecordCheckBackgroundService : BackgroundService { throw new Exception(r.Msg); } - + var d = r.Data; //更新本地余额表 await db.Updateable() .SetColumns(x => x.Balance == d.Balance) .Where(x => x.UserCode == d.UserCode) .ExecuteCommandAsync(stoppingToken); - + //eg:一定要在此处更新为已同步 balanceRecord.IsSync = true; await db.UpdateAsync(balanceRecord); - + await db.Client.Ado.CommitTranAsync(); } catch (Exception e) @@ -89,6 +89,12 @@ public class BalanceRecordCheckBackgroundService : BackgroundService await db.Client.Ado.RollbackTranAsync(); } } + + balanceRecords = await db.Queryable().Where(x => x.TenantId == factory).Where(x => !x.IsSync).ToListAsync(stoppingToken); + if (!balanceRecords.Any()) + { + _logger.LogInformation("上传离线订单完成"); + } } } catch (Exception e)