Browse Source

更新版本

FoShanPG
Administrator 2 years ago
parent
commit
6c2bef61d7
  1. 12
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs
  2. 11
      src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Prices/PriceListManager.cs
  3. 21
      src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs

12
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs

@ -160,8 +160,17 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PriceListBJImportDto>(files, _excelImportService);
List<string> _checkls = new List<string>();
_checkls.Add("100001");
_checkls.Add("100053");
_checkls.Add("100113");
var entityList = ObjectMapper.Map<List<PriceListBJImportDto>, List<PriceListBJ>>(result);
var _ls = entityList.Where(p=>p.EndDate.ToString().Contains("9999")).OrderByDescending(p => p.BeginDate).GroupBy(p => new { p.MaterialCode, p.CustomerCode,p.Type }).Select(p=>p.FirstOrDefault());
@ -172,6 +181,9 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
_ls=_ls.Where(p => p.Type == 20).ToList();
await _mng.ImportAsync(_ls.ToList(), version);
return ApplicationConsts.SuccessStr;
}

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

@ -85,7 +85,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var update = from itm1 in entities
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode } equals new { itm2.Type, itm2.MaterialCode }
on new { itm1.Type, itm1.MaterialCode,itm1.CustomerCode } equals new { itm2.Type, itm2.MaterialCode, itm2.CustomerCode }
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);
@ -246,13 +246,12 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
var update = from itm1 in entities
join itm2 in pricelist
on new { itm1.Type, itm1.MaterialCode } equals new { itm2.Type, itm2.MaterialCode }
on new { itm1.Type, itm1.MaterialCode ,itm1.CustomerCode} equals new { itm2.Type, itm2.MaterialCode ,itm2.CustomerCode}
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
@ -268,12 +267,6 @@ namespace Win.Sfs.SettleAccount.Entities.Prices
await _repository.GetDbContext().BulkInsertAsync<PriceListBJ>(add.ToList());
}
var _first = _versionRepository.FirstOrDefault(p => p.Version == version);
if (_first == null)
{

21
src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/HQCarSettledDetailDapperRepository.cs

@ -163,8 +163,12 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
") 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 JOIN (\n" +
" SELECT SUM\n" +
" ( Amt ) / SUM ( Qty ) AS Price,\n" +
"SELECT\n" +
"\n" +
"case SUM(Qty) when 0 then 0 else\n" +
"SUM( Amt ) / SUM ( Qty )\n" +
"\n" +
"end AS Price,\n" +
"MaterialCode,\n" +
"Version\n" +
"FROM\n" +
@ -175,7 +179,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"GROUP BY\n" +
"MaterialCode,\n" +
"Version\n" +
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
") AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode\n";
@ -304,8 +308,13 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
") 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 JOIN (\n" +
" SELECT SUM\n" +
" ( Amt ) / SUM ( Qty ) AS Price,\n" +
"SELECT\n" +
"case SUM(Qty) when 0 then 0 else\n" +
"\n" +
"SUM\n" +
"( Amt ) / SUM ( Qty )\n" +
"end\n" +
"AS Price,\n" +
"MaterialCode,\n" +
"Version\n" +
"FROM\n" +
@ -316,7 +325,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"GROUP BY\n" +
"MaterialCode,\n" +
"Version\n" +
" ) AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode";
") AS TEMP3 ON temp1.[结算物料号] = temp3.MaterialCode\n";

Loading…
Cancel
Save