Browse Source

更新版本

FoShanPG
Administrator 3 years ago
parent
commit
ef4b6cc5e1
  1. 2
      .vs/VSWorkspaceState.json
  2. 49
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

2
.vs/VSWorkspaceState.json

@ -2,6 +2,6 @@
"ExpandedNodes": [
""
],
"SelectedNode": "\\SettleAccount.sln (src\\Modules\\SettleAccount\\SettleAccount.sln)",
"SelectedNode": "\\SettleAccount.sln (src\\SettleAccount.sln)",
"PreviewInSolutionExplorer": false
}

49
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs

@ -62,14 +62,35 @@ namespace SettleAccount.Job.Services
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version, true);
var erpPriceList = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => new { ParentSapMaterialCode = p.Key.ParentSapMaterialCode, ChassisNumber = p.Key.ChassisNumber, KENNCode = p.Key.KENNCode, Price = p.Sum(itm => itm.InvoicePrice) }).ToList();
// var erpPriceList= _erpdapperRepository.GetErpPartCodePriceList(version);
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version);
if (_ls.Count > 0)
{
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
if (_first != null)
{
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
}
foreach (var itm in _ls)
{
itm.InvocieAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice,2);
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
var erpPriceList = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => new { ParentSapMaterialCode = p.Key.ParentSapMaterialCode, ChassisNumber = p.Key.ChassisNumber, KENNCode = p.Key.KENNCode, Price = p.Sum(itm => itm.InvocieAmt) }).ToList();
var rangList = from itm1 in rangeList
join itm2 in erpPriceList on new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber } equals new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber }
into temp1
@ -95,29 +116,17 @@ namespace SettleAccount.Job.Services
DiffSettleFisQty = 0,
DiffSettleInvQty = 0,
InvoiceQty = 1,
InvoicePrice =itm1==null?0: tm1.Price,
InvocieAmt = itm1 == null ?0: tm1.Price,
SettleAmt = itm1 == null ?0: tm1.Price,
DiffPrice = itm1 == null ?0-itm1.Price: tm1.Price-itm1.Price
InvoicePrice = itm1 == null ? 0 : tm1.Price,
InvocieAmt = itm1 == null ? 0 : tm1.Price ,
SettleAmt = itm1 == null ? 0 : tm1.Price,
DiffPrice = itm1 == null ? 0 - itm1.Price : tm1.Price - itm1.Price
};
rangeList = rangList.ToList();
foreach (var itm in diffList)
{
var _first = _ls.FirstOrDefault(p => p.MaterialCode == itm.MaterialCode);
if (_first != null)
{
_first.InvoiceQty = _first.SettledQty + itm.DiffQty;
_first.DiffSettleInvQty = itm.DiffQty;
}
}
foreach (var itm in _ls)
{
itm.InvocieAmt = Math.Round(itm.InvoiceQty * itm.InvoicePrice,2);
itm.DiffPrice = itm.Price - itm.InvoicePrice;
}
_ls.AddRange(rangeList);
//var list1 = _ls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.SettleReadyQty }).Select(p => new { SettleQty = p.Key.SettleReadyQty, MaterialCode = p.Key.MaterialCode, ChassisNumber = p.Key.ChassisNumber, Qty = p.Sum(itm => itm.Qty) }).Where(p => p.Qty > 1).ToList();

Loading…
Cancel
Save