mahao 1 year ago
parent
commit
7d43b4fc23
  1. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs
  2. 197
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  3. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_CAN_SA_DTO.cs
  4. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IINVOICE_SERVICE.cs
  5. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IPUB_BA_SERVICE.cs
  6. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  7. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  8. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  9. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  11. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs
  12. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
  13. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  14. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs
  15. 11
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  16. 6
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountBQEfCoreRepository.cs

32
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_CAN_SA_DTO.cs

@ -40,17 +40,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class HBPO_CAN_SA_DETAIL_DTO : EntityDto<Guid>
{
/// <summary>
///关联结算单号
/// </summary>
@ -97,27 +86,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
public string GroupNum { get; set; }
}
public class HBPO_CAN_SA_DETAIL_EXP_DTO
{

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

@ -54,6 +54,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
[Display(Name = "业务类别")]
public string BusinessType { get; set; }
/// <summary>
/// 发票状态
/// </summary>
public int State { set; get; }
}
@ -118,17 +122,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class INVOICE_GRP_REQ_DTO : PagedAndSortedResultRequestDto
{
[Display(Name = "实际纸质发票号")]
@ -137,17 +131,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public decimal TaxAmt { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
namespace SettleAccount.Domain.BQ
public class INVOICE_GRP_DETAIL_DTO : EntityDto<Guid>
{
public class INVOICE_WAIT_DETAIL_DTO : EntityDto<Guid>
public List<INVOICE_WAIT_DETAIL_DTO> INVOICE_WAIT_DETAIL { get; set; }
public List<INVOICE_MAP_GROUP_DTO> INVOICE_MAP_GROUP { get; set; }
public List<INVOICE_NOT_SETTLE_DTO> INVOICE_NOT_SETTLE_DTO { get; set; }
}
public class INVOICE_WAIT_DETAIL_DTO : EntityDto<Guid>
{
@ -227,6 +224,172 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class INVOICE_MAP_GROUP_DTO : EntityDto<Guid>
{
/// <summary>
///期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
/// <summary>
///发票号
/// </summary>
[Display(Name = "发票号")]
public string InvbillNum { get; set; }
/// <summary>
///发票分组号
/// </summary>
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
/// <summary>
///结算分组号
/// </summary>
[Display(Name = "结算分组号")]
public string SettleGroupNum { get; set; }
/// <summary>
///金额
/// </summary>
[Display(Name = "金额")]
public decimal Amt { get; set; }
/// <summary>
///扩展字段1
/// </summary>
[Display(Name = "扩展字段1")]
public string Extend1 { get; set; }
/// <summary>
///扩展字段2
/// </summary>
[Display(Name = "扩展字段2")]
public string Extend2 { get; set; }
public bool IsDeleted { get; set; }
}
public class INVOICE_MAP_GROUP_EXP_DTO
{
/// <summary>
///期间
/// </summary>
[ExporterHeader(DisplayName = "期间")]
public int Version { get; set; }
/// <summary>
///发票号
/// </summary>
[ExporterHeader(DisplayName = "发票号")]
public string InvbillNum { get; set; }
/// <summary>
///发票分组号
/// </summary>
[ExporterHeader(DisplayName = "发票分组号")]
public string InvGroupNum { get; set; }
/// <summary>
///结算分组号
/// </summary>
[ExporterHeader(DisplayName = "结算分组号")]
public string SettleGroupNum { get; set; }
/// <summary>
///金额
/// </summary>
[ExporterHeader(DisplayName = "金额")]
public decimal Amt { get; set; }
/// <summary>
///扩展字段1
/// </summary>
[ExporterHeader(DisplayName = "扩展字段1")]
public string Extend1 { get; set; }
/// <summary>
///扩展字段2
/// </summary>
[ExporterHeader(DisplayName = "扩展字段2")]
public string Extend2 { get; set; }
}
public class INVOICE_MAP_GROUPRequestDto : PagedAndSortedResultRequestDto
{
public int Version { get; set; }
[Display(Name = "发票号")]
public string InvbillNum { get; set; }
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
}
public class INVOICE_NOT_SETTLE_DTO : EntityDto<Guid>
{
/// <summary>
///期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
/// <summary>
///发票分组号
/// </summary>
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
/// <summary>
///结算分组号
/// </summary>
[Display(Name = "结算分组号")]
public string SettleGroupNum { get; set; }
/// <summary>
///可结算零件号
/// </summary>
[Display(Name = "可结算零件号")]
public string LU { get; set; }
/// <summary>
///不可结算零件号
/// </summary>
[Display(Name = "不可结算零件号")]
public string LU1 { get; set; }
/// <summary>
///扩展字段1
/// </summary>
[Display(Name = "扩展字段1")]
public string Extend1 { get; set; }
/// <summary>
///扩展字段2
/// </summary>
[Display(Name = "扩展字段2")]
public string Extend2 { get; set; }
}
public class INVOICE_NOT_SETTLE_REQ_DTO : PagedAndSortedResultRequestDto
{
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
[Display(Name = "结算分组号")]
public string SettleGroupNum { get; set; }
public virtual List<FilterCondition> Filters { get; set; } = new List<FilterCondition>();
}
}
@ -247,7 +410,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}

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

@ -46,7 +46,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
public class PUB_CAN_SA_REQ_DTO : PagedAndSortedResultRequestDto
{
[Display(Name = "期间")]
@ -174,6 +173,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
[Display(Name = "业务类别")]
public string BusinessType { get; set; }
/// <summary>
///
/// </summary>
[Display(Name = "发票分组号")]
public string BillNum { get; set; }

27
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IINVOICE_SERVICE.cs

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
public interface IINVOICE_SERVICE
{
//Import
//ApprovalPassed
//Reject
//MainQuery
//DetailQuery
//Sync_QAD
Task<bool> ApprovalPassed(INVOICE_GRP_REQ_DTO input);
Task<PagedResultDto<INVOICE_GRP_DTO>> MainQueryAsync(INVOICE_GRP_REQ_DTO input);
Task<INVOICE_GRP_DETAIL_DTO> DetailQueryAsync(INVOICE_GRP_REQ_DTO input);
Task<string> ExportAsync(INVOICE_GRP_REQ_DTO input);
}
}

1
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IPUB_BA_SERVICE.cs

@ -8,5 +8,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
public interface IPUB_BA_SERVICE
{
}
}

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

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
@ -34,7 +35,55 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("generateinvoice")]
public Task<bool> GenerateInvoice(BBAC_CAN_SA_REQ_DTO input)
{
List<BBAC_CAN_SA_DETAIL_DTO> _ls = new List<BBAC_CAN_SA_DETAIL_DTO>();
var _query= _ls.GroupBy(p => new { p.GroupNum }).Select(p =>new {GroupNum=p.Key.GroupNum, Qty=p.Sum(itm=>itm.Price)});
Dictionary<string, decimal> _dic = new Dictionary<string, decimal>();
Dictionary<string, decimal> _dic1 = new Dictionary<string, decimal>();
foreach (var itm in _query.ToList())
{
_dic.Add(itm.GroupNum, itm.Qty);
_dic1.Add(itm.GroupNum, itm.Qty);
}
Dictionary<string, List<string>> _invoice=new Dictionary<string,List<string>>();
foreach (var _itm in _dic)
{
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)
{
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;
}
sum += _itm1.Value;
if (sum > 10000000)
{
continue;
}
invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
}
}
throw new NotImplementedException();
// return true;
}
[HttpPost]
[Route("mainquery")]

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -141,7 +141,9 @@ namespace Win.Sfs.SettleAccount
CreateMapHBPO_SE_DETAIL();
CreateMapHBPO_SE_EDI();
}
#region 北汽
#region BQ

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

@ -2,6 +2,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "BBAC可结算导入")]
@ -20,7 +21,7 @@ public class BBAC_CAN_SA:FullAuditedAggregateRoot<Guid>
/// 1、新建 2、已有出库3、已有扣减寄售库
/// </summary>
[Display(Name = "状态")]
public string State { get; set; } = null!;
public SettleBillState State { get; set; }
/// <summary>
/// 明细记录行数
@ -34,7 +35,7 @@ public class BBAC_CAN_SA:FullAuditedAggregateRoot<Guid>
public BBAC_CAN_SA(Guid guid, int version, string billNum, string settleBillNum, string state, string invGroupNum)
public BBAC_CAN_SA(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum)
{
Id = guid;
Version = version;

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs

@ -36,6 +36,13 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
[Display(Name = "订货时间")]
public DateTime BeginDate { get; set; }
public string Extend1 { set; get; }
public string Extend2 { set; get; }
public string Extend3 { set; get; }
public string Extend4 { set; get; }
public BBAC_SE_EDI()
{ }
public BBAC_SE_EDI(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate)

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

@ -2,6 +2,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "HBPO可结算导入")]
@ -19,7 +20,7 @@ public class HBPO_CAN_SA :FullAuditedAggregateRoot<Guid>
/// 1、新建 2、已有出库3、已有扣减寄售库
/// </summary>
[Display(Name = "状态")]
public string State { get; set; } = null!;
public SettleBillState State { get; set; }
/// <summary>
/// 明细记录行数
@ -27,7 +28,7 @@ public class HBPO_CAN_SA :FullAuditedAggregateRoot<Guid>
[Display(Name = "明细记录行数")]
public string InvGroupNum { get; set; } = null!;
public HBPO_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, string state, string invGroupNum)
public HBPO_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, SettleBillState state, string invGroupNum)
{
Version = version;
SettleBillNum = settleBillNum;

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs

@ -36,6 +36,13 @@ public class HBPO_SE_EDI :FullAuditedAggregateRoot<Guid>
[Display(Name = "订货时间")]
public DateTime BeginDate { get; set; }
public string Extend1 { set; get; }
public string Extend2 { set; get; }
public string Extend3 { set; get; }
public string Extend4 { set; get; }
public HBPO_SE_EDI(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate)
{
Id=guid;

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

@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "发票分组")]
@ -30,7 +31,11 @@ public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
[Display(Name = "业务类别")]
public string BusinessType { get; set; } = null!;
public INVOICE_GRP(Guid guid, string realnvBillNum, string invbillNum, decimal amt, decimal taxAmt, string invGroupNum, string fileName, string businessType)
[Display(Name = "业务类别")]
public InvoiceBillState State { get; set; }
public INVOICE_GRP(Guid guid, string realnvBillNum, string invbillNum, decimal amt, decimal taxAmt, string invGroupNum, string fileName, string businessType, InvoiceBillState state)
{
Id= guid;
RealnvBillNum = realnvBillNum;
@ -40,8 +45,11 @@ public class INVOICE_GRP : FullAuditedAggregateRoot<Guid>
InvGroupNum = invGroupNum;
FileName = fileName;
BusinessType = businessType;
State = state;
}
public INVOICE_GRP()
{
}

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

@ -2,6 +2,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
[Display(Name = "PUB可结算导入")]
@ -20,7 +21,7 @@ public class PUB_CAN_SA :FullAuditedAggregateRoot<Guid>
/// 1、新建 2、已有出库3、已有扣减寄售库
/// </summary>
[Display(Name = "状态")]
public int State { get; set; }
public SettleBillState State { get; set; }
/// <summary>
/// 1、JIT 2、买单件 3、备件 3、印度件
/// </summary>
@ -30,7 +31,7 @@ public class PUB_CAN_SA :FullAuditedAggregateRoot<Guid>
[Display(Name = "明细记录行数")]
public string InvGroupNum { get; set; } = null!;
public PUB_CAN_SA(int version, string settleBillNum, string billNum, int state, string businessType, string invGroupNum)
public PUB_CAN_SA(int version, string settleBillNum, string billNum, SettleBillState state, string businessType, string invGroupNum)
{
Version = version;
SettleBillNum = settleBillNum;

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

@ -16,4 +16,41 @@ namespace Win.Sfs.SettleAccount
[Description("完成")]
= 2,
}
public enum SettleBillState
{
[Description("未结状态")]
= 0,
[Description("已开票")]
= 1,
[Description("商务已审核")]
= 2,
[Description("财务已审核")]
= 3,
[Description("已扣减")]
= 4,
}
public enum InvoiceBillState
{
[Description("未结状态")]
= 0,
[Description("商务已审核")]
= 2,
[Description("财务已审核")]
= 3,
[Description("已扣减")]
= 4,
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -722,6 +722,11 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.AssemblyCode).HasMaxLength(50);
b.Property(x => x.InjectionCode).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
b.Property(x => x.Extend1).HasMaxLength(50);
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}
@ -917,6 +922,12 @@ namespace Win.Sfs.SettleAccount
b.Property(x => x.AssemblyCode).HasMaxLength(50);
b.Property(x => x.InjectionCode).HasMaxLength(50);
b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
b.Property(x => x.Extend1).HasMaxLength(50);
b.Property(x => x.Extend2).HasMaxLength(50);
b.Property(x => x.Extend3).HasMaxLength(50);
b.Property(x => x.Extend4).HasMaxLength(50);
});
}

6
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountBQEfCoreRepository.cs

@ -22,7 +22,7 @@ namespace Win.Sfs.SettleAccount.Repository
SettleAccountEfCoreRepository<TEntity, TKey>,
ISettleAccountBQEfCoreRepository<TEntity, TKey>,
ITransientDependency
where TEntity : class, IBranch<TKey>, IEntity<TKey>
where TEntity : class, IEntity<TKey>
{
private readonly IDbContextProvider<SettleAccountDbContext> _dbContextProvider;
@ -79,7 +79,7 @@ namespace Win.Sfs.SettleAccount.Repository
public virtual async Task<long> GetCountAsync(CancellationToken cancellationToken = default)
{
return await this.GetQueryable()
//.Where(p => p.BranchId.Equals(branchId))
.LongCountAsync(GetCancellationToken(cancellationToken));
}
@ -88,7 +88,7 @@ namespace Win.Sfs.SettleAccount.Repository
CancellationToken cancellationToken = default)
{
return await this.GetQueryable()
//.Where(p => p.BranchId.Equals(branchId))
.WhereIf(filters?.Count != 0, filters.ToLambda<TEntity>())
.LongCountAsync(GetCancellationToken(cancellationToken));
}

Loading…
Cancel
Save