|
@ -62,14 +62,35 @@ namespace SettleAccount.Job.Services |
|
|
var rangeList = _erpdapperRepository.GetSapList<InvoiceSettledDetailDiff>(_list, version, true); |
|
|
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 erpPriceList= _erpdapperRepository.GetErpPartCodePriceList(version);
|
|
|
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); |
|
|
var diffList = _erpdapperRepository.GetSettleInvoiceDiff(version); |
|
|
|
|
|
|
|
|
if (_ls.Count > 0) |
|
|
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 |
|
|
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 } |
|
|
join itm2 in erpPriceList on new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber } equals new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber } |
|
|
into temp1 |
|
|
into temp1 |
|
@ -95,29 +116,17 @@ namespace SettleAccount.Job.Services |
|
|
DiffSettleFisQty = 0, |
|
|
DiffSettleFisQty = 0, |
|
|
DiffSettleInvQty = 0, |
|
|
DiffSettleInvQty = 0, |
|
|
InvoiceQty = 1, |
|
|
InvoiceQty = 1, |
|
|
InvoicePrice =itm1==null?0: tm1.Price, |
|
|
InvoicePrice = itm1 == null ? 0 : tm1.Price, |
|
|
InvocieAmt = itm1 == null ?0: tm1.Price, |
|
|
InvocieAmt = itm1 == null ? 0 : tm1.Price , |
|
|
SettleAmt = itm1 == null ?0: tm1.Price, |
|
|
SettleAmt = itm1 == null ? 0 : tm1.Price, |
|
|
DiffPrice = itm1 == null ?0-itm1.Price: tm1.Price-itm1.Price |
|
|
DiffPrice = itm1 == null ? 0 - itm1.Price : tm1.Price - itm1.Price |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
rangeList = rangList.ToList(); |
|
|
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); |
|
|
_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();
|
|
|
//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();
|
|
|