From ac58e9a43c492e58faae26041f1fcd5fc8c3fb8c Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 27 Jun 2022 14:53:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Materials/MaterialDtoBase.cs | 5 +- .../ErrorListBill/ErrorBillAppService.cs | 82 ++++++++----------- .../ReportServices/ReportMakeService.cs | 5 +- .../Entities/ErrorBillNum/ErrorBillNum.cs | 11 +++ .../InvoiceSettledDetailDiffExportService.cs | 20 ++++- ...UnInvoiceSettledDetailDiffExportService.cs | 74 ++++++++++++----- .../Services/Report/UnSettledSumService.cs | 22 ++++- .../Services/Report/UnsettledDetailReport.cs | 39 +++++++-- 8 files changed, 172 insertions(+), 86 deletions(-) diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs index 5cce368d..07f0059d 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/Materials/MaterialDtoBase.cs @@ -54,18 +54,21 @@ namespace Win.Sfs.SettleAccount.Entities.Errors public class ErrorBillExportDto { /// - ///错误单据号 + ///底盘或看板号 /// + [ExporterHeader(DisplayName = "底盘|看板号|订单号", IsBold = true)] public string BillNum { get; protected set; } /// /// 物料号 /// + [ExporterHeader(DisplayName = "物料号", IsBold = true)] public string MaterialCode { set; get; } /// /// 发货单号 /// + [ExporterHeader(DisplayName = "交货单号", IsBold = true)] public string WmsBillNum { set; get; } } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs index 3b5e31a0..f6195929 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/ErrorListBill/ErrorBillAppService.cs @@ -35,8 +35,7 @@ using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.EstimatedInventories; using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExportReports; - - +using Win.Sfs.SettleAccount.Reports; using Win.Sfs.Shared.CacheBase; using Win.Utils; namespace Win.Sfs.SettleAccount.Entities.ErrorBills @@ -102,22 +101,32 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills /// /// 上传的文件(前端已经限制只能上传一个附件) /// - [HttpPost] - [Route("ExcelImport")] - [DisableRequestSizeLimit] + //[HttpPost] + //[Route("ExcelImport")] + //[DisableRequestSizeLimit] - public async Task ErrorBillUploadExcelImportMap([FromForm] IFormFileCollection files,string version) - { - ExportImporter _exportImporter = new ExportImporter(); - var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); - return ApplicationConsts.SuccessStr; - } + //public async Task ErrorBillUploadExcelImportMap([FromForm] IFormFileCollection files,string version) + //{ + // ExportImporter _exportImporter = new ExportImporter(); + // var result = await _exportImporter.ExtendExcelImport(files, _excelImportService); + // return ApplicationConsts.SuccessStr; + //} + public List RemoveError(List p_list) where T : ReportDetailBase, new () + { + + + return p_list; + + + } + + /// @@ -137,45 +146,18 @@ namespace Win.Sfs.SettleAccount.Entities.ErrorBills var checkList = new List(); foreach (var itm in _ls) { - - - - //var _first = await _repository.FirstOrDefaultAsync(p => p.ErrorBillCode == itm.ErrorBillCode); - //if (_first == null) - //{ - //var entity = new ErrorBill( - // GuidGenerator.Create(), - // GuidGenerator.Create(), - // itm.Factory, - // itm.ErrorBillCode, - // itm.ErrorBillDesc, - // itm.Unit, - // itm.EstimateType, - // itm.EstimateTypeDesc - // ); - // await _repository.InsertAsync(entity); - //} - //else - //{ - //_first.Update(itm.ErrorBillDesc, itm.Unit, itm.EstimateType, itm.EstimateTypeDesc, itm.Factory - // ); - //await _repository.UpdateAsync(_first); - //} - //var _f = await _relationshipRepository.FirstOrDefaultAsync(p => p.ErpErrorBillCode == itm.ErrorBillCode); - //if (_f != null) - //{ - // _f.Update(itm.ErrorBillDesc, _f.ErrorBillProperty, _f.SettleErrorBillCode, _f.ShipMaterailCode); - // await _relationshipRepository.UpdateAsync(_f); - //} - //else - //{ - // var _r = new ErrorBillRelationship(GuidGenerator.Create(), GuidGenerator.Create(), itm.ErrorBillCode, itm.ErrorBillDesc, string.Empty, string.Empty, string.Empty, itm.EstimateType); - // await _relationshipRepository.InsertAsync(_r); - //} - - - - + var _first = await _repository.FirstOrDefaultAsync(p => p.BillNum == itm.BillNum && p.MaterialCode==itm.MaterialCode && p.WmsBillNum==itm.WmsBillNum); + if (_first == null) + { + var entity = new ErrorBill( + GuidGenerator.Create(), + GuidGenerator.Create(), + itm.BillNum, + itm.MaterialCode, + itm.WmsBillNum + ); + await _repository.InsertAsync(entity); + } } return ApplicationConsts.SuccessStr; } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs index c8da3886..9b1ecd67 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Application/Reports/ReportServices/ReportMakeService.cs @@ -482,7 +482,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices [HttpPost] [Route("InvoiceSettledDetailDiff-Make")] [DisableRequestSizeLimit] - + [UnitOfWork(false)] public async Task InvoiceSettledDetailDiffMake( BaseRequestDto request ) @@ -515,7 +515,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices [HttpPost] [Route("UnInvoiceSettledDetailDiff-Make")] [DisableRequestSizeLimit] - + [UnitOfWork(false)] public async Task UnInvoiceSettledDetailDiffMake( BaseRequestDto request ) @@ -549,6 +549,7 @@ namespace Win.Sfs.SettleAccount.Reports.ReportServices [HttpPost] [Route("UnsettledDetailReportService-Make")] [DisableRequestSizeLimit] + [UnitOfWork(false)] public async Task UnsettledDetailReportServiceMake( BaseRequestDto input diff --git a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ErrorBillNum/ErrorBillNum.cs b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ErrorBillNum/ErrorBillNum.cs index 9cc5b4bb..005ac1d8 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ErrorBillNum/ErrorBillNum.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/ErrorBillNum/ErrorBillNum.cs @@ -11,6 +11,17 @@ namespace Win.Sfs.SettleAccount.Errors /// public class ErrorBill : FullAuditedAggregateRootBase { + public ErrorBill( + Guid id, + Guid branchId, + string billNum, string materialCode, string wmsBillNum):base(id) + { + BranchId = branchId; + BillNum = billNum; + MaterialCode = materialCode; + WmsBillNum = wmsBillNum; + } + /// ///错误单据号 /// diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs index 95c25bde..4e909b76 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/InvoiceSettledDetailDiffExportService.cs @@ -6,6 +6,8 @@ using System.Threading.Tasks; using TaskJob.EventArgs; using TaskJob.Interfaces; using Volo.Abp.DependencyInjection; +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; @@ -21,12 +23,12 @@ namespace SettleAccount.Job.Services private readonly InvoiceSettledDetailDiffDapperRepository _dapperRepository; private readonly ErpPartDapperRepository _erpdapperRepository; - + private readonly ISettleAccountBranchEfCoreRepository _errorListRepository; private readonly OutputService _outputService; private readonly InputService _inputService; public InvoiceSettledDetailDiffExportService( - + ISettleAccountBranchEfCoreRepository errorListRepository, ErpPartDapperRepository erpdapperRepository, InvoiceSettledDetailDiffDapperRepository dapperRepository, OutputService outputService, @@ -39,6 +41,7 @@ namespace SettleAccount.Job.Services //_repository = repository; //_versionRepository = versionRepository; _dapperRepository =dapperRepository; + _errorListRepository=errorListRepository; } public string ExportFile(Guid id, List exportName, List p_list) @@ -187,7 +190,18 @@ namespace SettleAccount.Job.Services _ls = _ls.OrderBy(p => p.ChassisNumber).ThenBy(p => p.KENNCode).ThenBy(p => p.SapMaterialCode).ToList(); } - _outputService.Export(id, _filename, _ls); + + 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(id, _filename, query.ToList()); return id.ToString(); } diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs index a4791e7b..306f26e4 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnInvoiceSettledDetailDiffExportService.cs @@ -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 _fileContainer; - + private readonly ISettleAccountBranchEfCoreRepository _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 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 exportName, List 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 LSettleSum(Guid id, List exportName, List 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 }); diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs index 2675f8db..61634764 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnSettledSumService.cs @@ -12,6 +12,8 @@ using Volo.Abp.BlobStoring; using Volo.Abp.DependencyInjection; using Volo.Abp.Uow; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount; +using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; namespace SettleAccount.Job.Services.Report @@ -56,6 +58,7 @@ namespace SettleAccount.Job.Services.Report private readonly OutputService _outputService; private readonly ErpPartDapperRepository _erpDapper; private readonly SettleSparePartDapperReportRepository _sparepartdapper; + private readonly ISettleAccountBranchEfCoreRepository _errorListRepository; private readonly IBlobContainer _fileContainer; public UnSettledSumService( HQHSettledDetailDapperRepository hqkanbanDapper, @@ -65,7 +68,8 @@ namespace SettleAccount.Job.Services.Report ErpPartDapperRepository erpDapper, WmsDapperRepository wmsDapper, SettleSparePartDapperReportRepository sparepartdapper, - IBlobContainer fileContainer + IBlobContainer fileContainer, + ISettleAccountBranchEfCoreRepository errorListRepository ) { _wmsDapper = wmsDapper; @@ -76,6 +80,7 @@ namespace SettleAccount.Job.Services.Report _erpDapper = erpDapper; _sparepartdapper = sparepartdapper; _fileContainer = fileContainer; + _errorListRepository = errorListRepository; } [UnitOfWork(false)] public string ExportFile(Guid id, List exportName, List p_list) @@ -186,6 +191,21 @@ namespace SettleAccount.Job.Services.Report _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(); + + + + var _fislist =_list.GroupBy(p => new { p.SapMaterialCode, p.MaterialDesc, p.MaterialGroup, p.MaterialCode }) .Select(p => new UnSettledSum { diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs index 9d40148e..76d39a84 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/UnsettledDetailReport.cs @@ -6,7 +6,9 @@ using System.Threading.Tasks; using TaskJob.EventArgs; using TaskJob.Interfaces; using Volo.Abp.DependencyInjection; +using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount.Entities.UnSettle; +using Win.Sfs.SettleAccount.Errors; using Win.Sfs.SettleAccount.FISes; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report.ExportDto; @@ -18,15 +20,19 @@ namespace SettleAccount.Job.Services.Report private readonly UnSettledDetailDapperRepository _dapper; private readonly OutputService _outputService; private readonly ErpPartDapperRepository _erpDapper; + + private readonly ISettleAccountBranchEfCoreRepository _errorListRepository; public UnsettledDetailReportService( UnSettledDetailDapperRepository dapper, OutputService outputService, - ErpPartDapperRepository erpDapper + ErpPartDapperRepository erpDapper, + ISettleAccountBranchEfCoreRepository errorListRepository ) { _dapper = dapper; _outputService = outputService; _erpDapper = erpDapper; + _errorListRepository = errorListRepository; } @@ -101,16 +107,31 @@ namespace SettleAccount.Job.Services.Report _list = _list.Where(p => _groupList.Contains(p.SapMaterialCode)).ToList(); } } - var removeList= _dapper.GetRemoveDetail(); - var _query= from itm in _list - join itm1 in removeList on new { itm.ChassisNumber, itm.SapMaterialCode } -equals new { itm1.ChassisNumber, itm1.SapMaterialCode } into temp1 - from tm1 in temp1.DefaultIfEmpty() - where tm1 == null - select itm; - _list=_query.ToList(); + + 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 _query= from itm in _list + // join itm1 in removeList on new { itm.ChassisNumber, itm.SapMaterialCode } + //equals new { itm1.ChassisNumber, itm1.SapMaterialCode } into temp1 + // from tm1 in temp1.DefaultIfEmpty() + // where tm1 == null + // select itm; + + _list = _list.OrderBy(p => p.SapMaterialCode).ThenBy(p => p.ChassisNumber).ThenBy(p => p.Flag).ToList(); _outputService.Export(id, _first, _list);