From b6658814e78ff154776169fe6d508be5e6ad4081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Mon, 16 Jan 2023 15:03:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Prices/PriceListManager.cs | 32 ++++++++++--------- .../HQCarSettledDetailDapperRepository.cs | 2 +- .../InvoicePriceListDiffDapperRepository.cs | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs index 35acc237..aeea34ff 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs @@ -92,29 +92,31 @@ namespace Win.Sfs.SettleAccount.Entities.Prices where itm1.Price != itm2.Price select new PriceList(itm2.Id, itm2.BeginDate, itm2.EndDate, itm1.Price, itm2.MaterialCode, itm2.Type, itm2.ParentId, itm2.Version, itm1.CustomerCode); - if (update.Count() > 0) + + var add = from itm1 in entities + join itm2 in pricelist + on new { itm1.Type, itm1.MaterialCode, itm1.CustomerCode } + equals new { itm2.Type, itm2.MaterialCode, itm2.CustomerCode } + into temp + from itm3 in temp.DefaultIfEmpty() + where itm3 == null + select itm1; + + + + + + if (update!=null&&update.Count() > 0) { await _repository.GetDbContext().BulkUpdateAsync(update.ToList()); } - else + if(add!=null && add.Count()>0) { - var add = from itm1 in entities - join itm2 in pricelist - on new { itm1.Type, itm1.MaterialCode,itm1.CustomerCode } - equals new { itm2.Type, itm2.MaterialCode,itm2.CustomerCode } - into temp - from itm3 in temp.DefaultIfEmpty() - where itm3 == null - select itm1; + await _repository.GetDbContext().BulkInsertAsync(add.ToList()); } - - - - - var _first = _versionRepository.FirstOrDefault(p => p.Version == version); if (_first == null) diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs index 472f608b..3bcbf4ad 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs @@ -161,7 +161,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report "( SELECT SUM ( Qty ) Qty, MaterialCode, Version FROM Set_BT_Car_Platform WHERE version = '{0}' AND StorageLocationDesc NOT LIKE '%备品%' GROUP BY MaterialCode, Version ) A\n" + "LEFT JOIN Set_material AS c ON a.MaterialCode = c.CustomerPartCode\n" + ") temp1\n" + -"LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + +"LEFT OUTER JOIN ( SELECT Price, MaterialCode FROM Set_PriceList WHERE ( Version = ( SELECT MAX ( Version ) AS Expr1 FROM Set_PriceList ) ) ) AS temp2 ON temp1.Sap编码 = temp2.MaterialCode\n" + "LEFT JOIN (\n" + "SELECT\n" + "\n" + diff --git a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoicePriceListDiffDapperRepository.cs b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoicePriceListDiffDapperRepository.cs index 5817bc73..ae573481 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoicePriceListDiffDapperRepository.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoicePriceListDiffDapperRepository.cs @@ -29,7 +29,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccount string sqlString = " SELECT a.Id, a.Year, a.Period, a.Version, a.Factory, a.TextCode, a.MaterialCode, a.MaterialDesc, a.InputDate, a.Qty, a.Amt, \n" + " a.Number, a.Accounting, a.AccountDate, b.BeginDate, b.EndDate, isnull(b.Price,0) Price, b.Type\n" + " FROM Set_Invoice AS a Left JOIN\n" + - " Set_PriceList AS b ON a.MaterialCode = b.MaterialCode\n" + + " (select * from Set_PriceList where customercode='100001') AS b ON a.MaterialCode = b.MaterialCode\n" + " WHERE (a.InputDate BETWEEN b.BeginDate AND b.EndDate) " ; var _query = DbConnection.Query(sqlString); var _list = _query.ToList();