Browse Source

更新状态管理基类

master
学 赵 1 year ago
parent
commit
9d0beb91e8
  1. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  4. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  5. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  6. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/OrderNumberGenerator.cs
  7. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  8. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  9. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  10. 146
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/INV_MNG.cs
  11. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs
  12. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

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

@ -135,6 +135,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string InvGroupNum { get; set; }
[Display(Name = "发票号")]
public string InvbillNum { get; set; }
[Display(Name = "发票分组状态")]
public int State { set; get; }
}

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

@ -24,8 +24,6 @@ namespace Win.Sfs.SettleAccount.Bases
{
public abstract class BA_SERVICE:ApplicationService
{
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
@ -69,7 +67,7 @@ namespace Win.Sfs.SettleAccount.Bases
{
INVOICE_GRP_DETAIL_DTO _entity=new INVOICE_GRP_DETAIL_DTO();
var m= await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var m= await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
var w=await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);

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

@ -36,8 +36,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
protected BBAC_CAN_SA_SERVICE(INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository, IExcelImportAppService excelImportService, INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository) : base(repository, excelImportService, detailRepository)
{
}
[HttpPost]
//[Route("generateinvoice")]
public async override Task<string> GenerateInvoice(BBAC_CAN_SA_REQ_DTO input)
@ -57,12 +55,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
string invoiceBillNum = Guid.NewGuid().ToString();
List<string> invoiceGroupNumList = new List<string>();
List<string> List = new List<string>();
decimal sum = _itm.Value;//初始价格
List<string> luList= _ls.Where(p => p.GroupNum == _itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
foreach (var _itm1 in _dic1)
{
if (_itm.Key == _itm1.Key)
@ -70,10 +64,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
continue;
}
var grouplist=_ls.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
luList.AddRange(grouplist);
luList = luList.Distinct().ToList();
if (luList.Count > 20)//累加零件不超过20种
{
continue;

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using System;

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

@ -50,7 +50,7 @@ namespace SettleAccount.Bases
public string SettleBillNum { get; set; } = null!;
/// <summary>
/// 1、新建 2、已有出库3、已有扣减寄售库
/// 可结算单状态
/// </summary>
[Display(Name = "状态")]
public SettleBillState State { get; set; }
@ -368,6 +368,10 @@ namespace SettleAccount.Bases
/// 結算分組號
/// </summary>
public string GroupNum { get; set; }
/// <summary>
/// 关联结算单号
/// </summary>
public string SettleBillNum { get; set; }
//public SA_CAN_BASE(int version, decimal price, string billNum, DateTime settleDate, string invGroupNum, string lU, string pN, string keyCode, decimal qty, string groupNum)
//{
@ -425,7 +429,6 @@ namespace SettleAccount.Bases
/// 結算分組號
/// </summary>
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)
//{
// Price = price;
@ -474,13 +477,6 @@ namespace SettleAccount.Bases
/// </summary>
public decimal Qty { get; set; }
}
public class PD_BASE : FullAuditedAggregateRoot<Guid>, ISBASE
{

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/OrderNumberGenerator.cs

@ -19,7 +19,7 @@ namespace Win.Sfs.SettleAccount.Bases
private static int sequence = 0;
/// <summary>
/// 如无类别
/// 生成单号
/// </summary>
/// <param name="p_OrderType"></param>
/// <returns></returns>

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

@ -66,8 +66,8 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
///// </summary>
//[Display(Name = "结算单号")]
//public string BillNum { get; set; } = null!;
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
///// <summary>
///// 对应字段Material
///// </summary>

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

@ -68,8 +68,8 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE
///// </summary>
//[Display(Name = "结算单号")]
//public string BillNum { get; set; } = null!;
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
/// <summary>
/// 对应字段PartNumber
/// </summary>

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

@ -63,8 +63,8 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE
//[Display(Name = "结算单号")]
//public string BillNum { get; set; } = null!;
[Display(Name = "关联结算单号")]
public string SettleBillNum { get; set; } = null!;
//[Display(Name = "关联结算单号")]
//public string SettleBillNum { get; set; } = null!;
/// <summary>
/// 对应字段PartNumber

146
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/INV_MNG.cs

@ -0,0 +1,146 @@
using EFCore.BulkExtensions;
using NPOI.SS.Formula.Functions;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.Managers
{
public class INV_MNG:DomainService
{
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<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository
)
{
_repository = repository;
_detailRepository = detailRepository;
_groupRepository = groupRepository;
_notRepository = notRepository;
}
public virtual async Task<bool> SetForwardState(INVOICE_GRP p_entiy,InvoiceBillState p_State)
{
var state = p_State;
switch (p_entiy.State)
{
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;
case InvoiceBillState.:
if (state == InvoiceBillState.)
{
p_entiy.State = state;
}
else
{
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
}
break;
}
await _repository.UpdateAsync(p_entiy);
return true;
}
public virtual async Task<bool> Reject(INVOICE_GRP p_entity)
{
if (p_entity.State == InvoiceBillState.
|| p_entity.State == InvoiceBillState. || p_entity.State == InvoiceBillState.)
{
var entList = _repository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
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();
await _repository.DbContext.BulkDeleteAsync(entList);
await _repository.DbContext.BulkDeleteAsync(groupList);
await _repository.DbContext.BulkDeleteAsync(notList);
await _repository.DbContext.BulkDeleteAsync(detailList);
}
return true;
//switch (p_entiy.State)
//{
// case InvoiceBillState.财务已审核 || InvoiceBillState.已开票:
// _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;
//}
}
}
}

50
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/Managers/NOT_SA_MNG.cs

@ -7,6 +7,8 @@ using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
using Volo.Abp;
using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.SettleAccount.Bases;
using EFCore.BulkExtensions;
namespace Win.Sfs.SettleAccount.Entities.Managers
{
@ -17,23 +19,63 @@ namespace Win.Sfs.SettleAccount.Entities.Managers
/// <typeparam name="TEntityDetail"></typeparam>
/// <typeparam name="TNOTDetail"></typeparam>
public class NOT_SA_MNG<TEntity,TEntityDetail, TNOTDetail> : DomainService
where TEntity : SA_CAN_BASE_MAIN
where TEntityDetail : SA_CAN_BASE
where TEntity : SA_CAN_BASE_MAIN,new()
where TEntityDetail : SA_CAN_BASE,new()
where TNOTDetail:SA_NOT_BASE
{
private readonly INormalEfCoreRepository<TEntity, Guid> _repository;
private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly INormalEfCoreRepository<TNOTDetail, Guid> _notRepository;
public NOT_SA_MNG
(
INormalEfCoreRepository<TEntity, Guid> repository,
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository,
INormalEfCoreRepository<TNOTDetail, Guid> notRepository
)
{
_repository = repository;
_detailRepository = detailRepository;
_notRepository = notRepository;
}
public virtual async Task<bool> GenerateSettlementOrder(List<TNOTDetail> p_list)
public virtual async Task<bool> GenerateSettlementOrder(List<TNOTDetail> p_list,Action<List<TEntityDetail>> p_action=null)
{
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
TEntity _entity = new TEntity();
_entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber;
_entity.Version=DateTime.Now.Year+DateTime.Now.Month;
_entity.State =SettleBillState.;
_entity.SettleBillNum = string.Empty;
List<TEntityDetail> _entityList = new List<TEntityDetail>();
foreach (var itm in p_list)
{
TEntityDetail _detailEntity = new TEntityDetail();
{
_detailEntity.SettleBillNum = itm.SettleBillNum;
_detailEntity.BillNum = billNumber;
_detailEntity.InvGroupNum = billNumber;
_detailEntity.LU = itm.LU;
_detailEntity.PN = itm.PN;
_detailEntity.GroupNum = itm.GroupNum;
_detailEntity.KeyCode = itm.KeyCode;
_detailEntity.Price = itm.Price;
_detailEntity.Version = itm.Version;
};
_entityList.Add(_detailEntity);
}
if (_entityList.Count > 0)
{
p_action(_entityList);//对不一样类型结算数据进行处理
}
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<TEntity>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
return true;
}

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

@ -33,8 +33,8 @@ namespace Win.Sfs.SettleAccount
public enum InvoiceBillState
{
[Description("未结状态")]
= 0,
[Description("已开票")]
= 1,
[Description("商务已审核")]
= 2,
[Description("财务已审核")]

Loading…
Cancel
Save