Browse Source

Merge branch 'master' of http://dev.ccwin-in.com:3000/BoXu.Zheng/BeiJinSettleAccount

# Conflicts:
#	code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
master
wanggang 1 year ago
parent
commit
21d43677bf
  1. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  3. 23
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  4. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  5. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  6. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
  7. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  8. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  9. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  10. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  11. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  12. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
  13. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs
  14. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  15. 67
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_PD_MNG.cs
  16. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  17. 285
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  18. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs
  19. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs
  20. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  21. 5057
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230807064336_202308070001.Designer.cs
  22. 58
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230807064336_202308070001.cs
  23. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  24. 103
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/PendingDeduction/PendingDeductionDapperRepository.cs
  25. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs
  26. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

68
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -29,6 +29,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
@ -63,25 +64,28 @@ namespace Win.Sfs.SettleAccount.Bases
protected BA_SERVICE(
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
protected BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
IExcelImportAppService excelImportService, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
HBPO_CAN_SA_MNG hbpoMng,
BBAC_CAN_SA_MNG bbacMng, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
PUB_CAN_SA_MNG pubMng, PUB_CAN_SA_MNG pubMng,
INV_MNG invMng, INV_MNG invMng,
TaskJobService service TaskJobService service
//INormalEfCoreRepository<TEntityDetail, Guid> detailRepository ) :
base(excelImportService, snowflakeIdGenerator, commonManager)
)
{ {
_service = service; _service = service;
_repository = repository; _repository = repository;
_wRepository = wRepository; _wRepository = wRepository;
_mRepository = mRepository; _mRepository = mRepository;
@ -91,28 +95,6 @@ namespace Win.Sfs.SettleAccount.Bases
_bbacMng = bbacMng; _bbacMng = bbacMng;
_hbpoMng = hbpoMng; _hbpoMng = hbpoMng;
_invMng = invMng; _invMng = invMng;
}
protected BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
BBAC_CAN_SA_MNG pubMng,
HBPO_CAN_SA_MNG bbacMng,
PUB_CAN_SA_MNG hbpoMng,
INV_MNG invMng
) :
base(excelImportService, snowflakeIdGenerator, commonManager)
{
} }
/// <summary> /// <summary>
/// 审核通过 /// 审核通过
@ -222,14 +204,12 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost] [HttpPost]
public virtual async Task<string> RejectAsync(INVOICE_GRP_REQ_DTO input) public virtual async Task<string> RejectAsync(INVOICE_GRP_REQ_DTO input)
{ {
await _invMng.Reject(input.InvGroupNum); await _invMng.Reject(input.InvGroupNum);
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
[HttpPost] [HttpPost]
[UnitOfWork(false)]
public virtual async Task<string> ReceivedAsync(INVOICE_GRP_REQ_DTO input) public virtual async Task<string> ReceivedAsync(INVOICE_GRP_REQ_DTO input)
{ {
var entity = await _invMng.GetMainAsync(input.InvbillNum); var entity = await _invMng.GetMainAsync(input.InvbillNum);
@ -237,21 +217,18 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
throw new BusinessException("8989", $"发票号{entity.InvbillNum}为报废状态, 不能提交!"); throw new BusinessException("8989", $"发票号{entity.InvbillNum}为报废状态, 不能提交!");
} }
if (entity.InvoiceState == InvoiceBillState. ) if (entity.InvoiceState == InvoiceBillState. )
{ {
throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}现在为提交状态!"); throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}现在为提交状态!");
} }
if (entity.State == SettleBillState.) if (entity.State != SettleBillState.)
{ {
throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}不是财务已审核状态,不能收票!"); throw new BusinessException("8989", $"发票号{entity.InvbillNum}所在发票分组{entity.InvGroupNum}不是财务已审核状态,不能收票!");
} }
if (entity != null) if (entity != null)
{ {
List<CustomCondition> customConditionList = new List<CustomCondition>(); List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "InvGroupNum", Value = input.InvGroupNum ?? string.Empty }); customConditionList.Add(new CustomCondition() { Name = "InvGroupNum", Value = entity.InvGroupNum?? string.Empty });
var invlist= _repository.Where(p => p.InvGroupNum == entity.InvGroupNum).ToList(); var invlist= _repository.Where(p => p.InvGroupNum == entity.InvGroupNum).ToList();
foreach (var inv in invlist) { foreach (var inv in invlist) {
@ -265,14 +242,7 @@ namespace Win.Sfs.SettleAccount.Bases
{ {
}); });
return _taskid; return _taskid;
//bool flag = await _invMng.ReceivedAsync(entity.InvGroupNum);
//if (flag == true)
//{
// await _invMng.SetForwardState(entity, SettleBillState.客户已收票);
//}
} }
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
@ -353,9 +323,9 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param> /// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param> /// <param name="p_parentInvBillNum">原发票号</param>
protected async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> p_list, List<PUB_ADJ_DETAIL> p_adjlist, int p_version, string p_parentInvBillNum) protected async Task<bool> ReissueSecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist,List<TEMP_CAN_SA_DETAIL> p_tmplist, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE
{ {
var flag=await _invMng.ReissueSecInvoice(p_list, p_adjlist, p_parentInvBillNum, p_version); var flag=await _invMng.ReissueSecInvoice(p_list,p_adjlist, p_tmplist, p_parentInvBillNum, p_version);
if (flag) if (flag)
{ {
return true; return true;
@ -376,10 +346,10 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_parentInvBillNum">要作废的发票号</param> /// <param name="p_parentInvBillNum">要作废的发票号</param>
/// <param name="businessType"></param> /// <param name="businessType"></param>
/// <returns></returns> /// <returns></returns>
protected async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<PUB_ADJ_DETAIL> p_adjlist, int p_version, string p_parentInvBillNum) protected async Task<bool> ReissueFirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_parentInvBillNum) where TDetail : SA_CAN_BASE
{ {
var flag = await _invMng.ReissueFirstInvoice(dtos, p_adjlist, p_parentInvBillNum, p_version); var flag = await _invMng.ReissueFirstInvoice(p_list,p_adjlist,dtos, p_parentInvBillNum, p_version);
if (flag==true) if (flag==true)
{ {
return true; return true;

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -164,9 +164,9 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param> /// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param> /// <param name="p_parentInvBillNum">原发票号</param>
protected async Task<bool> SecInvoice(List<TEMP_CAN_SA_DETAIL> p_list, int p_version, string p_InvGroupNum, string p_parentInvBillNum,EnumBusinessType businessType) protected async Task<bool> SecInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> p_tmplist, int p_version, string p_InvGroupNum, string p_parentInvBillNum,EnumBusinessType businessType) where TDetail : SA_CAN_BASE
{ {
var ls= await _invmng.SecInvoice(p_list, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); var ls= await _invmng.SecInvoice(p_list,p_adjlist,p_tmplist,p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (ls.Count > 0) if (ls.Count > 0)
{ {
return true; return true;
@ -186,10 +186,10 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="p_parentInvBillNum"></param> /// <param name="p_parentInvBillNum"></param>
/// <param name="businessType"></param> /// <param name="businessType"></param>
/// <returns></returns> /// <returns></returns>
protected async Task<bool> FirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) protected async Task<bool> FirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist ,List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) where TDetail : SA_CAN_BASE
{ {
var ls = await _invmng.FirstInvoice(dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); var ls = await _invmng.FirstInvoice(p_list,p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (ls.Count > 0) if (ls.Count > 0)
{ {
return true; return true;

23
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -21,6 +21,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -34,6 +35,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository; private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
public BBAC_BA_SERVICE(IExcelImportAppService excelImportService, public BBAC_BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, ICommonManager commonManager,
@ -42,16 +44,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
BBAC_CAN_SA_MNG pubMng,
HBPO_CAN_SA_MNG bbacMng,
PUB_CAN_SA_MNG hbpoMng,
INV_MNG invMng,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
PUB_CAN_SA_MNG pubMng,
INV_MNG invMng,
TaskJobService service,
INormalEfCoreRepository<PriceList, Guid> priceRepository INormalEfCoreRepository<PriceList, Guid> priceRepository
) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) ) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
{ {
_adjRepository = adjRepository;
_priceRepository = priceRepository; _priceRepository = priceRepository;
} }
@ -105,7 +108,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum, invGroupNum: itm.InvGroupNum,
contactid: itm.Extend1//生产号 contactid: itm.Extend1,//生产号
invbillnum:string.Empty
)); ));
} }
} }
@ -148,11 +153,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开
{ {
await ReissueFirstInvoice(dtos,adjlist ,version, p_invbillnum); await ReissueFirstInvoice(bbaclist,adjlist,dtos,version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos,adjlist,version, p_invbillnum); await ReissueSecInvoice(bbaclist,adjlist,dtos,version, p_invbillnum);
} }
} }
} }

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs

@ -149,11 +149,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ContractDocID = string.Empty ContractDocID = string.Empty
}).ToList();//不能结算 }).ToList();//不能结算
await FirstInvoice(dtos, notlist, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await FirstInvoice(entitys,new List<PUB_ADJ_DETAIL>(),dtos, notlist, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
} }
else//二次开票 else//二次开票
{ {
await SecInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(),dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
} }
} }
} }

39
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -19,6 +19,7 @@ using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -27,30 +28,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class HBPO_BA_SERVICE : BA_SERVICE public class HBPO_BA_SERVICE : BA_SERVICE
{ {
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
public HBPO_BA_SERVICE(
IExcelImportAppService excelImportService, public HBPO_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
ISnowflakeIdGenerator snowflakeIdGenerator, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng,
ICommonManager commonManager, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, TaskJobService service,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
BBAC_CAN_SA_MNG pubMng,
HBPO_CAN_SA_MNG bbacMng,
PUB_CAN_SA_MNG hbpoMng,
INV_MNG invMng,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository INormalEfCoreRepository<PriceList, Guid> priceRepository
) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng) )
: base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
{ {
_adjRepository = adjRepository;
_priceRepository= priceRepository; _priceRepository= priceRepository;
} }
/// <summary> /// <summary>
/// 发票重开 /// 发票重开
/// </summary> /// </summary>
@ -97,7 +95,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty
)); ));
} }
} }
@ -139,12 +138,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开
{ {
await ReissueFirstInvoice(dtos,adjlist, version, p_invbillnum); await ReissueFirstInvoice(hbpolist,adjlist ,dtos, version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos,adjlist, version, p_invbillnum); await ReissueSecInvoice(hbpolist,adjlist ,dtos, version, p_invbillnum);
} }
} }
} }

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs

@ -137,11 +137,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ContractDocID = string.Empty ContractDocID = string.Empty
}).ToList();//不能结算 }).ToList();//不能结算
var falg= await FirstInvoice(dtos, notlist, main.Version, main.InvGroupNum, string.Empty,main.BusinessType); var falg= await FirstInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, notlist, main.Version, main.InvGroupNum, string.Empty,main.BusinessType);
} }
else//二次开票 else//二次开票
{ {
var flag=await SecInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); var flag=await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(),dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
} }
} }

46
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -18,6 +18,7 @@ using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
@ -27,27 +28,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public class PUB_BA_SERVICE : BA_SERVICE public class PUB_BA_SERVICE : BA_SERVICE
{ {
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
public PUB_BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
ICommonManager commonManager, TaskJobService service, INormalEfCoreRepository<PriceList, Guid> priceRepository
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> pubRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, ) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, {
BBAC_CAN_SA_MNG pubMng,
HBPO_CAN_SA_MNG bbacMng,
PUB_CAN_SA_MNG hbpoMng,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INV_MNG invMng) : base(excelImportService, snowflakeIdGenerator, commonManager, pubRepository, repository, wRepository, sRepository, mRepository, pubMng, bbacMng, hbpoMng, invMng)
{
_adjRepository = adjRepository;
_priceRepository = priceRepository; _priceRepository = priceRepository;
} }
// <summary> // <summary>
/// 发票重开 /// 发票重开
/// </summary> /// </summary>
@ -76,13 +75,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
} }
var hbpolist = await _pubMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 var publist = await _pubMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件
var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细 var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count() > 0) if (adjlist != null && adjlist.Count() > 0)
{ {
foreach (var itm in adjlist) foreach (var itm in adjlist)
{ {
hbpolist.Add(new PUB_CAN_SA_DETAIL( publist.Add(new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm.KeyCode, keyCode: itm.KeyCode,
version: itm.Version, version: itm.Version,
@ -96,12 +95,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
businessType: itm.BusinessType, businessType: itm.BusinessType,
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty
)); ));
} }
} }
var entitys = hbpolist;//合并库存调整单和就发票可结算明细数据 var entitys = publist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList(); var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
//var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList(); //var groupNumList = entitys.Select(p => new { p.GroupNum).Distinct().ToList();
//var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算 //var notList = _notRepository.Where(p => gNumList.Contains(p.GroupNum)).ToList();//不能结算
@ -140,11 +140,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开
{ {
await ReissueFirstInvoice(dtos,adjlist, version, p_invbillnum); await ReissueFirstInvoice(publist,adjlist,dtos, version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos,adjlist, version, p_invbillnum); await ReissueSecInvoice(publist,adjlist, dtos, version, p_invbillnum);
} }
} }
} }

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -6,6 +6,7 @@ using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp.Domain.Entities;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
@ -120,22 +121,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType == EnumBusinessType.BeiJian) if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType == EnumBusinessType.BeiJian)
{ {
var strs=await _invmng.MakeInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true); var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
} }
else else
{ {
await FirstInvoice(dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await FirstInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
} }
} }
else//二次开票 else//二次开票
{ {
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType==EnumBusinessType.BeiJian ) if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO || main.BusinessType==EnumBusinessType.BeiJian )
{ {
var strs=await _invmng.MakeInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true); var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
} }
else else
{ {
await SecInvoice(dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType); await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
} }
} }

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -391,7 +391,7 @@ namespace SettleAccount.Bases
/// </summary> /// </summary>
public decimal Price { set; get; } public decimal Price { set; get; }
/// <summary> /// <summary>
/// 可出库结算单 /// 发票字段
/// </summary> /// </summary>
public string BillNum { set; get; } public string BillNum { set; get; }
/// <summary> /// <summary>
@ -427,6 +427,9 @@ namespace SettleAccount.Bases
/// </summary> /// </summary>
public string SettleBillNum { get; set; } public string SettleBillNum { get; set; }
public string InvbillNum { get; set; }
//public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum) //public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{ //{
// Version = version; // Version = version;

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -139,9 +139,10 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
public BBAC_CAN_SA_DETAIL(Guid guid,string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, bool isReturn, public BBAC_CAN_SA_DETAIL(Guid guid,string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, EnumBusinessType category, bool isReturn,
DateTime settleDate, string groupNum, string invGroupNum DateTime settleDate, string groupNum, string invGroupNum
,string contactid ,string contactid,string invbillnum
):base(guid) ):base(guid)
{ {
InvbillNum = invbillnum;
KeyCode = keyCode; KeyCode = keyCode;
Version = version; Version = version;

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs

@ -124,8 +124,9 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE
/// </summary> /// </summary>
public EnumBusinessType BusinessType { get; set; } public EnumBusinessType BusinessType { get; set; }
public HBPO_CAN_SA_DETAIL(Guid guid ,string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType) public HBPO_CAN_SA_DETAIL(Guid guid ,string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType, string invbillnum)
{ {
InvbillNum=invbillnum;
Id = guid; Id = guid;
KeyCode = keyCode; KeyCode = keyCode;
Version = version; Version = version;

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

@ -7,7 +7,7 @@ namespace SettleAccount.Domain.BQ;
[Display(Name = "发票分组")] [Display(Name = "发票分组")]
public class INVOICE_GRP : FullAuditedAggregateRoot<Guid> public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
{ {
[Display(Name = "实际纸质发票号")] [Display(Name = "金税发票号")]
public string RealnvBillNum { get; set; } = null!; public string RealnvBillNum { get; set; } = null!;
[Display(Name = "系统生成发票号")] [Display(Name = "系统生成发票号")]

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_CAN_SA_MNG.cs

@ -254,6 +254,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
/// <summary>
/// 通过发票号获取结算数据
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<BBAC_CAN_SA_DETAIL>> GetDetailByInbillNumAsync(List<string> p_invs)
{
return await _detailRepository.Where(p =>p_invs.Contains(p.BillNum)).ToListAsync();
}

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -69,7 +69,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: billNumber, invGroupNum: billNumber,
contactid: itm.ContractDocID contactid: itm.ContractDocID,
invbillnum: string.Empty
); );
_entityList.Add(_detailEntity); _entityList.Add(_detailEntity);

67
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_PD_MNG.cs

@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers;
public class BBAC_PD_MNG:DomainService
{
private readonly INormalEfCoreRepository<BBAC_PD, Guid> _repository;
private readonly INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> _detailRepository;
protected BBAC_PD_MNG(
INormalEfCoreRepository<BBAC_PD, Guid> repository,
INormalEfCoreRepository<BBAC_PD_DETAIL, Guid> detailRepository
)
{
_repository = repository;
_detailRepository = detailRepository;
}
public BBAC_PD_MNG()
{
}
public virtual async Task<BBAC_PD> GetMainAsync(string billNum)
{
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync();
}
public virtual async Task<List<BBAC_PD_DETAIL>> GetDetailAsync(string billNum)
{
return await _detailRepository.Where(p => p.InvGroupNum == billNum).ToListAsync();
}
public virtual bool InsertMain(BBAC_PD p_pd)
{
_repository.DbContext.BulkInsert(new List<BBAC_PD> { p_pd });
return true;
}
public virtual bool InsertDetail(List<BBAC_PD_DETAIL> p_list)
{
_repository.DbContext.BulkInsert(p_list);
return false;
}
}

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

@ -72,7 +72,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
businessType: itm.BusinessType, businessType: itm.BusinessType,
qty: itm.Qty, qty: itm.Qty,
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
site: itm.Site site: itm.Site,
invbillnum: string.Empty
); );
_entityList.Add(_detailEntity); _entityList.Add(_detailEntity);
} }

285
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

@ -1,4 +1,5 @@
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using EmptyFiles;
using Hangfire; using Hangfire;
using Microsoft.AspNetCore.SignalR; using Microsoft.AspNetCore.SignalR;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
@ -8,8 +9,10 @@ using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
@ -31,9 +34,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository; private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository; private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
private readonly INormalEfCoreRepository<PUB_PD, Guid> _pdRepository;
private readonly PUB_CAN_SA_MNG _pubMng; private readonly PUB_CAN_SA_MNG _pubMng;
private readonly BBAC_CAN_SA_MNG _bbacMng; private readonly BBAC_CAN_SA_MNG _bbacMng;
private readonly HBPO_CAN_SA_MNG _hbpoMng; private readonly HBPO_CAN_SA_MNG _hbpoMng;
@ -42,6 +46,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
PUB_CAN_SA_MNG pubMng, PUB_CAN_SA_MNG pubMng,
BBAC_CAN_SA_MNG bbacMng, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, HBPO_CAN_SA_MNG hbpoMng,
INormalEfCoreRepository<PUB_PD, Guid> pdRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
@ -49,6 +54,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository
) )
{ {
_pdRepository= pdRepository;
//_canRepository = canRepository; //_canRepository = canRepository;
_repository = repository; _repository = repository;
_detailRepository = detailRepository; _detailRepository = detailRepository;
@ -234,21 +240,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
break; break;
} }
var flag = await SetSettleState(p_entiy, p_State, false); //var flag = await SetSettleState(p_entiy, p_State, false);
if (flag == true) //if (flag == true)
{ //{
var invlist = await _repository.Where(p => p.InvGroupNum == p_entiy.InvGroupNum).ToListAsync();//选择审批时只能整组审批 // var invlist = await _repository.Where(p => p.InvGroupNum == p_entiy.InvGroupNum).ToListAsync();//选择审批时只能整组审批
foreach (var itm in invlist) // foreach (var itm in invlist)
{ // {
itm.State = p_entiy.State; // itm.State = p_entiy.State;
} // }
await _repository.BatchUpdateAsync(invlist);
await _repository.BatchUpdateAsync(p_entiy);
return true; return true;
} //}
return false;
} }
@ -289,33 +296,112 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
/// <summary> /// <summary>
/// 客户已收票 /// 客户已收票
/// </summary> /// </summary>
/// <param name="p_groupbillnum">发票分组号</param> /// <param name="p_groupbillnum">发票分组号</param>
/// <returns></returns> /// <returns></returns>
public virtual async Task<bool> ReceivedAsync(string p_groupbillnum) public virtual async Task<bool> ReceivedAsync(List<string> p_invs)
{ {
//var invList = _repository.Where(p =>p_invs.Contains(p.InvbillNum)).ToList();//所有提交发票信息
//int count = invList.Select(p => p.InvGroupNum).Count();
//if (count > 0)
//{
// throw new UserFriendlyException($"发票不属于一个发票分组");
//}
//var parentList = invList.Select(p => p.ParentInvbillNum).ToList();//父发票号
//List<string> oldinvs = new List<string>();
//oldinvs.AddRange(p_invs);
//if (parentList != null && parentList.Count > 0)
//{
// oldinvs.AddRange(parentList);
//}
//List<string> seclist = new List<string>();
//List<string> firstlist = new List<string>();
//var pdlist = _pdRepository.Where(p => oldinvs.Contains(p.BillNum)).ToList();
//if (pdlist != null && pdlist.Count > 0)
//{
// seclist = pdlist.Select(p => p.BillNum).ToList();//那些在待扣减里已经有了属于作废重开
//}
//firstlist = p_invs.Where(p => !seclist.Contains(p)).ToList();
//var inv=invList.FirstOrDefault();
//var inv = _repository.Where(p => p.InvGroupNum == p_groupbillnum).FirstOrDefault();
//if (inv.BusinessType == EnumBusinessType.JisBBAC) //if (inv.BusinessType == EnumBusinessType.JisBBAC)
//{ //{
// var entity = await _bbacMng.GetMainAsync(inv.InvGroupNum); // var namelist=invList.Select(p => p.InvbillNum).ToList();
// if (entity == null) // var entityDetail = await _bbacMng.GetDetailByInbillNumAsync(namelist);//结算明细
// var adjlist=_adjRepository.Where(p => namelist.Contains(p.OldInvBillNum)).ToList();//调整表明细明细
// if (adjlist != null && adjlist.Count() > 0)
// {
// foreach (var itm in adjlist)
// { // {
// entityDetail.Add(new BBAC_CAN_SA_DETAIL(
// guid: GuidGenerator.Create(),
// keyCode: itm.KeyCode,
// version: itm.Version,
// billNum: itm.InvGroupNum,
// settleBillNum: itm.SettleBillNum,
// lU: itm.LU,
// pN: itm.PN,
// site: itm.Site,
// qty: itm.Qty,
// price: itm.Price,
// category: itm.BusinessType,
// isReturn: itm.Qty > 0 ? false : true,
// settleDate: itm.SettleDate,
// groupNum: itm.GroupNum,
// invGroupNum: itm.InvGroupNum,
// contactid: itm.Extend1//生产号
// ));
// }
// }
//entityDetail.GroupBy(p =>new {
// p.LU,
// p.PN,
// p.Site,
// p.Qty,
// p.BusinessType
//}).Select(p =>new BBAC_PD_DETAIL(
// guid: GuidGenerator.Create(),
// keyCode: p.Key.PN.Trim()+p.Key.LU,
// version: p.Key.Version,
// billNum: string.Empty,
// lU: p.Key.LU,
// rELU: string.Empty,
// pN: p.Key.PN,
// rEPN: string.Empty,
// site: string.Empty,
// qty:p.Sum(itm=>itm.Qty),
// price: 0,
// invGroupNum: p.Key.,
// settleDate: p.SettleDate,
// groupNum: p.GroupNum,
// extend1: string.Empty,
// extend2: string.Empty,
// extend3: string.Empty,
// extend4: string.Empty
//);
// var entityDetail = await _bbacMng.GetDetalListAsync(inv.InvGroupNum);
// var bbac = new BBAC_PD( // var bbac = new BBAC_PD(
// guid: entity.Id, // guid: entity.Id,
// version: entity.Version, // version: entity.Version,
@ -354,7 +440,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
// await _repository.DbContext.BulkInsertAsync(bbacDetail); // await _repository.DbContext.BulkInsertAsync(bbacDetail);
// return true; // return true;
// } // }
// }
//} //}
//else if (inv.BusinessType == EnumBusinessType.JisHBPO) //else if (inv.BusinessType == EnumBusinessType.JisHBPO)
//{ //{
@ -572,7 +658,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param> /// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param> /// <param name="p_parentInvBillNum">原发票号</param>
public async Task<List<string>> SecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) public async Task<List<string>> SecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_ajdlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail : SA_CAN_BASE
{ {
List<string> _invls = new List<string>(); List<string> _invls = new List<string>();
var groups1 = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV var groups1 = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
@ -634,7 +722,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
tempList.Add(group1); tempList.Add(group1);
} }
invoiceMap.Add(invoiceBillNum, tempList); invoiceMap.Add(invoiceBillNum, tempList);
var query = from itm in groups1 var query = from itm in groups1 //更新分组
join itm1 in tempList join itm1 in tempList
on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID } on new { itm.LU, itm.BeginDate, itm.EndDate, itm.ContractDocID }
equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID } into temp equals new { itm1.LU, itm1.BeginDate, itm1.EndDate, itm1.ContractDocID } into temp
@ -654,14 +742,45 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
if (invoiceMap.Count > 0) if (invoiceMap.Count > 0)
{ {
var groupList = new List<INVOICE_MAP_GROUP>(); var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>(); var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>(); var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>(); var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var group in invoiceMap) foreach (var group in invoiceMap)
{ {
var key = group.Key;//发票票号 var key = group.Key;//发票票号
var ls = group.Value;//发票明细 var ls = group.Value;//发票明细
var query = from itm in dtos
join itm1 in ls
on new { itm.LU, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in p_list on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate }
select itm2;
foreach (var itm in query)
{
itm.BillNum = key;
salist.Add(itm);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
var query1 = from itm in dtos
join itm1 in ls
on new { itm.LU, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in p_ajdlist on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate }
select itm2;
foreach (var itm in query1)
{
itm.InvBillNum = key;
adjlist.Add(itm);
}
}
List < INVOICE_WAIT_DETAIL > _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); List < INVOICE_WAIT_DETAIL > _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in ls) foreach (var detail in ls)
{ {
@ -730,9 +849,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
); );
invlist.Add(invbill); invlist.Add(invbill);
} }
await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList); await _repository.DbContext.BulkInsertAsync(detailList);
if(salist.Count>0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
//await _repository.DbContext.BulkInsertAsync(notDetialList); //await _repository.DbContext.BulkInsertAsync(notDetialList);
_invls = invlist.Select(p => p.InvbillNum).ToList(); _invls = invlist.Select(p => p.InvbillNum).ToList();
} }
@ -750,7 +880,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version">版本号</param> /// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param> /// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param> /// <param name="p_parentInvBillNum">原发票号</param>
public async Task<List<string>> MakeInvoice(List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, bool p_first) public async Task<List<string>> MakeInvoice<TDetail>(List<TDetail> details,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType, bool p_first) where TDetail : SA_CAN_BASE
{ {
List<string> _invls = new List<string>(); List<string> _invls = new List<string>();
var groups1 = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV var groups1 = dtos.GroupBy(p => new { p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }).Select(p => new TMEP_INV
@ -792,7 +922,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{ {
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV"); invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
} }
List<TMEP_INV> tempList = new List<TMEP_INV>(); List<TMEP_INV> tempList = new List<TMEP_INV>();
decimal sum = group.Amt;//初始合计金额 decimal sum = group.Amt;//初始合计金额
int partCount = 0; int partCount = 0;
@ -845,10 +974,41 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var notDetialList = new List<INVOICE_NOT_SETTLE>(); var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>(); var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>(); var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var group in invoiceMap) foreach (var group in invoiceMap)
{ {
var key = group.Key;//发票票号 var key = group.Key;//发票票号
var ls = group.Value;//发票明细 var ls = group.Value;//发票明细
//更新结算记录更新
var query = from itm in dtos
join itm1 in ls
on new { itm.LU, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in details on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate }
select itm2;
foreach (var itm in query)
{
itm.BillNum = key;
salist.Add(itm);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
var query1 = from itm in dtos
join itm1 in ls
on new { itm.LU, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in p_adjlist on new { itm.LU, itm.SettleDate } equals new { itm2.LU, itm2.SettleDate }
select itm2;
foreach (var itm in query1)
{
itm.InvBillNum = key;
adjlist.Add(itm);
}
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>(); List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in ls) foreach (var detail in ls)
{ {
@ -920,6 +1080,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(invlist);
//await _repository.DbContext.BulkInsertAsync(groupList); //await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList); await _repository.DbContext.BulkInsertAsync(detailList);
if (salist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
//await _repository.DbContext.BulkInsertAsync(notDetialList); //await _repository.DbContext.BulkInsertAsync(notDetialList);
_invls = invlist.Select(p => p.InvbillNum).ToList(); _invls = invlist.Select(p => p.InvbillNum).ToList();
} }
@ -942,7 +1110,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_parentInvBillNum"></param> /// <param name="p_parentInvBillNum"></param>
/// <param name="businessType"></param> /// <param name="businessType"></param>
/// <returns></returns> /// <returns></returns>
public async Task<List<string>> FirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) public async Task<List<string>> FirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail:SA_CAN_BASE
{ {
List<string> _invls = new List<string>(); List<string> _invls = new List<string>();
var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) }); var _query = dtos.GroupBy(p => new { p.GroupNum }).Select(p => new { GroupNum = p.Key.GroupNum, Amt = p.Sum(itm => itm.Amt) });
@ -998,14 +1167,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var notDetialList = new List<INVOICE_NOT_SETTLE>(); var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>(); var detailList = new List<INVOICE_WAIT_DETAIL>();
var invlist = new List<INVOICE_GRP>(); var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和 foreach (var itm in invoiceMap)//分组影响和
{ {
var key = itm.Key;//发票票号 var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表 var ls = itm.Value;//结算分组号列表
//if(businessType==EnumBusinessType.JisBBAC) var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
//{ foreach (var detail in invdetails)
{
detail.BillNum = key;
salist.Add(detail);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
adjdetails.Add(detail);
}
}
//}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID }) var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.LU, p.Price, p.BeginDate, p.EndDate, p.ContractDocID })
.Select(itm => new .Select(itm => new
{ {
@ -1106,10 +1290,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkInsertAsync(invlist); await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList); await _repository.DbContext.BulkInsertAsync(detailList);
if(salist.Count>0)
{
await _repository.DbContext.BulkUpdateAsync(salist);
}
if (adjlist.Count > 0)
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
if (notDetialList.Count > 0) if (notDetialList.Count > 0)
{ {
await _repository.DbContext.BulkInsertAsync(notDetialList); await _repository.DbContext.BulkInsertAsync(notDetialList);
} }
_invls = invlist.Select(p => p.InvbillNum).ToList(); _invls = invlist.Select(p => p.InvbillNum).ToList();
} }
@ -1124,7 +1319,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version"></param> /// <param name="p_version"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
public async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<PUB_ADJ_DETAIL> p_adjlist, string p_OldInvBillNum, int p_version) public async Task<bool> ReissueFirstInvoice<TDetail>(List<TDetail> p_list,List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version)
where TDetail:SA_CAN_BASE
{ {
if (!string.IsNullOrEmpty(p_OldInvBillNum)) if (!string.IsNullOrEmpty(p_OldInvBillNum))
{ {
@ -1143,11 +1339,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
List<string> invlist = new List<string>(); List<string> invlist = new List<string>();
if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian) if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian)
{ {
invlist = await MakeInvoice(dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true); invlist = await MakeInvoice(p_list,p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true);
} }
else else
{ {
invlist = await FirstInvoice(dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票 invlist = await FirstInvoice(p_list,p_adjlist,dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
} }
if (invlist.Count == 0) if (invlist.Count == 0)
@ -1175,7 +1371,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version"></param> /// <param name="p_version"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="BusinessException"></exception> /// <exception cref="BusinessException"></exception>
public async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<PUB_ADJ_DETAIL> p_adjlist, string p_OldInvBillNum, int p_version) public async Task<bool> ReissueSecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, string p_OldInvBillNum, int p_version)
where TDetail : SA_CAN_BASE
{ {
if (!string.IsNullOrEmpty(p_OldInvBillNum)) if (!string.IsNullOrEmpty(p_OldInvBillNum))
{ {
@ -1194,14 +1391,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
List<string> invlist = new List<string>(); List<string> invlist = new List<string>();
if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian) if (inv.BusinessType == EnumBusinessType.MaiDanJianHBPO || inv.BusinessType == EnumBusinessType.BeiJian)
{ {
invlist = await MakeInvoice(dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false); invlist = await MakeInvoice(p_list,p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, false);
} }
else else
{ {
invlist = await SecInvoice(dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType); invlist = await SecInvoice(p_list,p_adjlist,dtos,p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);
} }
if (invlist.Count == 0) if (invlist.Count == 0)
{ {
return false; return false;
@ -1209,10 +1404,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv }); _repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv });
foreach (var adj in p_adjlist) //foreach (var adj in p_adjlist)
{ //{
adj.InvBillNum = string.Join(",", invlist); // adj.InvBillNum = string.Join(",", invlist);
} //}
_repository.DbContext.BulkUpdate(p_adjlist); _repository.DbContext.BulkUpdate(p_adjlist);
return true; return true;
} }

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
@ -52,4 +53,8 @@ public class PD_MNG<TEntity,TEntityDetail>:DomainService
} }

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

@ -70,8 +70,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
settleDate: itm.SettleDate, settleDate: itm.SettleDate,
groupNum: itm.GroupNum, groupNum: itm.GroupNum,
invGroupNum: billNumber invGroupNum: billNumber,
invbillnum: string.Empty
); );
_entityList.Add(_detailEntity); _entityList.Add(_detailEntity);

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

@ -118,8 +118,12 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE
//[Display(Name = "结算分组")] //[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!; //public string GroupNum { get; set; } = null!;
public PUB_CAN_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType, string groupNum) public PUB_CAN_SA_DETAIL(Guid guid, string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, EnumBusinessType businessType,
string groupNum,
string invbillnum
)
{ {
InvbillNum=invbillnum;
Id = guid; Id = guid;
KeyCode = keyCode; KeyCode = keyCode;
Version = version; Version = version;

5057
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230807064336_202308070001.Designer.cs

File diff suppressed because it is too large

58
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230807064336_202308070001.cs

@ -0,0 +1,58 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202308070001 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "InvbillNum",
table: "Set_PUB_CAN_SA_DETAIL",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "InvbillNum",
table: "Set_HBPO_CAN_SA_DETAIL",
type: "nvarchar(50)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "InvbillNum",
table: "Set_BBAC_CAN_SA_DETAIL",
type: "nvarchar(50)",
nullable: true);
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "2e626de3941048399abf1f76c051f8a4");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "InvbillNum",
table: "Set_PUB_CAN_SA_DETAIL");
migrationBuilder.DropColumn(
name: "InvbillNum",
table: "Set_HBPO_CAN_SA_DETAIL");
migrationBuilder.DropColumn(
name: "InvbillNum",
table: "Set_BBAC_CAN_SA_DETAIL");
migrationBuilder.UpdateData(
table: "Set_VmiBalance",
keyColumn: "Id",
keyValue: new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
column: "ConcurrencyStamp",
value: "887ca64c266c48ac82dca90534f64225");
}
}
}

14
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -125,6 +125,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("InvbillNum")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsReturn") b.Property<bool>("IsReturn")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("bit"); .HasColumnType("bit");
@ -1180,6 +1183,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("InvbillNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("KeyCode") b.Property<string>("KeyCode")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -2701,6 +2707,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("InvbillNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("KeyCode") b.Property<string>("KeyCode")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
@ -3886,9 +3895,6 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<DateTime?>("HeartBeat")
.HasColumnType("datetime2");
b.Property<bool>("IsDisabled") b.Property<bool>("IsDisabled")
.HasColumnType("bit"); .HasColumnType("bit");
@ -4043,7 +4049,7 @@ namespace Win.Sfs.SettleAccount.Migrations
Id = new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"), Id = new Guid("ea936b34-ecd0-7dbd-85a9-57cd8b730873"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1, BillType = 1,
ConcurrencyStamp = "2cc9803a5a8e420b80134104653ecde0", ConcurrencyStamp = "2e626de3941048399abf1f76c051f8a4",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc", ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum", OrderNum = "OrderNum",

103
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/PendingDeduction/PendingDeductionDapperRepository.cs

@ -2,6 +2,7 @@ using Dapper;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using NPOI.HPSF;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SettleAccount.Bases; using SettleAccount.Bases;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
@ -9,17 +10,20 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
using System.Linq; using System.Linq;
using System.Security.Policy;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Repositories.Dapper; using Volo.Abp.Domain.Repositories.Dapper;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities; using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.BQ.Temp; using Win.Sfs.SettleAccount.Entities.BQ.Temp;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs; using Win.Sfs.SettleAccount.Reports.InvoiceSettledDiffs;
using static System.Runtime.CompilerServices.RuntimeHelpers;
namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
{ {
@ -33,12 +37,16 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }
[UnitOfWork(false)]
/// <summary> /// <summary>
/// BBAC生成待扣减 /// BBAC生成待扣减
/// </summary> /// </summary>
/// <param name="p_invGroup"></param> /// <param name="p_invGroup"></param>
/// <returns></returns> /// <returns></returns>
public Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>> GenerationPendingDeductionBBAC(string p_invGroup) public virtual Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>> GenerationPendingDeductionBBAC(string p_invGroup)
{ {
var sqljis = "WITH t1 AS(\n" + var sqljis = "WITH t1 AS(\n" +
"SELECT\n" + "SELECT\n" +
@ -90,16 +98,50 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"INNER JOIN Set_BBAC_SE_DETAIL tmp2 ON\n" + "INNER JOIN Set_BBAC_SE_DETAIL tmp2 ON\n" +
"tmp1.KeyCode = tmp2.KeyCode\n"; "tmp1.KeyCode = tmp2.KeyCode\n";
var inv = DbConnection.Query<INVOICE_GRP>($"select * from set_INVOICE_GRP where InvGroupNum='{p_invGroup}'").FirstOrDefault();
Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>> result = new Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>>(); Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>> result = new Dictionary<BBAC_PD, List<BBAC_PD_DETAIL>>();
var detail = DbConnection.Query<BBAC_CAN_SA_DETAIL>($"select * from set_BBAC_CAN_SA_DETAIL where billNum='{p_invGroup}'").ToList();
var main = DbConnection.Query<BBAC_CAN_SA>($"select * from set_BBAC_CAN_SA where billNum='{p_invGroup}'").FirstOrDefault();
string str = $"select" +
" [Id] " +
",[SettleBillNum] " +
",[Site] " +
",[IsReturn] " +
",[Version] " +
",[Price] " +
",[BillNum] " +
",[SettleDate] " +
",[InvGroupNum] " +
",[LU] " +
",[PN] " +
",[KeyCode] " +
",[Qty] " +
",[GroupNum] " +
",[BusinessType] " +
",[ContractDocID] " +
$"from set_BBAC_CAN_SA_DETAIL where billNum='{p_invGroup}'";
var detail = DbConnection.Query<BBAC_CAN_SA_DETAIL>(str, null, null, true, 1200, null).ToList();
var str1 = $"select " +
" [Id] " +
" ,[Version] " +
" ,[BillNum] " +
" ,[SettleBillNum] " +
" ,[State] " +
" ,[InvGroupNum] " +
" ,[Site] " +
" ,[BusinessType] " +
$" from set_BBAC_CAN_SA where billNum='{p_invGroup}'";
var main = DbConnection.Query<BBAC_CAN_SA>(str1, null, null, true, 1200, null).FirstOrDefault();
var entity = main; var entity = main;
if (entity == null) if (entity != null)
{ {
var templist = DbConnection.Query<TEMP_PD_SW>(string.Format(sqljis, p_invGroup)); var templist = DbConnection.Query<TEMP_PD_SW>(string.Format(sqljis, p_invGroup));//获取当前二次比对结果
var entityDetail = detail; var entityDetail = detail;
var bbac = new BBAC_PD( var bbac = new BBAC_PD(
@ -118,11 +160,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
select new BBAC_PD_DETAIL( select new BBAC_PD_DETAIL(
guid: itm.Id, guid: itm.Id,
keyCode: string.IsNullOrEmpty(tm1.KeyCode) ? tm1.KeyCode : itm.KeyCode, keyCode: tm1 != null ? tm1.KeyCode : itm.KeyCode,
version: itm.Version, version: itm.Version,
billNum: itm.BillNum, billNum: itm.BillNum,
lU: itm.LU, lU: itm.LU,
rELU: string.IsNullOrEmpty(tm1.RepLU) ? tm1.RepLU : itm.LU, rELU: tm1 != null ? tm1.RepLU : itm.LU,
pN: itm.PN, pN: itm.PN,
rEPN: itm.PN, rEPN: itm.PN,
site: itm.Site, site: itm.Site,
@ -228,11 +270,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
select new HBPO_PD_DETAIL( select new HBPO_PD_DETAIL(
guid: itm.Id, guid: itm.Id,
keyCode: string.IsNullOrEmpty(tm1.KeyCode) ? tm1.KeyCode : itm.KeyCode, keyCode: tm1!=null ? tm1.KeyCode : itm.KeyCode,
version: itm.Version, version: itm.Version,
billNum: itm.BillNum, billNum: itm.BillNum,
lU: itm.LU, lU: itm.LU,
rELU: string.IsNullOrEmpty(tm1.RepLU) ? tm1.RepLU : itm.LU, rELU: tm1!=null ? tm1.RepLU : itm.LU,
pN: itm.PN, pN: itm.PN,
rEPN: itm.PN, rEPN: itm.PN,
site: itm.Site, site: itm.Site,
@ -314,7 +356,7 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
"INNER JOIN Set_PUB_SE_DETAIL tmp2 ON\n" + "INNER JOIN Set_PUB_SE_DETAIL tmp2 ON\n" +
"tmp1.KeyCode = tmp2.KeyCode\n"; "tmp1.KeyCode = tmp2.KeyCode\n";
var inv = DbConnection.Query<INVOICE_GRP>($"select * from set_INVOICE_GRP where InvGroupNum='{p_invGroup}'").FirstOrDefault(); var inv = GetInvoiceList(p_invGroup).FirstOrDefault();
Dictionary<PUB_PD, List<PUB_PD_DETAIL>> result = new Dictionary<PUB_PD, List<PUB_PD_DETAIL>>(); Dictionary<PUB_PD, List<PUB_PD_DETAIL>> result = new Dictionary<PUB_PD, List<PUB_PD_DETAIL>>();
var detail = DbConnection.Query<PUB_CAN_SA_DETAIL>($"select * from set_PUB_CAN_SA_DETAIL where billNum='{p_invGroup}'").ToList(); var detail = DbConnection.Query<PUB_CAN_SA_DETAIL>($"select * from set_PUB_CAN_SA_DETAIL where billNum='{p_invGroup}'").ToList();
var main = DbConnection.Query<PUB_CAN_SA>($"select * from set_PUB_CAN_SA where billNum='{p_invGroup}'").FirstOrDefault(); var main = DbConnection.Query<PUB_CAN_SA>($"select * from set_PUB_CAN_SA where billNum='{p_invGroup}'").FirstOrDefault();
@ -339,11 +381,11 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
from tm1 in temp1.DefaultIfEmpty() from tm1 in temp1.DefaultIfEmpty()
select new PUB_PD_DETAIL( select new PUB_PD_DETAIL(
guid: itm.Id, guid: itm.Id,
keyCode: string.IsNullOrEmpty(tm1.KeyCode) ? tm1.KeyCode : itm.KeyCode, keyCode: tm1!=null ? tm1.KeyCode : itm.KeyCode,
version: itm.Version, version: itm.Version,
billNum: itm.BillNum, billNum: itm.BillNum,
lU: itm.LU, lU: itm.LU,
rELU: string.IsNullOrEmpty(tm1.RepLU) ? tm1.RepLU : itm.LU, rELU: tm1==null ? tm1.RepLU : itm.LU,
pN: itm.PN, pN: itm.PN,
rEPN: itm.PN, rEPN: itm.PN,
site: itm.Site, site: itm.Site,
@ -365,6 +407,41 @@ namespace Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report
} }
/// <summary>
/// 发票分组下所有发票
/// </summary>
/// <param name="inv_group"></param>
/// <returns></returns>
public virtual List<INVOICE_GRP> GetInvoiceList(string inv_group)
{
return DbConnection.Query<INVOICE_GRP>(string.Format("select " +
" [Id] " +
",[RealnvBillNum] " +
",[InvbillNum] " +
",[Amt] " +
",[TaxAmt] " +
",[InvGroupNum] " +
",[FileName] " +
",[BusinessType] " +
",[State] " +
",[InvoiceState] " +
",[ParentInvbillNum] " +
",[Tax] " +
"from set_INVOICE_GRP where InvGroupNum='{0}'",inv_group)).ToList();
}
/// <summary>
/// 发票
/// </summary>
/// <param name="inv_bill"></param>
/// <returns></returns>
public virtual INVOICE_GRP GetInvoice(string inv_bill)
{
return DbConnection.QueryFirst<INVOICE_GRP>(string.Format("select * from set_INVOICE_GRP where InvbillNum='{0}'",inv_bill));
}
} }
} }

35
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/PD_SERVICE.cs

@ -9,6 +9,7 @@ using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel; using Magicodes.ExporterAndImporter.Excel;
using Microsoft.Extensions.DependencyInjection;
using NPOI.OpenXmlFormats.Spreadsheet; using NPOI.OpenXmlFormats.Spreadsheet;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using TaskJob.EventArgs; using TaskJob.EventArgs;
@ -16,11 +17,13 @@ using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities;
using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.Entities.SettleAccounts; using Win.Sfs.SettleAccount.Entities.SettleAccounts;
using Win.Sfs.SettleAccount.ExportReports; using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.SettleAccount.Repository.SettleAccount; using Win.Sfs.SettleAccount.Repository.SettleAccount;
using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report; using Win.Sfs.SettleAccount.Repository.SettleAccountJob.Report;
using Win.Sfs.Shared.RepositoryBase; using Win.Sfs.Shared.RepositoryBase;
@ -29,17 +32,23 @@ namespace SettleAccount.Job.Services
public class PD_SERVICE : ITransientDependency, IExportJob public class PD_SERVICE : ITransientDependency, IExportJob
{ {
private readonly PendingDeductionDapperRepository _dapper; private readonly PendingDeductionDapperRepository _dapper;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _invRepository; //private readonly BBAC_PD_MNG _pdmng;
public PD_SERVICE(PendingDeductionDapperRepository dapper,
INormalEfCoreRepository<INVOICE_GRP, Guid> invRepository IServiceProvider _serviceProvider;
public PD_SERVICE(
PendingDeductionDapperRepository dapper,
//BBAC_PD_MNG pdmng,
IServiceProvider serviceProvider
) )
{ {
_serviceProvider = serviceProvider;
_dapper = dapper; _dapper = dapper;
_invRepository = invRepository; //_pdmng=pdmng;
} }
[UnitOfWork(false)]
/// <summary> /// <summary>
/// 执行发票待开任务 /// 执行发票待开任务
/// </summary> /// </summary>
@ -49,8 +58,8 @@ namespace SettleAccount.Job.Services
/// <returns></returns> /// <returns></returns>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> customConditions) public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> customConditions)
{ {
var invgroup = customConditions.Where(p => p.Name == "InvoiceGroupNum").FirstOrDefault().Value; var invgroup = customConditions.Where(p => p.Name == "InvGroupNum").FirstOrDefault().Value;//获取发票分
var ls = _invRepository.Where(p => p.InvGroupNum == invgroup).ToList(); var ls = _dapper.GetInvoiceList(invgroup);
if (ls != null && ls.Count>0) if (ls != null && ls.Count>0)
{ {
var first=ls.FirstOrDefault(); var first=ls.FirstOrDefault();
@ -63,8 +72,8 @@ namespace SettleAccount.Job.Services
{ {
var main = c.Key; var main = c.Key;
var detail = c.Value; var detail = c.Value;
_invRepository.DbContext.BulkInsert(new List<HBPO_PD>() { main }); //_invRepository.GetDbContext().BulkInsert(new List<HBPO_PD>() { main });
_invRepository.DbContext.BulkInsert(detail); //_invRepository.GetDbContext().BulkInsert(detail);
} }
} }
else else
@ -81,14 +90,16 @@ namespace SettleAccount.Job.Services
{ {
var main = c.Key; var main = c.Key;
var detail = c.Value; var detail = c.Value;
_invRepository.DbContext.BulkInsert(new List<BBAC_PD>() { main });
_invRepository.DbContext.BulkInsert(detail); //_pdmng.InsertDetail(detail);
//_pdmng.InsertMain(main);
} }
} }
else else
{ {
} }
} }
else else
{ {
@ -99,8 +110,8 @@ namespace SettleAccount.Job.Services
{ {
var main = c.Key; var main = c.Key;
var detail = c.Value; var detail = c.Value;
_invRepository.DbContext.BulkInsert(new List<PUB_PD>() { main }); //_invRepository.DbContext.BulkInsert(new List<PUB_PD>() { main });
_invRepository.DbContext.BulkInsert(detail); //_invRepository.DbContext.BulkInsert(detail);
} }
} }
else else

6
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -97,6 +97,12 @@ namespace Win.Sfs.SettleAccount
{ {
return implementationFactory.GetService<HBPOEdiSeCompareExportService>(); return implementationFactory.GetService<HBPOEdiSeCompareExportService>();
} }
if (key.Equals(typeof(PD_SERVICE).FullName))
{
return implementationFactory.GetService<PD_SERVICE>();
}
if (key.Equals(typeof(InvoiceSettledDiffExportService).FullName)) if (key.Equals(typeof(InvoiceSettledDiffExportService).FullName))

Loading…
Cancel
Save