From ff14c760f749e119981be443b58737f6238a70c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Tue, 18 Jul 2023 17:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9F=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bases/BASE_SERVICE.cs | 94 +++++++++++++++++++ .../Bases/BA_SERVICE.cs | 58 ++++++++++-- .../Bases/CAN_SA_SERVICE.cs | 33 +++++-- .../Bases/NOT_SA_SERVICE.cs | 30 ++++-- .../Bases/PD_SERVICE.cs | 33 +++++-- .../Entities/BQ/BBAC_BA_SERVICE.cs | 6 +- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 4 +- .../Entities/BQ/BBAC_NOT_SA_SERVICE.cs | 55 ++++++++++- .../Entities/BQ/BBAC_PD_SERVICE.cs | 3 + .../Entities/BQ/HBPO_CAN_SA_SERVICE.cs | 4 + .../Entities/BQ/HBPO_NOT_SA_SERVICE.cs | 48 +++++++++- .../Entities/BQ/PUB_CAN_SA_SERVICE.cs | 4 + .../Entities/BQ/PUB_NOT_SA_SERVICE.cs | 49 +++++++++- .../SettleAccount.Domain/Bases/EntityBase.cs | 2 - .../Entities/BQ/Managers/CAN_SA_MNG.cs | 13 ++- .../Entities/BQ/PUB_CAN_SA.cs | 6 +- 16 files changed, 402 insertions(+), 40 deletions(-) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs new file mode 100644 index 00000000..7b37206c --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs @@ -0,0 +1,94 @@ +using Shouldly; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.Caching; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities; +using Win.Abp.Snowflakes; +using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.CommonManagers; +using Win.Sfs.SettleAccount.Constant; +using Win.Sfs.SettleAccount.ExcelImporter; +using Win.Sfs.SettleAccount.ExportReports; + +namespace Win.Sfs.SettleAccount.Bases +{ + + + public abstract class BASE_SERVICE: ApplicationService, ITransientDependency + { + + + protected readonly IExcelImportAppService _excelImportService; + + protected readonly ISnowflakeIdGenerator _snowflakeIdGenerator; + + protected readonly ICommonManager _commonManager; + + protected BASE_SERVICE() { } + + protected BASE_SERVICE( + + IExcelImportAppService excelImportService, + ISnowflakeIdGenerator snowflakeIdGenerator, + ICommonManager commonManager) + { + _excelImportService = excelImportService; + _snowflakeIdGenerator = snowflakeIdGenerator; + _commonManager = commonManager; + + } + + + /// + /// 输出报错信息 + /// + /// + /// + /// + protected async Task ExportErrorReportAsync(List errorList, string fileName = "") + { + //没有信息返回成功 + if (errorList == null || errorList.Count == 0) + { + return ApplicationConsts.SuccessStr; + } + + if (string.IsNullOrEmpty(fileName)) + { + //导出文件名称 + fileName = CommonMethod.GetExcelFileNameByUserID(ApplicationConsts.CheckErroFileName, _snowflakeIdGenerator.Create().ToString(), ApplicationConsts.FileExtension); + } + + errorList = errorList.Distinct().OrderBy(p => p.Type).ThenBy(p => p.Model).ThenBy(p => p.ItemCode).ToList(); + + //声明导出容器 + ExportImporter _exportImporter = new ExportImporter(); + + var result = await _exportImporter.ExcelExporter(errorList); + + result.ShouldNotBeNull(); + + //保存导出文件到服务器存成二进制 + await _excelImportService.SaveBlobAsync( + new SaveExcelImportInputDto + { + Name = fileName, + Content = result + } + ); + return fileName; + } + + + + + } + + + +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index fd2b86dc..4252da2d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -15,14 +15,17 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; 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 { - public abstract class BA_SERVICE:ApplicationService + public abstract class BA_SERVICE: BASE_SERVICE { private readonly INormalEfCoreRepository _repository; private readonly INormalEfCoreRepository _wRepository; @@ -30,6 +33,7 @@ namespace Win.Sfs.SettleAccount.Bases private readonly INormalEfCoreRepository _mRepository; //private readonly INormalEfCoreRepository _detailRepository; private readonly IExcelImportAppService _excelImportService; + protected BA_SERVICE( INormalEfCoreRepository repository, @@ -37,22 +41,34 @@ namespace Win.Sfs.SettleAccount.Bases INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService + //INormalEfCoreRepository detailRepository ) { + _excelImportService = excelImportService; _repository = repository; _wRepository = wRepository; _mRepository = mRepository; _sRepository = sRepository; } + + /// + /// 审核发票通过 + /// + /// + /// public virtual async Task GenerateInvoice(INVOICE_GRP_REQ_DTO input) { return ApplicationConsts.SuccessStr; } - + /// + /// 主表查询 + /// + /// 主表查询条件 + /// [HttpPost] //[Route("mainquery")] public virtual async Task> MainQueryAsync(INVOICE_GRP_REQ_DTO input) @@ -62,24 +78,34 @@ namespace Win.Sfs.SettleAccount.Bases var dtos = ObjectMapper.Map, List>(entitys); return new PagedResultDto(totalCount, dtos); } + /// + /// 查询明细明细 + /// + /// 明细查询条件 + /// [HttpPost] public virtual async Task DetailQueryAsync(INVOICE_GRP_REQ_DTO input) { - INVOICE_GRP_DETAIL_DTO _entity=new INVOICE_GRP_DETAIL_DTO(); + INVOICE_GRP_DETAIL_DTO entity=new INVOICE_GRP_DETAIL_DTO(); var m= await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var mdtos = ObjectMapper.Map, List>(m); var w=await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var wdtos = ObjectMapper.Map, List>(w); var s=await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount); var sdtos = ObjectMapper.Map, List>(s); - _entity.INVOICE_NOT_SETTLE = sdtos; - _entity.INVOICE_WAIT_DETAIL = wdtos; - _entity.INVOICE_MAP_GROUP = mdtos; - return _entity; + entity.INVOICE_NOT_SETTLE = sdtos; + entity.INVOICE_WAIT_DETAIL = wdtos; + entity.INVOICE_MAP_GROUP = mdtos; + return entity; } + /// + /// 导出文件 + /// + /// 主表查询条件 + /// [HttpPost] public virtual async Task ExportAsync(INVOICE_GRP_REQ_DTO input) { @@ -112,11 +138,29 @@ namespace Win.Sfs.SettleAccount.Bases ); return _fileName; } + /// + /// 退回 + /// + /// 主表查询条件 + /// [HttpPost] public virtual async Task RejectAsync(INVOICE_GRP_REQ_DTO input) { + + + return ApplicationConsts.SuccessStr; } + + + + + + protected virtual async Task RuleAsync(INVOICE_GRP_REQ_DTO input) + { + return ApplicationConsts.SuccessStr; + + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs index e7ed0eca..d73c2735 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs @@ -17,15 +17,18 @@ using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Volo.Abp.ObjectMapping; using Volo.Abp.TenantManagement.EntityFrameworkCore; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ; 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 { - public abstract class CAN_SA_SERVICE :ApplicationService + public abstract class CAN_SA_SERVICE : BASE_SERVICE where TEntity : class, IEntity where TEntityDetail:SA_CAN_BASE where TEntityDto : class, IEntityDto, new() @@ -38,6 +41,7 @@ namespace Win.Sfs.SettleAccount.Bases private readonly INormalEfCoreRepository _repository; private readonly INormalEfCoreRepository _detailRepository; private readonly IExcelImportAppService _excelImportService; + protected CAN_SA_SERVICE( INormalEfCoreRepository repository, @@ -52,7 +56,11 @@ namespace Win.Sfs.SettleAccount.Bases } - + /// + ///查询明细 + /// + /// 明细查询条件 + /// [HttpPost] //[Route("detailquery")] public virtual async Task> DetailQueryAsync(TRequestDetailInput input) @@ -64,6 +72,11 @@ namespace Win.Sfs.SettleAccount.Bases return new PagedResultDto(totalCount, dtos); } + /// + /// 导出 + /// + /// 明细查询条件 + /// [HttpPost] //[Route("export")] public virtual async Task ExportAsync(TRequestDetailInput input) @@ -99,12 +112,22 @@ namespace Win.Sfs.SettleAccount.Bases ); return _fileName; } + /// + /// 生成发票 + /// + /// 主表查询条件 + /// [HttpPost] //[Route("generateinvoice")] public virtual async Task GenerateInvoice(TRequestMainInput input) { return ApplicationConsts.SuccessStr; } + /// + /// 查询主表 + /// + /// 主表查询条件 + /// [HttpPost] //[Route("mainquery")] public virtual async Task> MainQueryAsync(TRequestMainInput input) @@ -115,11 +138,7 @@ namespace Win.Sfs.SettleAccount.Bases return new PagedResultDto(totalCount, dtos); } - - - - - + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs index 9a7a4271..f21c0f78 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs @@ -15,14 +15,17 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; 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 { - public abstract class NOT_SA_SERVICE : ApplicationService + public abstract class NOT_SA_SERVICE : BASE_SERVICE where TEntityDetail : SA_NOT_BASE @@ -33,8 +36,9 @@ namespace Win.Sfs.SettleAccount.Bases { - private readonly INormalEfCoreRepository _detailRepository; - private readonly IExcelImportAppService _excelImportService; + protected readonly INormalEfCoreRepository _detailRepository; + protected readonly IExcelImportAppService _excelImportService; + protected NOT_SA_SERVICE( @@ -46,7 +50,11 @@ namespace Win.Sfs.SettleAccount.Bases _excelImportService = excelImportService; _detailRepository = detailRepository; } - + /// + /// 查询明细 + /// + /// + /// [HttpPost] //[Route("detailquery")] public virtual async Task> DetailQueryAsync(TRequestDetailInput input) @@ -58,6 +66,11 @@ namespace Win.Sfs.SettleAccount.Bases return new PagedResultDto(totalCount, dtos); } + /// + /// 导出 + /// + /// + /// [HttpPost] //[Route("export")] public virtual async Task ExportAsync(TRequestDetailInput input) @@ -93,12 +106,17 @@ namespace Win.Sfs.SettleAccount.Bases ); return _fileName; } + /// + /// 生成可计算单 + /// + /// + /// [HttpPost] - public virtual async Task GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input) + public virtual async Task GenerateSettlementOrder(TRequestDetailInput input) { return ApplicationConsts.SuccessStr; } - + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs index aaf8b1d7..64b5dc31 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs @@ -15,14 +15,17 @@ using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; +using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; 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 { - public class PD_SERVICE : ApplicationService + public class PD_SERVICE : BASE_SERVICE where TEntity : PD_BASE_MAIN where TEntityDetail : PD_BASE where TEntityDto : class, IEntityDto, new() @@ -35,6 +38,7 @@ namespace Win.Sfs.SettleAccount.Bases private readonly INormalEfCoreRepository _repository; private readonly INormalEfCoreRepository _detailRepository; private readonly IExcelImportAppService _excelImportService; + protected PD_SERVICE( INormalEfCoreRepository repository, @@ -50,6 +54,11 @@ namespace Win.Sfs.SettleAccount.Bases } + /// + /// 查询明细 + /// + /// + /// [HttpPost] //[Route("detailquery")] public virtual async Task> DetailQueryAsync(TRequestDetailInput input) @@ -61,6 +70,11 @@ namespace Win.Sfs.SettleAccount.Bases return new PagedResultDto(totalCount, dtos); } + /// + /// 导出 + /// + /// + /// [HttpPost] //[Route("export")] public virtual async Task ExportAsync(TRequestDetailInput input) @@ -102,6 +116,11 @@ namespace Win.Sfs.SettleAccount.Bases { return ApplicationConsts.SuccessStr; } + /// + /// 查询主表 + /// + /// + /// [HttpPost] //[Route("mainquery")] public virtual async Task> MainQueryAsync(TRequestMainInput input) @@ -111,7 +130,11 @@ namespace Win.Sfs.SettleAccount.Bases var dtos = ObjectMapper.Map, List>(entitys); return new PagedResultDto(totalCount, dtos); } - + /// + /// 退回 + /// + /// + /// [HttpPost] public virtual async Task RejectAsync(TRequestMainInput input) { @@ -120,11 +143,7 @@ namespace Win.Sfs.SettleAccount.Bases } - - - - - + diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index 0845be4e..f875d691 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -14,13 +14,15 @@ using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { /// - /// + /// BBAC业务商务审核 /// [AllowAnonymous] [Route("api/settleaccount/bbac_ba_service")] public class BBAC_BA_SERVICE : BA_SERVICE { - public BBAC_BA_SERVICE(INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService) : base(repository, wRepository, sRepository, mRepository, excelImportService) + public BBAC_BA_SERVICE(INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, + INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService) + : base(repository, wRepository, sRepository, mRepository, excelImportService) { } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index 26f082fe..a4a839fa 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -19,7 +19,9 @@ using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { - + /// + /// BBAC-JIS可结算单 + /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] public class BBAC_CAN_SA_SERVICE : CAN_SA_SERVICE diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs index f01a105e..d2fdfdf4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using System; @@ -8,13 +9,19 @@ using System.Text; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; +using Volo.Abp.Domain.Repositories; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { + + /// + /// BBAC-JIS不可结算单 + /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] public class BBAC_NOT_SA_SERVICE : NOT_SA_SERVICE @@ -23,8 +30,52 @@ namespace Win.Sfs.SettleAccount.Entities.BQ BBAC_NOT_SA_DETAIL_REQ_DTO, BBAC_NOT_SA_DETAIL_EXP_DTO> { - public BBAC_NOT_SA_SERVICE(IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(excelImportService, detailRepository) + public BBAC_NOT_SA_SERVICE( + IExcelImportAppService excelImportService, + INormalEfCoreRepository detailRepository) : base(excelImportService, detailRepository) + { + } + [HttpPost] + public override async Task GenerateSettlementOrder(BBAC_NOT_SA_DETAIL_REQ_DTO input) { + var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); + + var billNum=OrderNumberGenerator.GenerateOrderNumber("C"); + var bbac = new BBAC_CAN_SA(guid: GuidGenerator.Create(), + version: input.Version, + billNum: billNum, + settleBillNum: string.Empty, + state: SettleBillState.未结状态, + invGroupNum: billNum + ); + + List ls = new List(); + foreach (var entity in entitys) { + + new BBAC_CAN_SA_DETAIL(guid:entity.Id + , keyCode: entity.KeyCode + , version: entity.Version + , billNum: billNum + , settleBillNum: entity.SettleBillNum + , lU: entity.LU + , pN: entity.PN + , site: entity.Site + , qty: entity.Qty + , price: entity.Price + , category: entity.Category + , isReturn: entity.IsReturn + , settleDate: entity.SettleDate + , groupNum: entity.GroupNum + , invGroupNum: entity.InvGroupNum + + ); + } + await _detailRepository.DbContext.BulkInsertAsync(ls); + await _detailRepository.DbContext.BulkDeleteAsync(entitys); + await _detailRepository.DbContext.BulkInsertAsync(new List() { bbac}); + return ApplicationConsts.SuccessStr; } + + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs index 85c8058b..3e794532 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs @@ -14,6 +14,9 @@ using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { + /// + /// BBAC寄售库库存扣减审批 + /// [AllowAnonymous] [Route("api/settleaccount/bbac_pd_service")] public class BBAC_PD_SERVICE : PD_SERVICE + /// HBPO-JIS可结算单 + /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] public class HBPO_CAN_SA_SERVICE : CAN_SA_SERVICE diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs index f00a159e..79901c79 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; @@ -11,11 +12,15 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { + /// + /// HBPO-JIS不可结算单 + /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] public class HBPO_NOT_SA_SERVICE : NOT_SA_SERVICE @@ -26,6 +31,47 @@ namespace Win.Sfs.SettleAccount.Entities.BQ { public HBPO_NOT_SA_SERVICE(IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(excelImportService, detailRepository) { + } + public override async Task GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input) + { + var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); + + var billNum = OrderNumberGenerator.GenerateOrderNumber("C"); + var hbpo= new HBPO_CAN_SA(guid: GuidGenerator.Create(), + version: input.Version, + billNum: billNum, + settleBillNum: string.Empty, + state: SettleBillState.未结状态, + invGroupNum: billNum + ); + + List ls = new List(); + foreach (var entity in entitys) + { + + new HBPO_CAN_SA_DETAIL(guid: entity.Id + , keyCode: entity.KeyCode + , version: entity.Version + , billNum: billNum + , settleBillNum: entity.SettleBillNum + , lU: entity.LU + , pN: entity.PN + , site: entity.Site + , qty: entity.Qty + , price: entity.Price + + , settleDate: entity.SettleDate + , groupNum: entity.GroupNum + , invGroupNum: entity.InvGroupNum + + ); + } + await _detailRepository.DbContext.BulkInsertAsync(ls); + await _detailRepository.DbContext.BulkDeleteAsync(entitys); + await _detailRepository.DbContext.BulkInsertAsync(new List() { hbpo}); + return ApplicationConsts.SuccessStr; + + } } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs index d64b7c6a..8fd4eca0 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs @@ -16,6 +16,10 @@ using Win.Sfs.Shared.RepositoryBase; namespace Win.Sfs.SettleAccount.Entities.BQ { + + /// + /// 通用业务可结算单 + /// [AllowAnonymous] [Route("api/settleaccount/[controller]/[action]")] public class PUB_CAN_SA_SERVICE : CAN_SA_SERVICE diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs index b32f22fd..5b486b6f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Authorization; +using EFCore.BulkExtensions; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; @@ -11,6 +12,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.SettleAccount.Bases; +using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.Shared.RepositoryBase; @@ -27,5 +29,50 @@ namespace Win.Sfs.SettleAccount.Entities.BQ public PUB_NOT_SA_SERVICE(IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(excelImportService, detailRepository) { } + public override async Task GenerateSettlementOrder(PUB_NOT_SA_DETAIL_REQ_DTO input) + { + var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount); + + var billNum = OrderNumberGenerator.GenerateOrderNumber("C"); + var hbpo = new PUB_CAN_SA(guid: GuidGenerator.Create(), + version: input.Version, + billNum: billNum, + settleBillNum: string.Empty, + state: SettleBillState.未结状态, + invGroupNum: billNum, + businessType:entitys.FirstOrDefault().BusinessType + ); + + List ls = new List(); + foreach (var entity in entitys) + { + + new PUB_CAN_SA_DETAIL( + guid: entity.Id + , keyCode: entity.KeyCode + , version: entity.Version + , billNum: billNum + , settleBillNum: entity.SettleBillNum + , lU: entity.LU + , pN: entity.PN + , site: entity.Site + , qty: entity.Qty + , price: entity.Price + ,businessType:entity.BusinessType + + , settleDate: entity.SettleDate + , groupNum: entity.GroupNum + , invGroupNum: entity.InvGroupNum + + ); + } + await _detailRepository.DbContext.BulkInsertAsync(ls); + await _detailRepository.DbContext.BulkDeleteAsync(entitys); + await _detailRepository.DbContext.BulkInsertAsync(new List() { hbpo }); + return ApplicationConsts.SuccessStr; + + } + + } } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs index 37c2c1c5..f1875c55 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -299,8 +299,6 @@ namespace SettleAccount.Bases public bool IsPriceList { set; get; } - - public BASE_CONF(bool isRelationShip, bool isMaterial, bool isBom) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs index 891e8607..7d3c514d 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs @@ -1,5 +1,6 @@ using EFCore.BulkExtensions; using Hangfire.Annotations; +using Microsoft.EntityFrameworkCore; using SettleAccount.Bases; using System; using System.Collections.Generic; @@ -114,10 +115,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers return await SetNewState(p_entiy.BillNum); } - public virtual async Task SetNewState(string billNUm) + public virtual async Task SetNewState(string billNum) { - var ls = _repository.Where(p => p.InvGroupNum == billNUm).ToList(); + var ls = _repository.Where(p => p.InvGroupNum == billNum).ToList(); foreach (var l in ls) { l.State = SettleBillState.未结状态; @@ -126,6 +127,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers await _repository.DbContext.BulkReadAsync(ls); return true; } + + public virtual async Task> GetAllList(string billNum) + { + return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync(); + } + + + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs index e6f27e44..c4543567 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs @@ -31,8 +31,9 @@ public class PUB_CAN_SA : SA_CAN_BASE_MAIN //[Display(Name = "明细记录行数")] //public string InvGroupNum { get; set; } = null!; - public PUB_CAN_SA(int version, string settleBillNum, string billNum, SettleBillState state, EnumBusinessType businessType, string invGroupNum) + public PUB_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, SettleBillState state, EnumBusinessType businessType, string invGroupNum) { + Id = guid; Version = version; SettleBillNum = settleBillNum; BillNum = billNum; @@ -117,8 +118,9 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE //[Display(Name = "结算分组")] //public string GroupNum { get; set; } = null!; - public PUB_CAN_SA_DETAIL(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) { + Id = guid; KeyCode = keyCode; Version = version; BillNum = billNum;