|
|
@ -11,6 +11,8 @@ using TaskJob.Interfaces; |
|
|
|
using Volo.Abp.BlobStoring; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
using Win.Sfs.BaseData.ImportExcelCommon; |
|
|
|
using Win.Sfs.SettleAccount; |
|
|
|
using Win.Sfs.SettleAccount.Errors; |
|
|
|
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; |
|
|
|
using Win.Sfs.SettleAccount.Repository.SettleAccount; |
|
|
|
using Win.Sfs.SettleAccount.Repository.SettleAccountJob; |
|
|
@ -52,7 +54,7 @@ namespace SettleAccount.Job.Services |
|
|
|
private readonly ErpPartDapperRepository _erpdapperRepository; |
|
|
|
|
|
|
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
|
|
|
|
|
|
private readonly ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> _errorListRepository; |
|
|
|
|
|
|
|
private readonly OutputService _outputService; |
|
|
|
private readonly InputService _inputService; |
|
|
@ -63,7 +65,9 @@ namespace SettleAccount.Job.Services |
|
|
|
InvoiceSettledDetailDiffDapperRepository dapperRepository1, |
|
|
|
OutputService outputService, |
|
|
|
InputService inputService, |
|
|
|
UnSettledDetailDapperRepository dapperRepository2 |
|
|
|
UnSettledDetailDapperRepository dapperRepository2, |
|
|
|
|
|
|
|
ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> errorListRepository |
|
|
|
) |
|
|
|
{ |
|
|
|
_fileContainer = fileContainer; |
|
|
@ -75,6 +79,7 @@ namespace SettleAccount.Job.Services |
|
|
|
_dapperRepository =dapperRepository; |
|
|
|
_dapperRepository1 = dapperRepository1; |
|
|
|
_dapperRepository2 = dapperRepository2; |
|
|
|
_errorListRepository = errorListRepository; |
|
|
|
} |
|
|
|
|
|
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) |
|
|
@ -147,6 +152,20 @@ namespace SettleAccount.Job.Services |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var _checkList = _errorListRepository.ToList(); |
|
|
|
|
|
|
|
var query = from itm in _ls |
|
|
|
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum } |
|
|
|
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1 |
|
|
|
from tm1 in temp1.DefaultIfEmpty() |
|
|
|
where tm1 == null |
|
|
|
select itm; |
|
|
|
|
|
|
|
|
|
|
|
_ls=query.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _lsSum=_ls.GroupBy(p => new { p.MaterialCode, p.SapMaterialCode, p.MaterialGroup,p.InvoicePrice }).Select(p => new UnInvoiceSettledDetailSum |
|
|
|
{ |
|
|
|
MaterialCode = p.Key.MaterialCode, |
|
|
@ -328,11 +347,26 @@ namespace SettleAccount.Job.Services |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var _checkList = _errorListRepository.ToList(); |
|
|
|
|
|
|
|
var query = from itm in _ls |
|
|
|
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum } |
|
|
|
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1 |
|
|
|
from tm1 in temp1.DefaultIfEmpty() |
|
|
|
where tm1 == null |
|
|
|
select itm; |
|
|
|
|
|
|
|
|
|
|
|
_ls = query.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//.Select(p => p.FirstOrDefault());
|
|
|
|
_ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return _ls; |
|
|
|
} |
|
|
|
public List<SettleDoorPanelSumExport> LSettleSum(Guid id, List<string> exportName, List<CustomCondition> p_list) |
|
|
@ -360,16 +394,7 @@ namespace SettleAccount.Job.Services |
|
|
|
|
|
|
|
var _list = _dapperRepository2.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, "", version,"", 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 = _erpDapper.GetSapList(_ls, version, false);
|
|
|
|
//_lst.ForEach(p =>
|
|
|
|
//{
|
|
|
|
|
|
|
|
// p.Qty = 1;
|
|
|
|
// p.DiffAMT = Math.Round(p.Qty * p.Price, 2);
|
|
|
|
// p.DiffQty = 1;
|
|
|
|
//}
|
|
|
|
//);
|
|
|
|
//_list.AddRange(_lst);
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(materialGroup)) |
|
|
|
{ |
|
|
|
var _groupList = materialGroup.Split(new char[] { ',' }).Distinct().ToList(); |
|
|
@ -402,14 +427,23 @@ namespace SettleAccount.Job.Services |
|
|
|
_list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
//if (!string.IsNullOrEmpty(materailCode))
|
|
|
|
//{
|
|
|
|
// var _groupList = materailCode.Split(new char[] { '\n' }).Distinct().ToList();
|
|
|
|
// if (_groupList.Count() > 0)
|
|
|
|
// {
|
|
|
|
// _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList();
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
var _checkList = _errorListRepository.ToList(); |
|
|
|
|
|
|
|
var query = from itm in _list |
|
|
|
join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum } |
|
|
|
equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1 |
|
|
|
from tm1 in temp1.DefaultIfEmpty() |
|
|
|
where tm1 == null |
|
|
|
select itm; |
|
|
|
|
|
|
|
|
|
|
|
_list = query.ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_list = _list.OrderBy(p => p.ChassisNumber).ThenBy(p => p.SapMaterialCode).ThenBy(p => p.Flag).ToList(); |
|
|
|
|
|
|
|
var report2List = _ls.Where(p=>p.UnSettleVersion==version).Select(p => new { p.MaterialGroup, DiffAmt = p.Price * p.Qty }).GroupBy(p => new { p.MaterialGroup }).Select(p => new SettleDoorPanelSumExport { MaterialGroup = p.Key.MaterialGroup, InvoiceDiffPrice = p.Sum(itm => itm.DiffAmt), Version = version }); |
|
|
|