Browse Source

更新版本

master
学 赵 2 years ago
parent
commit
b6658814e7
  1. 18
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  2. 2
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/InvoicePriceListDiffDapperRepository.cs

18
src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs

@ -92,13 +92,7 @@ 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)
{
await _repository.GetDbContext().BulkUpdateAsync(update.ToList());
}
else
{
var add = from itm1 in entities
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode, itm1.CustomerCode }
@ -107,14 +101,22 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
from itm3 in temp.DefaultIfEmpty()
where itm3 == null
select itm1;
await _repository.GetDbContext().BulkInsertAsync<PriceList>(add.ToList());
}
if (update!=null&&update.Count() > 0)
{
await _repository.GetDbContext().BulkUpdateAsync(update.ToList());
}
if(add!=null && add.Count()>0)
{
await _repository.GetDbContext().BulkInsertAsync<PriceList>(add.ToList());
}
var _first = _versionRepository.FirstOrDefault(p => p.Version == version);
if (_first == null)

2
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<InvoicePriceListDiff>(sqlString);
var _list = _query.ToList();

Loading…
Cancel
Save