mahao 1 year ago
parent
commit
2422c15787
  1. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs
  2. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  3. 107
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs
  4. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs
  5. 104
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs
  6. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  7. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  8. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
  9. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  10. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  11. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  12. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  13. 116
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
  14. 29
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  15. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  16. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/AuthServer/AuthServerHostModule.cs

@ -1,4 +1,4 @@
using AuthServer.Host.EntityFrameworkCore; using AuthServer.Host.EntityFrameworkCore;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
@ -43,7 +43,6 @@ namespace AuthServer.Host
public class AuthServerHostModule : AbpModule public class AuthServerHostModule : AbpModule
{ {
private const string DefaultCorsPolicyName = "Default"; private const string DefaultCorsPolicyName = "Default";
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
var configuration = context.Services.GetConfiguration(); var configuration = context.Services.GetConfiguration();

9
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs

@ -13,9 +13,6 @@ using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
public class INVOICE_GRP_DTO : EntityDto<Guid> public class INVOICE_GRP_DTO : EntityDto<Guid>
{ {
@ -67,7 +64,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class INVOICE_GRP_EXP_DTO public class INVOICE_GRP_EXP_DTO
{ {
/// <summary> /// <summary>
@ -159,6 +155,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public List<INVOICE_MAP_GROUP_DTO> INVOICE_MAP_GROUP { get; set; } public List<INVOICE_MAP_GROUP_DTO> INVOICE_MAP_GROUP { get; set; }
public List<INVOICE_NOT_SETTLE_DTO> INVOICE_NOT_SETTLE { get; set; } public List<INVOICE_NOT_SETTLE_DTO> INVOICE_NOT_SETTLE { get; set; }
public List<PUB_ADJ_DETAIL_DTO> ADJ_DETAIL { get; set; }
} }
public class INVOICE_WAIT_DETAIL_DTO : EntityDto<Guid> public class INVOICE_WAIT_DETAIL_DTO : EntityDto<Guid>

107
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_ADJ_DETAIL_DTO.cs

@ -12,17 +12,6 @@ using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos; namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid> public class PUB_ADJ_DETAIL_DTO : EntityDto<Guid>
{ {
/// <summary>
///工厂地点
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; }
/// <summary>
///扩展1
/// </summary>
[Display(Name = "扩展1")]
public string Extend1 { get; set; }
/// <summary> /// <summary>
///作废发票号 ///作废发票号
/// </summary> /// </summary>
@ -33,86 +22,67 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
/// </summary> /// </summary>
[Display(Name = "发票号")] [Display(Name = "发票号")]
public string InvBillNum { get; set; } public string InvBillNum { get; set; }
public decimal Price { get; set; }
public int Version { get; set; } /// <summary>
public string SettleBillNum { get; set; } /// 下线日期
/// </summary>
[Display(Name = "下线日期")]
public DateTime SettleDate { get; set; } public DateTime SettleDate { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; } public string InvGroupNum { get; set; }
[Display(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
[Display(Name = "标识号")]
public string PN { get; set; } public string PN { get; set; }
public string KeyCode { get; set; } [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "结算分组")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
public class PUB_ADJ_DETAIL_EXP_DTO public class PUB_ADJ_DETAIL_EXP_DTO
{ {
/// <summary>
///工厂地点
/// </summary>
[ExporterHeader(DisplayName = "工厂地点")]
public string Site { get; set; }
/// <summary>
///扩展1
/// </summary>
[ExporterHeader(DisplayName = "扩展1")]
public string Extend1 { get; set; }
/// <summary>
///作废发票号
/// </summary>
[ExporterHeader(DisplayName = "作废发票号")]
public string OldInvBillNum { get; set; }
/// <summary> /// <summary>
///发票号 ///发票号
/// </summary> /// </summary>
[ExporterHeader(DisplayName = "发票号")] [Display(Name = "发票号")]
public string OldInvBillNum { get; set; }
[Display(Name = "新发票号")]
public string InvBillNum { get; set; } public string InvBillNum { get; set; }
public decimal Price { get; set; }
public int Version { get; set; } [Display(Name = "下线日期")]
public string SettleBillNum { get; set; }
public DateTime SettleDate { get; set; } public DateTime SettleDate { get; set; }
public string InvGroupNum { get; set; }
[Display(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
[Display(Name = "标识号")]
public string PN { get; set; } public string PN { get; set; }
public string KeyCode { get; set; } [Display(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[Display(Name = "结算分组号")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
public class PUB_ADJ_DETAIL_IMP_DTO public class PUB_ADJ_DETAIL_IMP_DTO
{ {
/// <summary>
///工厂地点
/// </summary>
[ImporterHeader(Name = "工厂地点")]
public string Site { get; set; }
/// <summary>
///扩展1
/// </summary>
[ImporterHeader(Name = "扩展1")]
public string Extend1 { get; set; }
/// <summary>
///作废发票号
/// </summary>
[ImporterHeader(Name = "作废发票号")]
public string OldInvBillNum { get; set; }
/// <summary> /// <summary>
///发票号 ///发票号
/// </summary> /// </summary>
[ImporterHeader(Name = "发票号")] [ImporterHeader(Name = "发票号")]
public string InvBillNum { get; set; } public string OldInvBillNum { get; set; }
public decimal Price { get; set; } [ImporterHeader(Name = "下线日期")]
public int Version { get; set; }
public string SettleBillNum { get; set; }
public DateTime SettleDate { get; set; } public DateTime SettleDate { get; set; }
public string InvGroupNum { get; set; } [ImporterHeader(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
[ImporterHeader(Name = "标识号")]
public string PN { get; set; } public string PN { get; set; }
public string KeyCode { get; set; } [ImporterHeader(Name = "数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[ImporterHeader(Name = "结算分组号")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }
@ -120,21 +90,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
public class PUB_ADJ_DETAIL_REQ_DTO : RequestInputBase public class PUB_ADJ_DETAIL_REQ_DTO : RequestInputBase
{ {
[Display(Name = "工厂地点")] /// <summary>
public string Site { get; set; } ///发票号
[Display(Name = "扩展1")] /// </summary>
public string Extend1 { get; set; }
[Display(Name = "作废发票号")]
public string OldInvBillNum { get; set; }
[Display(Name = "发票号")] [Display(Name = "发票号")]
public string InvBillNum { get; set; } public string OldInvBillNum { get; set; }
public string InvGroupNum { get; set; } [Display(Name = "下线日期")]
public DateTime SettleDate { get; set; }
[Display(Name = "零件号")]
public string LU { get; set; } public string LU { get; set; }
[Display(Name = "标识号")]
public string PN { get; set; } public string PN { get; set; }
public string KeyCode { get; set; } [Display(Name = "数量")]
public decimal Qty { get; set; }
[Display(Name = "结算分组号")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs

@ -12,7 +12,6 @@ using Win.Sfs.Shared.Filter;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
public class PUB_CAN_SA_DTO : EntityDto<Guid> public class PUB_CAN_SA_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
@ -146,13 +145,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string LU { get; set; } public string LU { get; set; }
[ExporterHeader(DisplayName = "发货单号、交付单号")] [ExporterHeader(DisplayName = "发货单号、交付单号")]
public string PN { get; set; } public string PN { get; set; }
[ExporterHeader(DisplayName = "结算数量")] [ExporterHeader(DisplayName = "结算数量")]
public decimal Qty { get; set; } public decimal Qty { get; set; }
[ExporterHeader(DisplayName = "结算分组号")] [ExporterHeader(DisplayName = "结算分组号")]
public string GroupNum { get; set; } public string GroupNum { get; set; }
} }

104
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/ADJ_SERVICE.cs

@ -0,0 +1,104 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases;
/// <summary>
/// 发票明细调整表
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class ADJ_SERVICE : BASE_SERVICE
{
protected readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _repository;
protected readonly BaseDomainService _baseDomainService;
public ADJ_SERVICE(
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> repository,
BaseDomainService baseDomainService,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
)
: base(excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
_baseDomainService = baseDomainService;
}
/// <summary>
///查询明细
/// </summary>
/// <param name="input">明细查询条件</param>
/// <returns></returns>
[HttpPost]
public virtual async Task<PagedResultDto<PUB_ADJ_DETAIL_DTO>> DetailQueryAsync(PUB_ADJ_DETAIL_REQ_DTO input)
{
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(entitys);
return new PagedResultDto<PUB_ADJ_DETAIL_DTO>(totalCount, dtos);
}
/// <summary>
/// 导入文件
/// </summary>
/// <param name="files"></param>
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
[HttpPost]
[DisableRequestSizeLimit]
public async Task<string> ExcelImport([FromForm] IFormFileCollection files)
{
List<ErrorExportDto> errorList = new List<ErrorExportDto>();
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PUB_ADJ_DETAIL_IMP_DTO>(files, _excelImportService);
if (result.Count == 0)
{
throw new BusinessException("8989", "导入数据记录为0条");
}
var deletels = _repository.Where(p => p.OldInvBillNum == result.FirstOrDefault().OldInvBillNum).ToList();
var first = deletels.FirstOrDefault();
if (!string.IsNullOrEmpty(first.InvBillNum))
{
throw new BusinessException("8989", $"调整记录已经新发票号:{first.InvBillNum}");
}
var entityList = ObjectMapper.Map<List<PUB_ADJ_DETAIL_IMP_DTO>, List<PUB_ADJ_DETAIL>>(result);
var codelist = entityList.Select(p => p.LU).ToList();
var errors = await _baseDomainService.CheckBase(codelist, new BASE_CONF() { IsRelationShip = true });
foreach (var itm in errors)
{
errorList.Add(
new ErrorExportDto() { ItemCode = $"{itm}", Message = $"[客户零件关系表]不存在客户零件号{itm}" });
}
var errorEntitylist = await _baseDomainService.CheckPriceList(entityList);
if (errorEntitylist.Count > 0)
{
foreach (var itm in errorEntitylist)
{
errorList.Add(new ErrorExportDto() { ItemCode = $"{itm.LU}", Message = $"客户零件号{itm.LU}标识号{itm.PN}下线日期{itm.SettleDate}不存在价格单记录" });
}
}
await _repository.DbContext.BulkDeleteAsync(deletels);//删除发票下所有调整明细
await _repository.DbContext.BulkInsertAsync(entityList);
return ApplicationConsts.SuccessStr;
}
}

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

@ -313,10 +313,10 @@ 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, int p_version, string p_parentInvBillNum) protected async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> p_list, List<PUB_ADJ_DETAIL> p_adjlist, int p_version, string p_parentInvBillNum)
{ {
return await _invMng.ReissueSecInvoice(p_list,p_parentInvBillNum, p_version); return await _invMng.ReissueSecInvoice(p_list,p_adjlist,p_parentInvBillNum, p_version);
} }
@ -330,9 +330,9 @@ 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,int p_version, string p_parentInvBillNum) protected async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<PUB_ADJ_DETAIL> p_adjlist, int p_version, string p_parentInvBillNum)
{ {
return await _invMng.ReissueFirstInvoice(dtos,p_parentInvBillNum,p_version); return await _invMng.ReissueFirstInvoice(dtos,p_adjlist,p_parentInvBillNum,p_version);
} }
/// <summary> /// <summary>

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

@ -167,7 +167,12 @@ namespace Win.Sfs.SettleAccount.Bases
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(List<TEMP_CAN_SA_DETAIL> p_list, int p_version, string p_InvGroupNum, string p_parentInvBillNum,EnumBusinessType businessType)
{ {
return await _invmng.SecInvoice(p_list, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); var ls= await _invmng.SecInvoice(p_list, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (ls.Count > 0)
{
return true;
}
return false;
} }
@ -183,7 +188,15 @@ namespace Win.Sfs.SettleAccount.Bases
/// <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(List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
{ {
return await _invmng.FirstInvoice(dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
var ls = await _invmng.FirstInvoice(dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
if (ls.Count > 0)
{
return true;
}
return false;
} }
/// <summary> /// <summary>

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

@ -27,19 +27,12 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases namespace Win.Sfs.SettleAccount.Bases
{ {
public abstract class NOT_SA_SERVICE<TEntityDetail, TEntityDetailDto, TRequestDetailInput, TEntityDetailExportDto> : BASE_SERVICE public abstract class NOT_SA_SERVICE<TEntityDetail, TEntityDetailDto, TRequestDetailInput, TEntityDetailExportDto> : BASE_SERVICE
where TEntityDetail : SA_NOT_BASE where TEntityDetail : SA_NOT_BASE
where TEntityDetailDto : class, IEntityDto<Guid>, new() where TEntityDetailDto : class, IEntityDto<Guid>, new()
where TRequestDetailInput : RequestInputBase where TRequestDetailInput : RequestInputBase
where TEntityDetailExportDto : class, new() where TEntityDetailExportDto : class, new()
{ {
protected readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository; protected readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
protected NOT_SA_SERVICE( protected NOT_SA_SERVICE(
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
@ -49,6 +42,7 @@ namespace Win.Sfs.SettleAccount.Bases
) )
: base(excelImportService, snowflakeIdGenerator, commonManager) : base(excelImportService, snowflakeIdGenerator, commonManager)
{ {
_detailRepository=detailRepository;
} }
/// <summary> /// <summary>

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

@ -1,7 +1,6 @@
using DocumentFormat.OpenXml.Bibliography;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
@ -85,7 +84,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!"); throw new BusinessException("8989", $"选择发票:{p_invbillnum}状态为报废状态不能重开!");
} }
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件 var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum, gList);//结算分组对应结算零件
var adjlist = await _adjRepository.Where(p => p.InvBillNum == 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)
@ -149,11 +148,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开 if (p_invbillnum.Substring(0, 3) == "INV")//一次开票重开
{ {
await ReissueFirstInvoice(dtos, version, p_invbillnum); await ReissueFirstInvoice(dtos,adjlist ,version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos, version, p_invbillnum); await ReissueSecInvoice(dtos,adjlist,version, p_invbillnum);
} }
} }
} }

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

@ -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, version, p_invbillnum); await ReissueFirstInvoice(dtos,adjlist, version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos, version, p_invbillnum); await ReissueSecInvoice(dtos,adjlist, version, p_invbillnum);
} }
} }
} }

18
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs

@ -39,6 +39,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository; private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository; private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository; private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
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;
@ -50,6 +51,7 @@ 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,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
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,
@ -61,6 +63,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_wRepository = wRepository; _wRepository = wRepository;
_mRepository = mRepository; _mRepository = mRepository;
_sRepository = sRepository; _sRepository = sRepository;
_adjRepository = adjRepository;
_pubMng = pubMng; _pubMng = pubMng;
_bbacMng = bbacMng; _bbacMng = bbacMng;
_hbpoMng = hbpoMng; _hbpoMng = hbpoMng;
@ -95,9 +98,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w); var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s); var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
var adjs =await _adjRepository.GetListByFilterAsync(input.Filters);
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);
_entity.INVOICE_NOT_SETTLE = sdtos; _entity.INVOICE_NOT_SETTLE = sdtos;
_entity.INVOICE_WAIT_DETAIL = wdtos; _entity.INVOICE_WAIT_DETAIL = wdtos;
_entity.INVOICE_MAP_GROUP = mdtos; _entity.INVOICE_MAP_GROUP = mdtos;
_entity.ADJ_DETAIL = adjdtos;
return _entity; return _entity;
@ -146,25 +152,25 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
IExporter _csv = new CsvExporter(); IExporter _csv = new CsvExporter();
ExcelExporter _excel = new ExcelExporter(); ExcelExporter _excel = new ExcelExporter();
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities); var dtoDetails = ObjectMapper.Map<List<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(entities);
var invdetail= await DetailQueryAsync(input); var invdetail= await DetailQueryAsync(input);
var m = invdetail.INVOICE_MAP_GROUP; var m = invdetail.INVOICE_MAP_GROUP;
var not=invdetail.INVOICE_NOT_SETTLE; var not=invdetail.INVOICE_NOT_SETTLE;
var detail =invdetail.INVOICE_WAIT_DETAIL; var detail =invdetail.INVOICE_WAIT_DETAIL;
var adj = invdetail.ADJ_DETAIL;
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name; var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(INVOICE_GRP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
var result = _excel
.Append(dtoDetails,"发票表")
var result = _excel.Append(dtoDetails,"发票表").SeparateBySheet() .SeparateBySheet()
.Append(m, "发票和结算分组关系") .Append(m, "发票和结算分组关系")
.SeparateBySheet() .SeparateBySheet()
.Append(not, "对应未结结算分组") .Append(not, "对应未结结算分组")
.SeparateBySheet() .SeparateBySheet()
.Append(detail, "发票明细") .Append(detail, "发票明细")
.SeparateBySheet()
.Append(adj,"发票调整单")
.ExportAppendDataAsByteArray(); .ExportAppendDataAsByteArray();
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //保存导出文件到服务器存成二进制

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

@ -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, version, p_invbillnum); await ReissueFirstInvoice(dtos,adjlist, version, p_invbillnum);
} }
else//二次开票 else//二次开票
{ {
await ReissueSecInvoice(dtos, version, p_invbillnum); await ReissueSecInvoice(dtos,adjlist, version, p_invbillnum);
} }
} }
} }

116
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases; using SettleAccount.Bases;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -13,43 +13,56 @@ using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.Entities.Materials; using Win.Sfs.SettleAccount.Entities.Materials;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.FISes; using Win.Sfs.SettleAccount.FISes;
using Win.Sfs.SettleAccount.MaterialRelationships; using Win.Sfs.SettleAccount.MaterialRelationships;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases.DomainServices namespace Win.Sfs.SettleAccount.Bases.DomainServices
{ {
public class BaseDomainService:DomainService, ICheck public class BaseDomainService : DomainService
{ {
private readonly ISettleAccountBQEfCoreRepository<Material, Guid> _materialRepository; private readonly INormalEfCoreRepository<Material, Guid> _materialRepository;
private readonly ISettleAccountBQEfCoreRepository<MaterialRelationship, Guid> _relationshipRepository; private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationshipRepository;
private readonly ISettleAccountBQEfCoreRepository<Bom, Guid> _bomshipRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
private readonly INormalEfCoreRepository<Bom, Guid> _bomshipRepository;
public BaseDomainService( public BaseDomainService(
IGuidGenerator guidGenerator, IGuidGenerator guidGenerator,
IObjectMapper objectMapper, IObjectMapper objectMapper,
ISettleAccountBQEfCoreRepository<Material, Guid> materialRepository, INormalEfCoreRepository<Material, Guid> materialRepository,
ISettleAccountBQEfCoreRepository<MaterialRelationship, Guid> relationshipRepository, INormalEfCoreRepository<MaterialRelationship, Guid> relationshipRepository,
ISettleAccountBQEfCoreRepository<Bom, Guid> bomshipRepository INormalEfCoreRepository<Bom, Guid> bomshipRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<PriceListBJ, Guid> pricebjRepository
//IExcelImportAppService excelImportService, //IExcelImportAppService excelImportService,
//ISnowflakeIdGenerator snowflakeIdGenerator, //ISnowflakeIdGenerator snowflakeIdGenerator,
//ICommonManager commonManager //ICommonManager commonManager
) )
{ {
_pricebjRepository = pricebjRepository;
_pricebjRepository= pricebjRepository;
_materialRepository = materialRepository; _materialRepository = materialRepository;
_relationshipRepository = relationshipRepository; _relationshipRepository = relationshipRepository;
_bomshipRepository = bomshipRepository; _bomshipRepository = bomshipRepository;
} }
public async Task<List<string>> CheckBase<TEntity>(List<TEntity> p_list ,BASE_CONF p_config) where TEntity : ISBASE
public async Task<List<string>> CheckBase(List<string> p_list, BASE_CONF p_config)
{ {
List<string> errorList = new List<string>(); List<string> errorList = new List<string>();
var partList= p_list.Select(p=>p.LU).Distinct().ToList(); var partList = p_list;
if (p_config.IsBom == true) if (p_config.IsBom == true)
{ {
var bomList = await _bomshipRepository.ToListAsync(); var bomList = await _bomshipRepository.ToListAsync();
var query=from itm in partList join itm1 in bomList on itm equals itm1.ParentItemCode var query = from itm in partList
join itm1 in bomList on itm equals itm1.ParentItemCode
into temp into temp
from tm in temp.DefaultIfEmpty() from tm in temp.DefaultIfEmpty()
where tm == null where tm == null
@ -90,31 +103,13 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
errorList.Add(partcode); errorList.Add(partcode);
} }
} }
if (p_config.IsRelationShip == true)
{
var materialList = await _relationshipRepository.ToListAsync();
var query = from itm in partList
join itm1 in materialList on itm equals itm1.SettleMaterialCode
into temp
from tm in temp.DefaultIfEmpty()
where tm == null
select itm;
foreach (var partcode in query.ToList())
{
errorList.Add(partcode);
}
}
return errorList; return errorList;
} }
public async Task<List<string>> CheckBase<TEntity>(List<TEntity> p_list, BASE_CONF p_config) where TEntity : ISBASE
public async Task<List<string>> CheckBase<TEntity>(List<string> p_list, BASE_CONF p_config)
{ {
List<string> errorList = new List<string>(); List<string> errorList = new List<string>();
var partList = p_list; var partList = p_list.Select(p => p.LU).Distinct().ToList();
if (p_config.IsBom == true) if (p_config.IsBom == true)
{ {
@ -161,19 +156,70 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
errorList.Add(partcode); errorList.Add(partcode);
} }
} }
if (p_config.IsRelationShip == true)
{
var materialList = await _relationshipRepository.ToListAsync();
var query = from itm in partList
join itm1 in materialList on itm equals itm1.SettleMaterialCode
into temp
from tm in temp.DefaultIfEmpty()
where tm == null
select itm;
foreach (var partcode in query.ToList())
{
errorList.Add(partcode);
}
}
return errorList; return errorList;
} }
public async Task<List<TEntity>> CheckPriceList<TEntity>(List<TEntity> p_list,bool isBj=false)
where TEntity : ISA_BASE,new()
{
List<TEntity> errorList = new List<TEntity>();
if (isBj == true)
{
var pricebjlist = _pricebjRepository.ToList();
var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU
where
d.SettleDate >= p.BeginDate && d.SettleDate <= p.EndDate
select d;
var left = from d in p_list
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
errorList = left.ToList();
} }
public interface ICheck else
{ {
Task<List<string>> CheckBase<TEntity>(List<TEntity> p_list, BASE_CONF p_config) where TEntity : ISBASE; var pricebjlist = _priceRepository.ToList();
var inner = from d in p_list
join p in pricebjlist on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime
select d;
var left = from d in p_list
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
errorList = left.ToList();
} }
return errorList;
}
}
} }

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

@ -127,10 +127,10 @@ 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>
/// 结算日期 /// 结算日期
/// </summary> /// </summary>
@ -322,6 +322,10 @@ namespace SettleAccount.Bases
IsMaterial = isMaterial; IsMaterial = isMaterial;
IsBom = isBom; IsBom = isBom;
} }
public BASE_CONF()
{
}
} }
@ -371,15 +375,9 @@ namespace SettleAccount.Bases
/// </summary> /// </summary>
public virtual string GroupNum { get ; set ; } public virtual string GroupNum { get ; set ; }
} }
public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_CAN_BASE public class SA_CAN_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
{ {
protected SA_CAN_BASE() { } protected SA_CAN_BASE() { }
public SA_CAN_BASE(Guid id) : base(id) { } public SA_CAN_BASE(Guid id) : base(id) { }
@ -443,7 +441,13 @@ namespace SettleAccount.Bases
// GroupNum = groupNum; // GroupNum = groupNum;
//} //}
} }
public class SA_NOT_BASE : AuditedAggregateRoot<Guid>, ISA_NOT_BASE
public class SA_NOT_BASE : AuditedAggregateRoot<Guid>, ISA_BASE
{ {
public SA_NOT_BASE() public SA_NOT_BASE()
{ {
@ -489,6 +493,7 @@ namespace SettleAccount.Bases
/// 結算分組號 /// 結算分組號
/// </summary> /// </summary>
public string GroupNum { get; set; } public string GroupNum { get; set; }
//public SA_NOT_BASE(decimal price, int version, string settleBillNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum) //public SA_NOT_BASE(decimal price, int version, string settleBillNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{ //{
// Price = price; // Price = price;

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

@ -276,6 +276,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <returns></returns> /// <returns></returns>
public virtual async Task<bool> ReceivedAsync(string p_groupbillnum) public virtual async Task<bool> ReceivedAsync(string p_groupbillnum)
{ {
var inv = _repository.Where(p => p.InvGroupNum == p_groupbillnum).FirstOrDefault(); var inv = _repository.Where(p => p.InvGroupNum == p_groupbillnum).FirstOrDefault();
if (inv.BusinessType == EnumBusinessType.JisBBAC) if (inv.BusinessType == EnumBusinessType.JisBBAC)
{ {
@ -541,8 +542,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<bool> SecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType) public async Task<List<string>> SecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
{ {
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
{ {
@ -704,10 +706,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkInsertAsync(groupList); await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList); await _repository.DbContext.BulkInsertAsync(detailList);
//await _repository.DbContext.BulkInsertAsync(notDetialList); //await _repository.DbContext.BulkInsertAsync(notDetialList);
return true; _invls = invlist.Select(p => p.InvbillNum).ToList();
} }
return false; return _invls;
} }
@ -721,8 +722,9 @@ 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<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) 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)
{ {
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) });
Dictionary<string, decimal> dic = new Dictionary<string, decimal>();//原本 Dictionary<string, decimal> dic = new Dictionary<string, decimal>();//原本
Dictionary<string, decimal> copyDic = new Dictionary<string, decimal>();//变换数组副本 Dictionary<string, decimal> copyDic = new Dictionary<string, decimal>();//变换数组副本
@ -891,8 +893,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{ {
await _repository.DbContext.BulkInsertAsync(notDetialList); await _repository.DbContext.BulkInsertAsync(notDetialList);
} }
_invls =invlist.Select(p => p.InvbillNum).ToList();
} }
return true;
return _invls;
} }
/// <summary> /// <summary>
@ -903,7 +907,7 @@ 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, string p_OldInvBillNum, int p_version) public async Task<bool> ReissueFirstInvoice(List<TEMP_CAN_SA_DETAIL> dtos,List<PUB_ADJ_DETAIL> p_adjlist, string p_OldInvBillNum, int p_version)
{ {
if (!string.IsNullOrEmpty(p_OldInvBillNum)) if (!string.IsNullOrEmpty(p_OldInvBillNum))
{ {
@ -918,7 +922,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
throw new BusinessException("8989", $"选择要重开发票号{p_OldInvBillNum}已经作废不能重开"); throw new BusinessException("8989", $"选择要重开发票号{p_OldInvBillNum}已经作废不能重开");
} }
inv.InvoiceState = InvoiceBillState.; inv.InvoiceState = InvoiceBillState.;
await FirstInvoice(dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType); var invlist=await FirstInvoice(dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);//重开可以变多张发票
if (invlist.Count == 0)
{
return false;
}
foreach (var adj in p_adjlist)
{
adj.InvBillNum = string.Join(",", invlist);
}
_repository.DbContext.BulkUpdate(p_adjlist);
_repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv }); _repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv });
return true; return true;
} }
@ -932,7 +948,7 @@ 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, string p_OldInvBillNum, int p_version) public async Task<bool> ReissueSecInvoice(List<TEMP_CAN_SA_DETAIL> dtos, List<PUB_ADJ_DETAIL> p_adjlist, string p_OldInvBillNum, int p_version)
{ {
if (!string.IsNullOrEmpty(p_OldInvBillNum)) if (!string.IsNullOrEmpty(p_OldInvBillNum))
{ {
@ -948,9 +964,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
} }
inv.InvoiceState = InvoiceBillState.; inv.InvoiceState = InvoiceBillState.;
var invlist =await SecInvoice(dtos, p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);
if (invlist.Count == 0)
{
return false;
}
await FirstInvoice(dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType);
_repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv }); _repository.DbContext.BulkUpdate(new List<INVOICE_GRP> { inv });
foreach (var adj in p_adjlist)
{
adj.InvBillNum = string.Join(",", invlist);
}
_repository.DbContext.BulkUpdate(p_adjlist);
return true; return true;
} }
return false; return false;

3
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs

@ -10,6 +10,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Temp;
public class TMEP_INV public class TMEP_INV
{ {
public string LU { set; get; } public string LU { set; get; }
/// <summary>
/// 合同号
/// </summary>
public string ContractDocID { set; get; } public string ContractDocID { set; get; }
public decimal Amt { set; get; } public decimal Amt { set; get; }
public decimal Qty { set; get; } public decimal Qty { set; get; }

Loading…
Cancel
Save