From 5a7911bd738b4ad579b5d44cf8649eb8721127c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com>
Date: Tue, 5 Sep 2023 17:19:59 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Entities/BQ/Dtos/INVOICE_GRP_DTO.cs | 57 ++++++
.../Bases/BA_SERVICE.cs | 27 ++-
.../Entities/BQ/BBAC_BA_SERVICE.cs | 25 ++-
.../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 2 +-
.../Entities/BQ/HBPO_BA_SERVICE.cs | 4 +-
.../Entities/BQ/INVOICE_SERVICE.cs | 179 ++++++++++++++++--
.../Entities/BQ/PUB_BA_SERVICE.cs | 7 +-
.../BaseDomainServices/BaseDomainService.cs | 15 +-
.../Entities/BQ/TED_SA_INV.cs | 33 ++--
.../ExChangeCenterDbContext.cs | 34 ++++
...AccountDbContextModelCreatingExtensions.cs | 42 ++--
11 files changed, 354 insertions(+), 71 deletions(-)
create mode 100644 code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.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 e5563353..043beb46 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
@@ -292,6 +292,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "零件号")]
public string PartCode { get; set; }
+ [Display(Name = "零件描述")]
+ public string PartDesc { get; set; }
+
///
///单价
///
@@ -381,6 +384,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "零件号")]
public string PartCode { get; set; }
+ [Display(Name = "零件描述")]
+ public string PartDesc { get; set; }
+
+
///
///单价
///
@@ -456,6 +463,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "零件号")]
public string PartCode { get; set; }
+
+ [Display(Name = "零件描述")]
+ public string PartDesc { get; set; }
+
///
///单价
///
@@ -652,6 +663,52 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
}
+ public class INVOICE_NOT_SETTLE_EXT_DTO
+ {
+ [Display(Name = "金税发票")]
+ public string RealInvBillNum { get; set; }
+
+ [Display(Name = "发票日期")]
+ public DateTime? InvDate { set; get; }
+
+ [Display(Name = "发票号")]
+ public string InvBillNum { get; set; }
+ ///
+ ///发票分组号
+ ///
+ [Display(Name = "发票分组号")]
+ public string InvGroupNum { get; set; }
+ ///
+ ///结算分组号
+ ///
+ [Display(Name = "结算分组号")]
+ public string SettleGroupNum { get; set; }
+ ///
+ ///可结算零件号
+ ///
+ [Display(Name = "结算零件号")]
+ public string SettleLU { get; set; }
+
+ [Display(Name = "可结算数量")]
+ public string SettleQty { get; set; }
+ ///
+ ///可结算零件号
+ ///
+ [Display(Name = "不结算零件号")]
+ public string NotSettleLU { get; set; }
+
+ [Display(Name = "不可结数量")]
+ public string Qty { 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 320763c4..20f754c1 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
@@ -33,6 +33,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
+using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@@ -59,25 +60,27 @@ namespace Win.Sfs.SettleAccount.Bases
protected readonly INormalEfCoreRepository _adjRepository;
protected readonly HBPO_CAN_SA_MNG _hbpoMng;
protected readonly BBAC_CAN_SA_MNG _bbacMng;
- protected readonly PUB_CAN_SA_MNG _pubMng;
+ protected readonly PUB_CAN_SA_MNG _pubMng;
protected readonly INV_MNG _invMng;
private readonly TaskJobService _service;
+ private readonly BaseDomainService _baseservice;
+
protected BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
+
INormalEfCoreRepository repository,
INormalEfCoreRepository wRepository,
INormalEfCoreRepository sRepository,
INormalEfCoreRepository mRepository,
INormalEfCoreRepository adjRepository,
-
-
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
PUB_CAN_SA_MNG pubMng,
INV_MNG invMng,
- TaskJobService service
+ TaskJobService service,
+ BaseDomainService baseservice
) :
base(excelImportService, snowflakeIdGenerator, commonManager)
@@ -92,6 +95,7 @@ namespace Win.Sfs.SettleAccount.Bases
_bbacMng = bbacMng;
_hbpoMng = hbpoMng;
_invMng = invMng;
+ _baseservice = baseservice;
}
///
/// 审核通过
@@ -147,6 +151,7 @@ namespace Win.Sfs.SettleAccount.Bases
public virtual async Task DetailQueryAsync(INVOICE_GRP_REQ_DTO input)
{
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO();
+ var materialList =await _baseservice.GetMaterialList();
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var mdtos = ObjectMapper.Map, List>(m);
@@ -158,9 +163,13 @@ namespace Win.Sfs.SettleAccount.Bases
var AMap = ObjectMapper.Map, List>(A);
var wquery = from itm in AMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+ select from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
+
+ PartDesc=tm==null?string.Empty:itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
@@ -185,9 +194,12 @@ namespace Win.Sfs.SettleAccount.Bases
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
- select
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+ select from tm in temp.DefaultIfEmpty()
+ select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
+ PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
@@ -211,9 +223,12 @@ namespace Win.Sfs.SettleAccount.Bases
var wdtos = ObjectMapper.Map, List>(w);
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
- select
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+ select from tm in temp.DefaultIfEmpty()
+ select
new INVOICE_WAIT_DETAIL_DTO()
{
+ PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
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 04140267..a5938623 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
@@ -18,6 +18,7 @@ using Volo.Abp.ObjectMapping;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
+using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@@ -39,6 +40,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly INormalEfCoreRepository _priceRepository;
+
+
+
public BBAC_BA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
@@ -53,14 +57,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
PUB_CAN_SA_MNG pubMng,
INV_MNG invMng,
TaskJobService service,
-
+ BaseDomainService baseservice,
INormalEfCoreRepository priceRepository
+
- ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
+ ) : base(
+ excelImportService,
+ snowflakeIdGenerator,
+ commonManager,
+ repository,
+ wRepository,
+ sRepository,
+ mRepository,
+ adjRepository,
+ bbacMng,
+ hbpoMng,
+ pubMng,
+ invMng,
+ service,
+ baseservice)
{
_priceRepository = priceRepository;
}
+
+
///
/// 发票重开
///
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 00663f23..d18e85a4 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
@@ -63,7 +63,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository repository,
INormalEfCoreRepository detailRepository,
INV_MNG invmng,
- INormalEfCoreRepository notRepository,
+ INormalEfCoreRepository notRepository,
INormalEfCoreRepository priceRepository,
BBAC_CAN_SA_MNG bbacMng
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
index b8bc4e05..8bf67c65 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
@@ -13,6 +13,7 @@ using Volo.Abp.Application.Services;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
+using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@@ -35,10 +36,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository adjRepository, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service,
+ BaseDomainService baseservice,
INormalEfCoreRepository priceRepository
)
- : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
+ : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service,baseservice)
{
_priceRepository= priceRepository;
}
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 69fd43ee..c0640c41 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
@@ -26,6 +26,7 @@ using Volo.Abp.Uow;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
+using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@@ -49,6 +50,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly BBAC_CAN_SA_MNG _bbacMng;
private readonly HBPO_CAN_SA_MNG _hbpoMng;
private readonly INV_MNG _invMng;
+ private readonly BaseDomainService _baseservice;
public INVOICE_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
@@ -57,6 +59,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
INormalEfCoreRepository sRepository,
INormalEfCoreRepository mRepository,
INormalEfCoreRepository adjRepository,
+ BaseDomainService baseservice,
PUB_CAN_SA_MNG pubMng,
BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng,
@@ -64,6 +67,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
) : base(excelImportService, snowflakeIdGenerator, commonManager)
{
+ _baseservice = baseservice;
_repository = repository;
_wRepository = wRepository;
_mRepository = mRepository;
@@ -146,20 +150,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public virtual async Task DetailQueryAsync(INVOICE_GRP_REQ_DTO input)
{
INVOICE_GRP_DETAIL_DTO entity = new INVOICE_GRP_DETAIL_DTO();
-
+ var materialList = await _baseservice.GetMaterialList();
var invs = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var mdtos = ObjectMapper.Map, List>(m);
-
if (invs.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
{
var A = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var AMap = ObjectMapper.Map, List>(A);
var wquery = from itm in AMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+
+
+ select from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
+ PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
@@ -184,9 +192,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+ select from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
+ PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
@@ -211,9 +222,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var wdtos = ObjectMapper.Map, List>(w);
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
+ join itm2 in materialList on itm.LU equals itm2.SettleMaterialCode into temp
+ select from tm in temp.DefaultIfEmpty()
select
new INVOICE_WAIT_DETAIL_DTO()
{
+
+ PartDesc = tm == null ? string.Empty : itm.PartDesc,
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
@@ -334,7 +349,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
IExporter _csv = new CsvExporter();
ExcelExporter _excel = new ExcelExporter();
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
-
var dtoDetails = ObjectMapper.Map, List>(entities);
var invdetail= await DetailQueryAsync(input);
var m = invdetail.INVOICE_MAP_GROUP;
@@ -343,40 +357,165 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var adj = invdetail.ADJ_DETAIL;
var bbac = invdetail.INVOICE_WAIT_DETAIL_BBAC;
var bj = invdetail.INVOICE_WAIT_DETAIL_BJ;
-
-
var classDisplayName = typeof(INVOICE_GRP_DTO).GetCustomAttribute()?.Name ?? typeof(INVOICE_GRP_DTO).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
-
+ if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
+ {
+ _excel.Append(bbac, "发票明细");
+ }
+ else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
+ {
+ _excel.Append(bj, "发票明细");
+ }
+ else
+ {
+ _excel.Append(detail, "发票明细");
+ }
foreach (var itm in entities)
{
-
var mgroup =m.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
var adjp = adj.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
var nolist = not.Where(p => p.InvBillNum == itm.InvbillNum).ToList();
+ var lsC =nolist.Where(p => p.Extend1 == "可结算").ToList();
+ var lsN = nolist.Where(p => p.Extend1 == "不可结算").ToList();
+ // var r = (from t1 in lsC
+ // join t2 in lsN on new { t1.LU, t1.SettleGroupNum }
+ // equals new { t2.LU, t2.SettleGroupNum }
+
+ // into temp
+ // from tm in temp.DefaultIfEmpty()
+ // select new INVOICE_NOT_SETTLE_EXT_DTO
+ // {
+ // RealInvBillNum = t1.RealInvBillNum,
+ // InvDate = t1.InvDate,
+ // InvBillNum = t1.InvBillNum,
+ // InvGroupNum = t1.InvGroupNum,
+ // SettleGroupNum = t1.SettleGroupNum,
+ // SettleLU = t1.LU,
+ // NotSettleLU = tm == null ? string.Empty : tm.LU,
+ // Qty = tm == null ? string.Empty : tm.Qty
+
+ // }
+ // )
+ //.Union
+ //(from t2 in lsN
+ // join t1 in lsC
+ // on new { t2.LU, t2.SettleGroupNum }
+ // equals new { t1.LU, t1.SettleGroupNum }
+ // into temp
+ // from tm in temp.DefaultIfEmpty()
+ // where tm == null
+ // select new INVOICE_NOT_SETTLE_EXT_DTO
+ // {
+ // RealInvBillNum = t2.RealInvBillNum,
+ // InvDate = t2.InvDate,
+ // InvBillNum = t2.InvBillNum,
+ // InvGroupNum = t2.InvGroupNum,
+ // SettleGroupNum = t2.SettleGroupNum,
+ // SettleLU = string.Empty,
+ // NotSettleLU = t2.LU,
+ // Qty = t2.Qty
+
+ // }
+ // );
-
-
- if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
+ //_excel.Append(r.OrderBy(p=>p.SettleGroupNum).ToList(), "结算分组零件" + itm.InvbillNum);
+
+
+
+
+
+ var lineC = lsC.Count;
+ var lineN = lsN.Count;
+ List ls = new List();
+ if (lineC > lineN)//可结大于不可结行数时
{
- var bbaclist = bbac.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
- _excel.Append(bbaclist, "发票号" + itm.InvbillNum).SeparateBySheet();
+ for (int number = 0; number < lineC; number++)
+ {
+ if (number + 1 > lineN)
+ {
+ INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
+ entity.RealInvBillNum = lsC[number].RealInvBillNum;
+ entity.InvDate = lsC[number].InvDate;
+ entity.InvBillNum = lsC[number].InvBillNum;
+ entity.InvGroupNum = lsC[number].InvGroupNum;
+ entity.SettleGroupNum = lsC[number].SettleGroupNum;
+ entity.SettleLU = lsC[number].LU;
+ entity.SettleQty = lsC[number].Qty;
+ entity.NotSettleLU = string.Empty;
+ entity.Qty = string.Empty;
+ ls.Add(entity);
+
+ }
+ else
+ {
+ INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
+ entity.RealInvBillNum = lsC[number].RealInvBillNum;
+ entity.InvDate = lsC[number].InvDate;
+ entity.InvBillNum = lsC[number].InvBillNum;
+ entity.InvGroupNum = lsC[number].InvGroupNum;
+ entity.SettleGroupNum = lsC[number].SettleGroupNum;
+ entity.SettleLU = lsC[number].LU;
+ entity.SettleQty= lsC[number].Qty;
+ entity.NotSettleLU = lsN[number].LU;
+ entity.Qty = lsN[number].Qty;
+ ls.Add(entity);
+ }
+ }
}
- else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
+ else
{
- var bjlist = bj.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
- _excel.Append(bjlist, "发票号" + itm.InvbillNum).SeparateBySheet();
+ for (int number = 0; number < lineN; number++)
+ {
+ if (number + 1 > lineC)//不可结大于可结行数时
+ {
+ INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
+ entity.RealInvBillNum = lsN[number].RealInvBillNum;
+ entity.InvDate = lsN[number].InvDate;
+ entity.InvBillNum = lsN[number].InvBillNum;
+ entity.InvGroupNum = lsN[number].InvGroupNum;
+ entity.SettleGroupNum = lsN[number].SettleGroupNum;
+ entity.SettleLU = string.Empty;
+ entity.SettleQty = string.Empty;
+ entity.NotSettleLU = lsN[number].LU;
+ entity.Qty = lsN[number].Qty;
+ ls.Add(entity);
+ }
+ else
+ {
+ INVOICE_NOT_SETTLE_EXT_DTO entity = new INVOICE_NOT_SETTLE_EXT_DTO();
+ entity.RealInvBillNum = lsN[number].RealInvBillNum;
+ entity.InvDate = lsN[number].InvDate;
+ entity.InvBillNum = lsN[number].InvBillNum;
+ entity.InvGroupNum = lsN[number].InvGroupNum;
+ entity.SettleGroupNum = lsN[number].SettleGroupNum;
+ entity.SettleLU = lsC[number].LU;
+ entity.NotSettleLU = lsN[number].LU;
+ entity.Qty = lsN[number].Qty;
+ entity.SettleQty = lsC[number].Qty;
+ ls.Add(entity);
+ }
+ }
+ }
+
+ var disList= ls.Select(p => p.SettleGroupNum).Distinct().ToList();
+ foreach (var de in ls)
+ {
+ de.SettleGroupNum = string.Empty;
}
- else
+ for (int i = 0; i < disList.Count; i++)
{
- var invlist = detail.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
- _excel.Append(invlist, "发票号" + itm.InvbillNum).SeparateBySheet();
+ ls[i].SettleGroupNum = disList[i];
+
}
+
+ _excel.Append(ls, "结算分组零件" + itm.InvbillNum);
_excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
- _excel.Append(nolist, "结算分组零件" + itm.InvbillNum);
+
}
-
+
+
var result = _excel.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
index df7336ea..ee7cce20 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
@@ -13,6 +13,7 @@ using Volo.Abp.Application.Services;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
+using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@@ -34,11 +35,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public PUB_BA_SERVICE(IExcelImportAppService excelImportService, ISnowflakeIdGenerator snowflakeIdGenerator, ICommonManager commonManager, INormalEfCoreRepository pubRepository, INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, INormalEfCoreRepository adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
- TaskJobService service, INormalEfCoreRepository priceRepository
+ TaskJobService service,
+ BaseDomainService baseservice,
+ INormalEfCoreRepository priceRepository
- ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service)
+ ) : base(excelImportService, snowflakeIdGenerator, commonManager, repository, wRepository, sRepository, mRepository, adjRepository, bbacMng, hbpoMng, pubMng, invMng, service,baseservice)
{
_priceRepository = priceRepository;
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
index 99ed2e02..1a952f09 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
@@ -28,11 +28,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
private readonly INormalEfCoreRepository _relationshipRepository;
private readonly INormalEfCoreRepository _priceRepository;
private readonly INormalEfCoreRepository _pricebjRepository;
-
-
-
private readonly INormalEfCoreRepository _bomshipRepository;
-
public BaseDomainService(
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
@@ -53,6 +49,15 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
_bomshipRepository = bomshipRepository;
}
+ public async Task> GetMaterialList()
+ {
+ List ls = new List();
+ var lst = await _relationshipRepository.Where(p => !string.IsNullOrEmpty(p.SettleMaterialCode)).ToListAsync();
+
+
+ var l=lst.GroupBy(p => p.SettleMaterialCode).Select(g=> g.First());
+ return l.ToList();
+ }
public static async Task DoWorkBulkWithTransaction(DbContext dbContext, Action p_dowork)
{
@@ -69,8 +74,6 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
{
// 回滚事务
await transaction.RollbackAsync();
-
-
throw;
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs
index 304f9cc9..917bd372 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs
@@ -1,21 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
namespace Win.Sfs.SettleAccount.Entities.BQ;
-public class TED_SA_INV : AuditedAggregateRoot
-{
+public class TED_SA_INV {
+
+
+ public Guid GUID { set; get; }
+
+ public Guid TaskID { set; get; }
+
+ public int UID { set; get; }
+
+
///
/// 发票号
///
- public string invoiceNumber { set; get; }
+ public string InvoiceNumber { set; get; }
///
/// 结算系统发票号
///
- public string sasInvoiceNumber { set; get; }
+ public string SASInvoiceNumber { set; get; }
///
/// 客户代码
@@ -97,10 +106,15 @@ public class TED_SA_INV : AuditedAggregateRoot
public DateTime endtime { set; get; }
- public TED_SA_INV(string invoiceNumber, string sasInvoiceNumber, string customer, string billTo, DateTime invoiceDate, string site, string tYPE, string partNumber, decimal invoiceQuatity, decimal price, string supplier, string remark, decimal invoiceNetAmount, decimal invoiceTaxAmount, decimal taxRate, string location, decimal invoiceNet, decimal invoiceTax, DateTime begintime, DateTime endtime)
+ public string Domain { set; get; }
+
+ public TED_SA_INV(Guid gUID, Guid taskID, int uID, string invoiceNumber, string sASInvoiceNumber, string customer, string billTo, DateTime invoiceDate, string site, string tYPE, string partNumber, decimal invoiceQuatity, decimal price, string supplier, string remark, decimal invoiceNetAmount, decimal invoiceTaxAmount, decimal taxRate, string location, decimal invoiceNet, decimal invoiceTax, DateTime begintime, DateTime endtime, string domain)
{
- this.invoiceNumber = invoiceNumber;
- this.sasInvoiceNumber = sasInvoiceNumber;
+ GUID = gUID;
+ TaskID = taskID;
+ UID = uID;
+ InvoiceNumber = invoiceNumber;
+ SASInvoiceNumber = sASInvoiceNumber;
Customer = customer;
BillTo = billTo;
InvoiceDate = invoiceDate;
@@ -119,10 +133,7 @@ public class TED_SA_INV : AuditedAggregateRoot
InvoiceTax = invoiceTax;
this.begintime = begintime;
this.endtime = endtime;
-
-
-
-
+ Domain = domain;
}
public TED_SA_INV()
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
new file mode 100644
index 00000000..1895b21c
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using Volo.Abp.Data;
+using Win.Sfs.SettleAccount.Entities.BQ;
+
+namespace Win.Sfs.SettleAccount.EntityFrameworkCore;
+
+
+[ConnectionStringName("WMSBJBMPT")]
+
+public class ExChangeCenterDbContext:DbContext
+{
+ public DbSet TED_SA_INV { set; get; }
+
+
+
+ public ExChangeCenterDbContext(DbContextOptions options) : base(options)
+ {
+ }
+
+
+
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
+ {
+ base.OnModelCreating(modelBuilder);
+ }
+
+
+
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
index afef1127..9a91cad1 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
@@ -114,7 +114,7 @@ namespace Win.Sfs.SettleAccount
builder.ConfigurePUB_PD(options);
- builder.ConfigureTED_SA_INV(options);
+ //builder.ConfigureTED_SA_INV(options);
//大众发票导入
//builder.ConfigureInvoice(options);
//builder.ConfigureInvoiceVersion(options);
@@ -976,7 +976,6 @@ namespace Win.Sfs.SettleAccount
builder.Entity(b =>
{
b.ToTable($"{options.TablePrefix}_INVOICE_MAP_GROUP", options.Schema);
-
b.ConfigureByConvention();
b.Property(x => x.InvbillNum).HasMaxLength(50);
b.Property(x => x.InvGroupNum).HasMaxLength(50);
@@ -1085,7 +1084,6 @@ namespace Win.Sfs.SettleAccount
builder.Entity(b =>
{
b.ToTable($"{options.TablePrefix}_PUB_NOT_SA_DETAIL", options.Schema);
-
b.ConfigureByConvention();
b.Property(x => x.Site).HasMaxLength(50);
b.Property(x => x.Extend1).HasMaxLength(50);
@@ -1261,28 +1259,28 @@ namespace Win.Sfs.SettleAccount
});
}
- private static void ConfigureTED_SA_INV(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
- {
+ //private static void ConfigureTED_SA_INV(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
+ //{
- builder.Entity(b =>
- {
+ // builder.Entity(b =>
+ // {
- b.ToTable($"{options.TablePrefix}_TED_SA_INV", options.Schema);
+ // b.ToTable($"{options.TablePrefix}_TED_SA_INV", options.Schema);
- b.ConfigureByConvention();
- b.Property(x => x.invoiceNumber).HasMaxLength(50);
- b.Property(x => x.sasInvoiceNumber).HasMaxLength(50);
- b.Property(x => x.Customer).HasMaxLength(50);
- b.Property(x => x.BillTo).HasMaxLength(50);
- b.Property(x => x.Site).HasMaxLength(50);
- b.Property(x => x.TYPE).HasMaxLength(50);
- b.Property(x => x.PartNumber).HasMaxLength(50);
- b.Property(x => x.Supplier).HasMaxLength(50);
- b.Property(x => x.Remark).HasMaxLength(50);
- b.Property(x => x.Location).HasMaxLength(50);
- b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
- });
- }
+ // b.ConfigureByConvention();
+ // b.Property(x => x.invoiceNumber).HasMaxLength(50);
+ // b.Property(x => x.sasInvoiceNumber).HasMaxLength(50);
+ // b.Property(x => x.Customer).HasMaxLength(50);
+ // b.Property(x => x.BillTo).HasMaxLength(50);
+ // b.Property(x => x.Site).HasMaxLength(50);
+ // b.Property(x => x.TYPE).HasMaxLength(50);
+ // b.Property(x => x.PartNumber).HasMaxLength(50);
+ // b.Property(x => x.Supplier).HasMaxLength(50);
+ // b.Property(x => x.Remark).HasMaxLength(50);
+ // b.Property(x => x.Location).HasMaxLength(50);
+ // b.Property(x => x.ConcurrencyStamp).HasMaxLength(50);
+ // });
+ //}