From e7f3de855071334a985c09621c9c2807a89fa485 Mon Sep 17 00:00:00 2001 From: lvzb <35200379@qq.com> Date: Wed, 8 Nov 2023 15:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E5=82=A8=E8=AE=B0=E5=BD=95=E5=8F=B7?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MsgCheck/BillM100s/BillM100AppService.cs | 7 +----- .../PrintTable/WaitPrintAppService.cs | 2 +- .../Services/BillNumberRecordDomainService.cs | 22 ++++++++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs index c1bedb0..34239cc 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/MsgCheck/BillM100s/BillM100AppService.cs @@ -192,13 +192,8 @@ namespace WY.NewJit.MsgCheck [UnitOfWork] [HttpPost] [Route("get-billnumber")] - public async Task GetBillNumber(int number, string productLine, bool t) + public async Task GetBillNumber(int number, string productLine) { - if (t) - { - _aaa.CleanBillNumberRecordCache(); - } - var res = await _aaa.GetBillNumber(number, productLine); return res; } diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs index 33ea011..c37e759 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Application/PrintTable/WaitPrintAppService.cs @@ -150,7 +150,7 @@ namespace WY.NewJit.PrintTable /// /// /// - public async Task GetEntityCountAsync(string tableName, string where) + private async Task GetEntityCountAsync(string tableName, string where) { string sql = $"select count(*) from {tableName} where 1=1 {where}"; var ret = await _newJitDapperRepository.GetSingleBySqlAsync(sql); diff --git a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs index 61dbe7f..5b7bfc1 100644 --- a/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs +++ b/src/Modules/新版JIT或JIS系统服务端/src/WY.NewJit.Domain/MsgCheck/Services/BillNumberRecordDomainService.cs @@ -32,13 +32,6 @@ namespace WY.NewJit.MsgCheck _waitPrintRepository = waitPrintRepository; } /// - /// 清空缓存 - /// - public void CleanBillNumberRecordCache() - { - _billNumberRecordCaches.Clear(); - } - /// /// 获取和更新记录和内存 /// /// @@ -49,9 +42,22 @@ namespace WY.NewJit.MsgCheck if (isupdate) { await _billNumberRepository.UpdateManyAsync(_billNumberRecordCaches); + foreach (var item in _billNumberRecordCaches) + { + var re = await _billNumberRepository.GetListAsync(r=>r.Id==item.Id); + if (re.Count == 0) + { + await _billNumberRepository.InsertAsync(item); + } + else + { + await _billNumberRepository.UpdateAsync(item); + } + } } else { + _billNumberRecordCaches.Clear(); _billNumberRecordCaches = await _billNumberRepository.GetListAsync(); foreach (var item in _billNumberRecordCaches) { @@ -86,7 +92,7 @@ namespace WY.NewJit.MsgCheck GuidGenerator.Create(), productLine, 1, - 0, + number, 0, DateTime.Now );