Browse Source

更新DomainService

master
学 赵 1 year ago
parent
commit
c10996efca
  1. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 43
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  3. 68
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  4. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_PD.cs
  5. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_PD_DETAIL.cs
  6. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_PD.cs
  7. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
  8. 52
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs
  9. 84
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/NOT_SA_MNG.cs
  11. 46
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_PD.cs
  12. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs
  13. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs

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

@ -129,7 +129,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "实际纸质发票号")]
public string RealnvBillNum { get; set; }
[Display(Name = "系统生成发票号")]
[Display(Name = "未税金额")]
public decimal Amt { get; set; }
[Display(Name = "税后金额")]
public decimal TaxAmt { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
@ -137,6 +140,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string InvbillNum { get; set; }
[Display(Name = "发票分组状态")]
public int State { set; get; }
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
}

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

@ -16,6 +16,7 @@ using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -28,6 +29,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository;
private readonly CAN_SA_MNG<PUB_CAN_SA,PUB_CAN_SA_DETAIL> _pubMng;
private readonly CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> _bbacMng;
private readonly CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> _hbpoMng;
private readonly INV_MNG _invMng;
//private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly IExcelImportAppService _excelImportService;
@ -36,9 +41,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
IExcelImportAppService excelImportService
//INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
IExcelImportAppService excelImportService,
CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng,
CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng,
CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng,
INV_MNG invMng
)
{
_excelImportService = excelImportService;
@ -46,6 +53,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_wRepository = wRepository;
_mRepository = mRepository;
_sRepository = sRepository;
_pubMng = pubMng;
_bbacMng = bbacMng;
_hbpoMng = hbpoMng;
_invMng = invMng;
}
[HttpPost]
public virtual async Task<string> ApprovalPassed(INVOICE_GRP_REQ_DTO input)
@ -118,8 +132,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[HttpPost]
public virtual async Task<string> RejectAsync(INVOICE_GRP_REQ_DTO input)
{
bool state = await _invMng.Reject(input.InvGroupNum);
if (state==true)
{
switch (input.BusinessType)
{
case EnumBusinessType.BeiJian:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.ZhiGongJian:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.YingDuJian:
await _pubMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.BBAC:
await _bbacMng.SetNewState(input.InvGroupNum);
break;
case EnumBusinessType.HBPO:
await _hbpoMng.SetNewState(input.InvGroupNum);
break;
}
}
return string.Empty;
}
[HttpPost]
public virtual async Task<string> Sync_QAD(INVOICE_GRP_REQ_DTO input)

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

@ -42,28 +42,68 @@ namespace SettleAccount.Bases
{
[Display(Name = "期间")]
public int Version { get; set; }
public virtual int Version { get; set; }
[Display(Name = "结算单据")]
public string BillNum { get; set; } = null!;
public virtual string BillNum { get; set; } = null!;
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; } = null!;
public virtual string SettleBillNum { get; set; } = null!;
/// <summary>
/// 可结算单状态
/// </summary>
[Display(Name = "状态")]
public SettleBillState State { get; set; }
public virtual SettleBillState State { get; set; }
/// <summary>
/// 明细记录行数
/// </summary>
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; } = null!;
public virtual string InvGroupNum { get; set; } = null!;
}
public class PD_BASE_MAIN : FullAuditedAggregateRoot<Guid>
{
[Display(Name = "期间")]
public virtual int Version { get; set; }
[Display(Name = "结算单据")]
public virtual string BillNum { get; set; } = null!;
[Display(Name = "关联结算单号")]
public virtual string SettleBillNum { get; set; } = null!;
/// <summary>
/// 可结算单状态
/// </summary>
[Display(Name = "状态")]
public virtual SettleBillState State { get; set; }
/// <summary>
/// 明细记录行数
/// </summary>
[Display(Name = "发票分组号")]
public virtual string InvGroupNum { get; set; } = null!;
/// <summary>
/// 地点
/// </summary>
[Display(Name = "地点")]
public virtual string Site { get; set; }
}
public interface ISA_BASE : ISBASE
{
@ -527,6 +567,24 @@ namespace SettleAccount.Bases
/// </summary>
public string KeyCode { get; set; }
/// <summary>
///扩展字段1
/// </summary>
public string Extend1 { get; set; }
/// <summary>
///扩展字段2
/// </summary>
public string Extend2 { get; set; }
/// <summary>
/// 键值字段3
/// </summary>
public string Extend3 { get; set; }
/// <summary>
/// 键值字段4
/// </summary>
public string Extend4 { get; set; }
}

46
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_PD.cs

@ -0,0 +1,46 @@
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "BBAC待扣减")]
public class BBAC_PD : PD_BASE_MAIN
{
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "结算单据")]
//public string BillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
///// <summary>
///// 1、新建 2、已有出库3、已有扣减寄售库
///// </summary>
//[Display(Name = "状态")]
//public SettleBillState State { get; set; }
///// <summary>
///// 明细记录行数
///// </summary>
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
public BBAC_PD()
{
}
public BBAC_PD(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum,string site)
{
Id = guid;
Version = version;
BillNum = billNum;
SettleBillNum = settleBillNum;
State = state;
InvGroupNum = invGroupNum;
Site = site;
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_PD_DETAIL.cs

@ -46,7 +46,12 @@ public class BBAC_PD_DETAIL:PD_BASE
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
public BBAC_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string groupNum)
public BBAC_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string groupNum
,string extend1,string extend2,string extend3,string extend4
)
{
Id = guid;
KeyCode = keyCode;
@ -62,6 +67,10 @@ public class BBAC_PD_DETAIL:PD_BASE
InvGroupNum = invGroupNum;
SettleDate = settleDate;
GroupNum = groupNum;
Extend1 = extend1;
Extend2 = extend2;
Extend3 = extend3;
Extend4 = extend4;
}
public BBAC_PD_DETAIL()

46
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_PD.cs

@ -0,0 +1,46 @@
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "HBPO待扣减")]
public class HBPO_PD : PD_BASE_MAIN
{
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "结算单据")]
//public string BillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
///// <summary>
///// 1、新建 2、已有出库3、已有扣减寄售库
///// </summary>
//[Display(Name = "状态")]
//public SettleBillState State { get; set; }
///// <summary>
///// 明细记录行数
///// </summary>
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
public HBPO_PD()
{
}
public HBPO_PD(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum,string site)
{
Id = guid;
Version = version;
BillNum = billNum;
SettleBillNum = settleBillNum;
State = state;
InvGroupNum = invGroupNum;
Site = site;
}
}

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

@ -32,7 +32,7 @@ public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "业务类别")]
[Display(Name = "状态")]
public InvoiceBillState State { get; set; }
public INVOICE_GRP(Guid guid, string realnvBillNum, string invbillNum, decimal amt, decimal taxAmt, string invGroupNum, string fileName, EnumBusinessType businessType, InvoiceBillState state)

52
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs

@ -1,4 +1,5 @@
using Hangfire.Annotations;
using EFCore.BulkExtensions;
using Hangfire.Annotations;
using SettleAccount.Bases;
using System;
using System.Collections.Generic;
@ -33,8 +34,27 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_repository = repository;
_detailRepository = detailRepository;
}
public virtual async Task<bool> SetState(TEntity p_entiy, SettleBillState state)
public virtual async Task<bool> SetForwardState(TEntity p_entiy, SettleBillState state)
{
if (await SetForwardState(p_entiy.InvGroupNum, state) == true)
{
return true;
}
else
{
return false;
}
}
public virtual async Task<bool> SetForwardState(string p_billNum, SettleBillState state)
{
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList();
foreach(TEntity p_entiy in ls)
{
switch (p_entiy.State)
{
case SettleBillState.:
@ -79,12 +99,39 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
break;
}
await _repository.UpdateAsync(p_entiy);
}
return true;
}
public virtual async Task<bool> SetNewState(TEntity p_entiy)
{
p_entiy.State = SettleBillState.;
await _repository.UpdateAsync(p_entiy);
return true;
}
public virtual async Task<bool> SetNewState(string billNUm)
{
var ls=_repository.Where(p => p.InvGroupNum == billNUm).ToList();
foreach (var l in ls)
{
l.State = SettleBillState.;
}
await _repository.DbContext.BulkReadAsync(ls);
return true;
}
}
}
@ -94,4 +141,3 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}

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

@ -1,5 +1,7 @@
using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore;
using NPOI.SS.Formula.Functions;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
@ -14,15 +16,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
public class INV_MNG:DomainService
{
//private readonly INormalEfCoreRepository<TCAN_SA, Guid> _canRepository;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
public INV_MNG
(
//INormalEfCoreRepository<TCAN_SA, Guid> canRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
@ -30,6 +31,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
)
{
//_canRepository = canRepository;
_repository = repository;
_detailRepository = detailRepository;
_groupRepository = groupRepository;
@ -75,10 +77,34 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return true;
}
public virtual async Task<INVOICE_GRP> GetEntityByBillNum(string p_billNum)
{
return await _repository.Where(p => p.InvGroupNum == p_billNum).FirstOrDefaultAsync();
}
public virtual async Task<bool> Reject(INVOICE_GRP p_entity)
{
if (await Reject(p_entity.InvGroupNum))
return true;
else
return false;
}
public virtual async Task<bool> Reject(string billNum)
{
var _ls=await _repository.Where(p => p.InvGroupNum == billNum).ToListAsync();
if (_ls != null && _ls.Count > 0)
{
foreach (var p_entity in _ls)
{
if (p_entity.State == InvoiceBillState.
|| p_entity.State == InvoiceBillState. || p_entity.State == InvoiceBillState.)
{
@ -86,59 +112,39 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var groupList = _groupRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
var notList = _notRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
var detailList = _detailRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
//var canList = _canRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
//foreach (var itm in canList)
//{
// itm.State = SettleBillState.未结状态;
//}
await _repository.DbContext.BulkDeleteAsync(entList);
await _repository.DbContext.BulkDeleteAsync(groupList);
await _repository.DbContext.BulkDeleteAsync(notList);
await _repository.DbContext.BulkDeleteAsync(detailList);
//await _repository.DbContext.BulkUpdateAsync(canList);
}
return true;
if (p_entity.State == InvoiceBillState.)
{
}
}
//switch (p_entiy.State)
//{
// case InvoiceBillState.财务已审核 || InvoiceBillState.已开票:
}
else
{
// _repository.re
}
// //if (state == InvoiceBillState.商务已审核)
// //{
// // p_entiy.State = state;
// //}
// //else
// //{
// // throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
// //}
// break;
// case InvoiceBillState.商务已审核:
// if (state == InvoiceBillState.已开票)
// {
// p_entiy.State = state;
// }
// else
// {
// throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】");
// }
// break;
// case InvoiceBillState.已扣减:
// if (state == InvoiceBillState.财务已审核)
// {
// p_entiy.State = state;
// }
// else
// {
// throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
// }
// break;
//}
}
return true;
}

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

@ -39,6 +39,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
public virtual async Task<bool> GenerateSettlementOrder(List<TNOTDetail> p_list, Action<List<TEntityDetail>> p_action = null)
{
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new TEntity();
_entity.BillNum = billNumber;
@ -69,13 +70,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<TEntity>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
return true;
}

46
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_PD.cs

@ -0,0 +1,46 @@
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "PUB待扣减")]
public class PUB_PD : PD_BASE_MAIN
{
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "结算单据")]
//public string BillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
///// <summary>
///// 1、新建 2、已有出库3、已有扣减寄售库
///// </summary>
//[Display(Name = "状态")]
//public SettleBillState State { get; set; }
///// <summary>
///// 明细记录行数
///// </summary>
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
public PUB_PD()
{
}
public PUB_PD(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum,string site)
{
Id = guid;
Version = version;
BillNum = billNum;
SettleBillNum = settleBillNum;
State = state;
InvGroupNum = invGroupNum;
Site = site;
}
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

@ -44,6 +44,22 @@ namespace Win.Sfs.SettleAccount
}
public enum BusinessType
{
[Description("HBPO-JIS")]
HBPOJIS =1,
[Description("BBAC-JIS")]
BBACJIS =2,
[Description("JIT")]
JIT =3,
[Description("备件")]
=4,
[Description("印度件")]
=5
}

17
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBusinessType.cs

@ -35,6 +35,21 @@ namespace Win.Sfs.SettleAccount
///印度件
/// </summary>
[Display(Name = "印度件")]
YingDuJian = 4
YingDuJian = 4,
/// <summary>
///
/// </summary>
[Display(Name = "HBPO-JIS")]
HBPO = 5,
/// <summary>
///印度件
/// </summary>
[Display(Name = "BBAC-JIS")]
BBAC = 6
}
}

Loading…
Cancel
Save