44673626 2 years ago
parent
commit
fbd569a2c4
  1. 29
      src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs
  2. 27
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs
  3. 51
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs
  4. 18
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs
  5. 24
      src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

29
src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs

@ -92,7 +92,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
//_relationshipRepository = relationshipRepository; //_relationshipRepository = relationshipRepository;
_mapRepository = mapRepository; _mapRepository = mapRepository;
_bomversionRepository = bomversionRepository; _bomversionRepository = bomversionRepository;
} }
@ -143,7 +142,7 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
var checkList = new List<ErrorExportDto>(); var checkList = new List<ErrorExportDto>();
foreach (var itm in _ls) foreach (var itm in _ls)
{ {
var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.MaterialCode==itm.MaterialCode && p.WmsBillNum==itm.WmsBillNum); var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.CustomerMaterialCode==itm.CustomerMaterialCode && p.WmsBillNum==itm.WmsBillNum);
if (_first == null) if (_first == null)
{ {
var entity = new ErrorBill( var entity = new ErrorBill(
@ -194,10 +193,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
} }
///// <summary>
/// <summary> /// <summary>
/// 根据筛选条件获取实体列表 /// 根据筛选条件获取实体列表
/// </summary> /// </summary>
@ -248,18 +243,6 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
} }
/// <summary>
/// 新增实体
/// </summary>
/// <param name="input">新增实体DTO</param>
/// <returns>实体DTO</returns>
/// <summary> /// <summary>
/// 删除实体 /// 删除实体
/// </summary> /// </summary>
@ -302,16 +285,11 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
string _fileName = string.Format("错误单据输出_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")); string _fileName = string.Format("错误单据输出_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd"));
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue,
0, true); 0, true);
var dtoDetails = ObjectMapper.Map<List<ErrorBill>, List<ErrorBillExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<ErrorBill>, List<ErrorBillExportDto>>(entities);
//声明导出容器 //声明导出容器
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtoDetails); var result = await _exportImporter.ExcelExporter(dtoDetails);
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync( await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto new SaveExcelImportInputDto
@ -322,10 +300,5 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills
); );
return _fileName; return _fileName;
} }
} }
} }

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

@ -58,6 +58,24 @@ namespace SettleAccount.Job.Services
var materialGroup = p_list.Where(p => p.Name == "MaterialGroup").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 sapCode = p_list.Where(p => p.Name == "SapCode").FirstOrDefault().Value;
var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup); var _ls = _dapperRepository.GetInvoiceSettledDetailDiffReportList(version, materialCode, begin, end, cp7begin, cp7end, kenncode, chassisNumber, materialGroup);
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 _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode }) var _list = _ls.Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).GroupBy(p => new { p.ParentSapMaterialCode, p.ChassisNumber, p.KENNCode })
.Select(p => p.FirstOrDefault()).ToList(); .Select(p => p.FirstOrDefault()).ToList();
@ -191,17 +209,10 @@ 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;
_outputService.Export<InvoiceSettledDetailDiff>(id, _filename, query.ToList()); _outputService.Export<InvoiceSettledDetailDiff>(id, _filename, _ls.ToList());
return id.ToString(); return id.ToString();
} }

51
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettleDiffExportService.cs

@ -11,7 +11,9 @@ using TaskJob.Interfaces;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.UnSettle; using Win.Sfs.SettleAccount.Entities.UnSettle;
using Win.Sfs.SettleAccount.Errors;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
@ -51,12 +53,13 @@ namespace SettleAccount.Job.Services.Report
private readonly ErpPartDapperRepository _erpdapperRepository; private readonly ErpPartDapperRepository _erpdapperRepository;
private readonly UnSettledDetailDapperRepository _dapper1; private readonly UnSettledDetailDapperRepository _dapper1;
private readonly IBlobContainer<MyFileContainer> _fileContainer; private readonly IBlobContainer<MyFileContainer> _fileContainer;
private readonly ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> _errorListRepository;
public UnSettleDiffExportService(UnSettleDiffDapperRepository dapper, OutputService outputService, public UnSettleDiffExportService(UnSettleDiffDapperRepository dapper, OutputService outputService,
UnSettledDetailDapperRepository dapper1, UnSettledDetailDapperRepository dapper1,
ErpPartDapperRepository erpdapperRepository, ErpPartDapperRepository erpdapperRepository,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
UnSettledDetailDapperRepository dapper2 UnSettledDetailDapperRepository dapper2,
ISettleAccountBranchEfCoreRepository<ErrorBill, Guid> errorListRepository
) )
{ {
_erpdapperRepository = erpdapperRepository; _erpdapperRepository = erpdapperRepository;
@ -65,6 +68,7 @@ namespace SettleAccount.Job.Services.Report
_dapper1 = dapper1; _dapper1 = dapper1;
_fileContainer = fileContainer; _fileContainer = fileContainer;
_dapper2 = dapper2; _dapper2 = dapper2;
_errorListRepository = errorListRepository;
} }
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> p_list)
@ -83,6 +87,21 @@ namespace SettleAccount.Job.Services.Report
var _ls = new List<UnSettleDiff>(); var _ls = new List<UnSettleDiff>();
_ls = _dapper.GetDiffReport1(0,begin,end, materialCode,kenncode,chassisNumber,version); _ls = _dapper.GetDiffReport1(0,begin,end, materialCode,kenncode,chassisNumber,version);
var _checkList = _errorListRepository.ToList();
var q = 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 = q.ToList();
//foreach (var itm in _ls) //foreach (var itm in _ls)
//{ //{
// if (itm.KENNCode.Length > 8) // if (itm.KENNCode.Length > 8)
@ -331,20 +350,15 @@ namespace SettleAccount.Job.Services.Report
var _checkList = _errorListRepository.ToList();
//foreach (var itm in _list) var q= from itm in _list
//{ join itm1 in _checkList on new { ChassisNumber = itm.ChassisNumber, MaterialCode = itm.MaterialCode, WmsBillNum = itm.WmsBillNum }
// if (itm.UnSettleQty > 0) equals new { ChassisNumber = itm1.BillNum, MaterialCode = itm1.MaterialCode, WmsBillNum = itm1.WmsBillNum } into temp1
// { from tm1 in temp1.DefaultIfEmpty()
// itm.UnSettleQty = 1; where tm1 == null
// } select itm;
// itm.DiffQty = itm.Qty - itm.UnSettleQty; _list = q.ToList();
// if (itm.DiffQty == 0)
// {
// itm.DiffAMT = 0;
// }
//}
var _ls = _list.Where(p => p.Flag != "L" ).Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).Where(p => !p.ParentSapMaterialCode.Contains(",")).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList(); var _ls = _list.Where(p => p.Flag != "L" ).Where(p => p.ParentSapMaterialCode != p.SapMaterialCode).Where(p => !p.ParentSapMaterialCode.Contains(",")).GroupBy(p => new { p.KENNCode, p.ChassisNumber, p.ParentSapMaterialCode }).Select(p => p.FirstOrDefault()).ToList();
var _compareLs = _ls.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode }); var _compareLs = _ls.Where(p => p.DiffQty == 0).Select(p => new { p.ChassisNumber, p.KENNCode, p.ParentSapMaterialCode });
@ -378,14 +392,7 @@ namespace SettleAccount.Job.Services.Report
rangeList = query.ToList(); rangeList = query.ToList();
//_lst.ForEach(p =>
//{
// p.Qty = 1;
// p.DiffAMT = 0;
// p.DiffQty = 1;
//}
//);
_list.AddRange(rangeList); _list.AddRange(rangeList);
if (!string.IsNullOrEmpty(materialGroup)) if (!string.IsNullOrEmpty(materialGroup))
{ {

18
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs

@ -135,6 +135,15 @@ namespace SettleAccount.Job.Services.Report
var datetime = date.ToShortDateString() + " 23:59:59 "; var datetime = date.ToShortDateString() + " 23:59:59 ";
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, datetime, "", version, materailCode, materialGroup, ""); var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, datetime, "", version, materailCode, materialGroup, "");
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();
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 _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); var _lst = _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p => _lst.ForEach(p =>
@ -193,15 +202,6 @@ namespace SettleAccount.Job.Services.Report
} }
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();

24
src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs

@ -56,6 +56,20 @@ namespace SettleAccount.Job.Services.Report
var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version,materailCode,materialGroup,sapcode); var _list = _dapper.GetDiffReport(DateTime.Now.Year.ToString(), begin, end, customerCode, version,materailCode,materialGroup,sapcode);
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();
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 _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); var _lst= _erpDapper.GetSapList(_ls, version, false);
_lst.ForEach(p => _lst.ForEach(p =>
@ -110,16 +124,6 @@ namespace SettleAccount.Job.Services.Report
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;
_list = query.ToList();
// var removeList= _dapper.GetRemoveDetail(); // var removeList= _dapper.GetRemoveDetail();

Loading…
Cancel
Save