From 0fde0ce4a298804c1cfb01f69f51b8c6439650d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Fri, 14 Jul 2023 15:03:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0DTO,=E7=94=9F=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E5=8D=95=E6=8D=AE=E5=9F=BA=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/BQ/Dtos/INVOICE_GRP_DTO.cs | 6 +- .../Bases/BA_SERVICE.cs | 2 +- .../Bases/CAN_SA_SERVICE.cs | 4 + .../Entities/BQ/INVOICE_SERVICE.cs | 2 +- .../SettleAccounts/SettleAccountAppService.cs | 4 +- ...ttleAccountApplicationAutoMapperProfile.cs | 155 +++++++++++++++++- .../SettleAccount.Domain/Bases/EntityBase.cs | 37 ++++- .../Bases/OrderNumberGenerator.cs | 0 .../Entities/BQ/BBAC_CAN_SA.cs | 34 ++-- .../Entities/BQ/HBPO_CAN_SA.cs | 34 ++-- .../Entities/BQ/PUB_CAN_SA.cs | 34 ++-- .../Entities/Managers/CAN_SA_MNG.cs | 97 +++++++++++ .../Entities/Managers/NOT_SA_MNG.cs | 42 +++++ 13 files changed, 393 insertions(+), 58 deletions(-) rename code/src/Modules/SettleAccount/src/{SettleAccount.Application => SettleAccount.Domain}/Bases/OrderNumberGenerator.cs (100%) create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/CAN_SA_MNG.cs create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs index e268913c..d4ee4f4b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs @@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos - public class INVOICE_GRP_EXPORT_DTO + public class INVOICE_GRP_EXP_DTO { @@ -133,7 +133,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos public decimal TaxAmt { get; set; } [Display(Name = "发票分组号")] public string InvGroupNum { get; set; } - + [Display(Name = "发票号")] + public string InvbillNum { get; set; } + } 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 bef825a5..4b420034 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 @@ -89,7 +89,7 @@ namespace Win.Sfs.SettleAccount.Bases IExporter _excel = new ExcelExporter(); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); - var dtoDetails = ObjectMapper.Map, List>(entities); + var dtoDetails = ObjectMapper.Map, List>(entities); var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute()?.Name ?? typeof(INVOICE_GRP_DTO).Name; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; 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 925adfe5..e7ed0eca 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 @@ -115,6 +115,10 @@ namespace Win.Sfs.SettleAccount.Bases return new PagedResultDto(totalCount, dtos); } + + + + diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs index 0b14e526..c3e12303 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs @@ -88,7 +88,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ IExporter _excel = new ExcelExporter(); var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true); - var dtoDetails = ObjectMapper.Map, List>(entities); + var dtoDetails = ObjectMapper.Map, List>(entities); var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute()?.Name ?? typeof(INVOICE_GRP_DTO).Name; string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx"; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs index ef9458f1..0f056a6f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/SettleAccounts/SettleAccountAppService.cs @@ -63,6 +63,8 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts private readonly ISettleAccountBranchEfCoreRepository _preBatchRepository; + + private readonly ISettleAccountBranchEfCoreRepository _repository; private readonly ISettleAccountBranchEfCoreRepository _versionRepository; private readonly ISettleAccountBranchEfCoreRepository _fisRepository; @@ -575,4 +577,4 @@ namespace Win.Sfs.SettleAccount.Entities.SettleAccounts } -} \ No newline at end of file +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs index d80ca761..7cb17e0f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs @@ -145,10 +145,163 @@ namespace Win.Sfs.SettleAccount CreateMapPUB_SE_DETAIL(); CreateMapPUB_SA(); + + CreateMapBBAC_CAN_SA(); + + + CreateMapBBAC_CAN_SA_DETAIL(); + + + CreateMapBBAC_NOT_SA_DETAIL(); + + + CreateMapHBPO_CAN_SA(); + + + CreateMapHBPO_CAN_SA_DETAIL(); + + + CreateMapHBPO_NOT_SA_DETAIL(); + + + CreateMapINVOICE_GRP(); + + + CreateMapINVOICE_MAP_GROUP(); + + + CreateMapINVOICE_NOT_SETTLE(); + + + CreateMapINVOICE_WAIT_DETAIL(); + + + CreateMapPUB_CAN_SA(); + + + CreateMapPUB_CAN_SA_DETAIL(); + + + CreateMapPUB_NOT_SA_DETAIL(); + + + + + + + + + } #region BQ - + + + /// + /// BBAC可结算 + /// + + private void CreateMapBBAC_CAN_SA() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + } + private void CreateMapBBAC_CAN_SA_DETAIL() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + private void CreateMapBBAC_NOT_SA_DETAIL() + + { + + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + private void CreateMapHBPO_CAN_SA() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + } + private void CreateMapHBPO_CAN_SA_DETAIL() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + private void CreateMapHBPO_NOT_SA_DETAIL() + + { + + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + private void CreateMapINVOICE_GRP() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + } + private void CreateMapINVOICE_MAP_GROUP() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + } + private void CreateMapINVOICE_NOT_SETTLE() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + } + private void CreateMapINVOICE_WAIT_DETAIL() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + } + private void CreateMapPUB_CAN_SA() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + } + private void CreateMapPUB_CAN_SA_DETAIL() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + private void CreateMapPUB_NOT_SA_DETAIL() + + { + CreateMap().ReverseMap(); + CreateMap().ReverseMap(); + + CreateMap().ReverseMap(); + } + + + + 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 f4eaf225..8c0eeb03 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs @@ -1,10 +1,13 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Security.Policy; using System.Text; using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities.Auditing; +using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount.Entities.SettleAccountDomain; using static System.Runtime.CompilerServices.RuntimeHelpers; @@ -33,7 +36,36 @@ namespace SettleAccount.Bases public decimal Qty { set; get; } } - public interface ISA_BASE : ISBASE + + + public class SA_CAN_BASE_MAIN : FullAuditedAggregateRoot + { + + [Display(Name = "期间")] + public int Version { get; set; } + + [Display(Name = "结算单据")] + public string BillNum { get; set; } = null!; + [Display(Name = "关联结算单号")] + public string SettleBillNum { get; set; } = null!; + + /// + /// 1、新建 2、已有出库3、已有扣减寄售库 + /// + [Display(Name = "状态")] + public SettleBillState State { get; set; } + + /// + /// 明细记录行数 + /// + [Display(Name = "发票分组号")] + public string InvGroupNum { get; set; } = null!; + + } + + + + public interface ISA_BASE : ISBASE { /// /// 期间 @@ -238,6 +270,9 @@ namespace SettleAccount.Bases } } + + + public class SA_BASE : FullAuditedAggregateRoot, ISA_BASE { /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/OrderNumberGenerator.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/OrderNumberGenerator.cs similarity index 100% rename from code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/OrderNumberGenerator.cs rename to code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/OrderNumberGenerator.cs diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs index 5c893311..0f19e727 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs @@ -6,28 +6,28 @@ using Win.Sfs.SettleAccount; namespace SettleAccount.Domain.BQ; [Display(Name = "BBAC可结算导入")] -public class BBAC_CAN_SA:FullAuditedAggregateRoot +public class BBAC_CAN_SA : SA_CAN_BASE_MAIN { - [Display(Name = "期间")] - public int Version { get; set; } + //[Display(Name = "期间")] + //public int Version { get; set; } - [Display(Name = "结算单据")] - public string BillNum { get; set; } = null!; - [Display(Name = "关联结算单号")] - public string SettleBillNum { get; set; } = null!; + //[Display(Name = "结算单据")] + //public string BillNum { get; set; } = null!; + //[Display(Name = "关联结算单号")] + //public string SettleBillNum { get; set; } = null!; - /// - /// 1、新建 2、已有出库3、已有扣减寄售库 - /// - [Display(Name = "状态")] - public SettleBillState State { get; set; } + ///// + ///// 1、新建 2、已有出库3、已有扣减寄售库 + ///// + //[Display(Name = "状态")] + //public SettleBillState State { get; set; } - /// - /// 明细记录行数 - /// - [Display(Name = "明细记录行数")] - public string InvGroupNum { get; set; } = null!; + ///// + ///// 明细记录行数 + ///// + //[Display(Name = "发票分组号")] + //public string InvGroupNum { get; set; } = null!; public BBAC_CAN_SA() { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs index 9d8c5647..12c402be 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs @@ -6,27 +6,27 @@ using Win.Sfs.SettleAccount; namespace SettleAccount.Domain.BQ; [Display(Name = "HBPO可结算导入")] -public class HBPO_CAN_SA :FullAuditedAggregateRoot +public class HBPO_CAN_SA : SA_CAN_BASE_MAIN { - [Display(Name = "期间")] - public int Version { get; set; } - [Display(Name = "关联结算单号")] - public string SettleBillNum { get; set; } = null!; - [Display(Name = "结算单据")] + //[Display(Name = "期间")] + //public int Version { get; set; } + //[Display(Name = "关联结算单号")] + //public string SettleBillNum { get; set; } = null!; + //[Display(Name = "结算单据")] - public string BillNum { get; set; } = null!; + //public string BillNum { get; set; } = null!; - /// - /// 1、新建 2、已有出库3、已有扣减寄售库 - /// - [Display(Name = "状态")] - public SettleBillState State { get; set; } + ///// + ///// 1、新建 2、已有出库3、已有扣减寄售库 + ///// + //[Display(Name = "状态")] + //public SettleBillState State { get; set; } - /// - /// 明细记录行数 - /// - [Display(Name = "明细记录行数")] - public string InvGroupNum { get; set; } = null!; + ///// + ///// 明细记录行数 + ///// + //[Display(Name = "明细记录行数")] + //public string InvGroupNum { get; set; } = null!; public HBPO_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, SettleBillState state, string invGroupNum) { 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 e2f474cb..f1ada17f 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 @@ -6,30 +6,30 @@ using Win.Sfs.SettleAccount; namespace SettleAccount.Domain.BQ; [Display(Name = "PUB可结算导入")] -public class PUB_CAN_SA :FullAuditedAggregateRoot +public class PUB_CAN_SA : SA_CAN_BASE_MAIN { - [Display(Name = "期间")] - public int Version { get; set; } + //[Display(Name = "期间")] + //public int Version { get; set; } - [Display(Name = "关联结算单号")] - public string SettleBillNum { get; set; } = null!; + //[Display(Name = "关联结算单号")] + //public string SettleBillNum { get; set; } = null!; - [Display(Name = "结算单据")] - public string BillNum { get; set; } = null!; + //[Display(Name = "结算单据")] + //public string BillNum { get; set; } = null!; - /// - /// 1、新建 2、已有出库3、已有扣减寄售库 - /// - [Display(Name = "状态")] - public SettleBillState State { get; set; } - /// - /// 1、JIT 2、买单件 3、备件 3、印度件 - /// + ///// + ///// 1、新建 2、已有出库3、已有扣减寄售库 + ///// + //[Display(Name = "状态")] + //public SettleBillState State { get; set; } + ///// + ///// 1、JIT 2、买单件 3、备件 3、印度件 + ///// [Display(Name = "业务分类")] public string BusinessType { get; set; } = null!; - [Display(Name = "明细记录行数")] - public string InvGroupNum { get; set; } = null!; + //[Display(Name = "明细记录行数")] + //public string InvGroupNum { get; set; } = null!; public PUB_CAN_SA(int version, string settleBillNum, string billNum, SettleBillState state, string businessType, string invGroupNum) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/CAN_SA_MNG.cs new file mode 100644 index 00000000..c2dd1f15 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/CAN_SA_MNG.cs @@ -0,0 +1,97 @@ +using Hangfire.Annotations; +using SettleAccount.Bases; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Domain.Entities; +using Volo.Abp.Domain.Services; +using Volo.Abp.Guids; +using Volo.Abp.ObjectMapping; +using Win.Sfs.SettleAccount.Bases.DomainServices; +using Win.Sfs.SettleAccount.Boms; +using Win.Sfs.SettleAccount.Entities.Materials; +using Win.Sfs.SettleAccount.MaterialRelationships; +using Win.Sfs.Shared.RepositoryBase; + +namespace Win.Sfs.SettleAccount.Entities.Managers +{ + public class CAN_SA_MNG : DomainService + where TEntity : SA_CAN_BASE_MAIN + where TEntityDetail : SA_CAN_BASE + { + private readonly INormalEfCoreRepository _repository; + private readonly INormalEfCoreRepository _detailRepository; + public CAN_SA_MNG + ( + INormalEfCoreRepository repository, + INormalEfCoreRepository detailRepository + ) + { + _repository= repository; + _detailRepository= detailRepository; + } + public virtual async Task SetState(TEntity p_entiy,SettleBillState state) + { + switch (p_entiy.State) + { + case SettleBillState.财务已审核: + if (state == SettleBillState.商务已审核) + { + p_entiy.State = state; + } + else + { + throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); + } + break; + case SettleBillState.商务已审核: + if (state == SettleBillState.已开票) + { + p_entiy.State = state; + } + else + { + throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】"); + } + break; + case SettleBillState.已开票: + if (state == SettleBillState.未结状态) + { + p_entiy.State = state; + } + else + { + throw new BusinessException("8989", "当前状态不是【未结状态】状态,无法设置成【已开票】"); + } + break; + case SettleBillState.已扣减: + if (state == SettleBillState.财务已审核) + { + p_entiy.State = state; + } + else + { + throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态"); + } + break; + } + await _repository.UpdateAsync(p_entiy); + return true; + } + + + } + + + + + + + + + + +} diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs new file mode 100644 index 00000000..5b37ce06 --- /dev/null +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs @@ -0,0 +1,42 @@ +using SettleAccount.Bases; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Domain.Services; +using Volo.Abp; +using Win.Sfs.Shared.RepositoryBase; + +namespace Win.Sfs.SettleAccount.Entities.Managers +{ + /// + /// 不能結算管理 + /// + /// + /// + /// + public class NOT_SA_MNG : DomainService + where TEntity : SA_CAN_BASE_MAIN + where TEntityDetail : SA_CAN_BASE + where TNOTDetail:SA_NOT_BASE + { + private readonly INormalEfCoreRepository _repository; + private readonly INormalEfCoreRepository _detailRepository; + public NOT_SA_MNG + ( + INormalEfCoreRepository repository, + INormalEfCoreRepository detailRepository + ) + { + _repository = repository; + _detailRepository = detailRepository; + } + public virtual async Task GenerateSettlementOrder(List p_list) + { + return true; + } + + + } +}