|
|
@ -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<BBAC_NOT_SA_DETAIL, Guid> _notRepository; |
|
|
|
|
|
|
|
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; |
|
|
|
private readonly INormalEfCoreRepository<BBAC_SA, Guid> _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<BBAC_SA, Guid> saRepository, |
|
|
|
INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository, |
|
|
|
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository, |
|
|
|
INV_MNG invmng, |
|
|
@ -72,6 +75,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
_notRepository = notRepository; |
|
|
|
_bbacMng = bbacMng; |
|
|
|
_priceRepository = priceRepository; |
|
|
|
_saRepository = saRepository; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
@ -97,17 +101,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
|
|
|
var entitys = await _bbacMng.GetDetalListAsync(invbillNum).ConfigureAwait(false);//可结算
|
|
|
|
List<ERR_EXP_DTO> errors = new List<ERR_EXP_DTO>(); |
|
|
|
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);//校验生成规则
|
|
|
|