diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index f3999f19..7b98b74e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -24,6 +24,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Syncs; using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.TaskJobs; +using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ @@ -48,6 +49,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ private readonly INormalEfCoreRepository _notRepository; private readonly INormalEfCoreRepository _priceRepository; + private readonly INormalEfCoreRepository _saRepository; private readonly TaskJobService _service; @@ -57,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public BBAC_CAN_SA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, + INormalEfCoreRepository saRepository, INormalEfCoreRepository repository, INormalEfCoreRepository detailRepository, INV_MNG invmng, @@ -72,6 +75,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ _notRepository = notRepository; _bbacMng = bbacMng; _priceRepository = priceRepository; + _saRepository = saRepository; } /// @@ -97,17 +101,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ var entitys = await _bbacMng.GetDetalListAsync(invbillNum).ConfigureAwait(false);//可结算 + List errors = new List(); + var settleBillList = entitys.Select(p => p.SettleBillNum).Distinct().ToList(); + var checklist = _saRepository.Where(p => settleBillList.Contains(p.BillNum)).ToList(); + var jischeck = checklist.Where(p => p.State == "0").ToList(); - - - - - - - - - + foreach (var itm in jischeck) + { + errors.Add(new ERR_EXP_DTO() { Remark = $"版本:{itm.Version},结算单:{itm.BillNum}+JIS业务没进行报表核对!" }); + } + var mcheck = checklist.Where(p => p.StateOther == "0").ToList(); + foreach (var itm in mcheck) + { + errors.Add(new ERR_EXP_DTO() { Remark = $"版本:{itm.Version},结算单:{itm.BillNum}+买单业务没进行报表核对!" }); + } + if (errors.Count > 0) + { + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) }); + } var priceList = _priceRepository.Where(p => p.IsCancel == false).ToList(); //价格单 var errorList = await CheckInvoiceGenerationRules(entitys, main.Site, priceList, main.BusinessType).ConfigureAwait(false);//校验生成规则