|
|
@ -244,8 +244,6 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
public List<UnSettleDetailReport> ExportList( List<CustomCondition> p_list) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var version = p_list.Where(p => p.Name == "Version").FirstOrDefault().Value; |
|
|
|
var materialCode = p_list.Where(p => p.Name == "MaterialCode").FirstOrDefault().Value; |
|
|
|
var begin = p_list.Where(p => p.Name == "BeginTime").FirstOrDefault().Value; |
|
|
@ -254,23 +252,53 @@ namespace SettleAccount.Job.Services.Report |
|
|
|
var chassisNumber = p_list.Where(p => p.Name == "ChassisNumber").FirstOrDefault().Value; |
|
|
|
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").FirstOrDefault().Value; |
|
|
|
var sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value; |
|
|
|
|
|
|
|
|
|
|
|
//var cp7begin = p_list.Where(p => p.Name == "CP7Begin").FirstOrDefault().Value;
|
|
|
|
//var cp7end = p_list.Where(p => p.Name == "CP7End").FirstOrDefault().Value;
|
|
|
|
var _list = _dapper1.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, string.Empty, version, materialCode, materialGroup, sapCode); |
|
|
|
var _compareLs = _list.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode }); |
|
|
|
|
|
|
|
|
|
|
|
var _list = _dapper1.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, string.Empty, version, materialCode, materialGroup, sapCode); |
|
|
|
var _ls = _list.Where(p => p.Flag != "L").Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); |
|
|
|
var _lst = _erpdapperRepository.GetSapList(_ls, version, false); |
|
|
|
_lst.ForEach(p => |
|
|
|
{ |
|
|
|
p.Qty = 1; |
|
|
|
p.DiffAMT = p.Qty * p.Price; |
|
|
|
p.DiffQty = 1; |
|
|
|
} |
|
|
|
); |
|
|
|
_list.AddRange(_lst); |
|
|
|
var rangeList = _erpdapperRepository.GetSapList(_ls, version, false); |
|
|
|
|
|
|
|
var query = from itm1 in rangeList |
|
|
|
join itm2 in _compareLs on |
|
|
|
new { itm1.ParentSapMaterialCode, itm1.KENNCode, itm1.ChassisNumber } equals |
|
|
|
new { itm2.ParentSapMaterialCode, itm2.KENNCode, itm2.ChassisNumber } |
|
|
|
into temp1 |
|
|
|
from tm1 in temp1.DefaultIfEmpty() |
|
|
|
select new UnSettleDetailReport |
|
|
|
{ |
|
|
|
WmsBillNum = itm1.WmsBillNum, |
|
|
|
CP5Time = itm1.CP5Time, |
|
|
|
KENNCode = itm1.KENNCode, |
|
|
|
ChassisNumber = itm1.ChassisNumber, |
|
|
|
WmsState = itm1.WmsState, |
|
|
|
SapMaterialCode = itm1.SapMaterialCode, |
|
|
|
MaterialDesc = itm1.MaterialDesc, |
|
|
|
MaterialCode = itm1.MaterialCode, |
|
|
|
ParentSapMaterialCode = itm1.ParentSapMaterialCode, |
|
|
|
ParentMaterialDesc = itm1.ParentMaterialDesc, |
|
|
|
MaterialGroup = itm1.MaterialGroup, |
|
|
|
Price = itm1.Price, |
|
|
|
Amt = itm1.Amt, |
|
|
|
Qty = 1, |
|
|
|
UnSettleQty = tm1 != null ? 1 : 0, |
|
|
|
DiffQty = tm1 != null ? 0 : -1, |
|
|
|
DiffAMT = tm1 != null ? 0 : Math.Round(itm1.Qty * itm1.Price) |
|
|
|
}; |
|
|
|
|
|
|
|
rangeList = query.ToList(); |
|
|
|
|
|
|
|
//_lst.ForEach(p =>
|
|
|
|
//{
|
|
|
|
|
|
|
|
// p.Qty = 1;
|
|
|
|
// p.DiffAMT = 0;
|
|
|
|
// p.DiffQty = 1;
|
|
|
|
//}
|
|
|
|
//);
|
|
|
|
_list.AddRange(rangeList); |
|
|
|
if (!string.IsNullOrEmpty(materialGroup)) |
|
|
|
{ |
|
|
|
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); |
|
|
|