mahao 1 year ago
parent
commit
eb7df864ba
  1. 57
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 27
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  3. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
  5. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  6. 179
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  7. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  8. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs
  9. 33
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/TED_SA_INV.cs
  10. 34
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/ExChangeCenterDbContext.cs
  11. 42
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

57
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; }
/// <summary>
///单价
/// </summary>
@ -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; }
/// <summary>
///单价
/// </summary>
@ -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; }
/// <summary>
///单价
/// </summary>
@ -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; }
/// <summary>
///发票分组号
/// </summary>
[Display(Name = "发票分组号")]
public string InvGroupNum { get; set; }
/// <summary>
///结算分组号
/// </summary>
[Display(Name = "结算分组号")]
public string SettleGroupNum { get; set; }
/// <summary>
///可结算零件号
/// </summary>
[Display(Name = "结算零件号")]
public string SettleLU { get; set; }
[Display(Name = "可结算数量")]
public string SettleQty { get; set; }
/// <summary>
///可结算零件号
/// </summary>
[Display(Name = "不结算零件号")]
public string NotSettleLU { get; set; }
[Display(Name = "不可结数量")]
public string Qty { get; set; }
}

27
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<PUB_ADJ_DETAIL, Guid> _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<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> 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;
}
/// <summary>
/// 审核通过
@ -147,6 +151,7 @@ namespace Win.Sfs.SettleAccount.Bases
public virtual async Task<INVOICE_GRP_DETAIL_DTO> 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<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
@ -158,9 +163,13 @@ namespace Win.Sfs.SettleAccount.Bases
var AMap = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BBAC_DTO>>(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<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(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,

25
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<PriceList, Guid> _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<PriceList, Guid> 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;
}
/// <summary>
/// 发票重开
/// </summary>

2
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<BBAC_CAN_SA, Guid> repository,
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository,
INV_MNG invmng,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
BBAC_CAN_SA_MNG bbacMng

4
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<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng,
HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> 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;
}

179
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<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> 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<INVOICE_GRP_DETAIL_DTO> 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<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(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<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BBAC_DTO>>(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<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(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<INVOICE_GRP>, List<INVOICE_GRP_EXP_DTO>>(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<DisplayAttribute>()?.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<INVOICE_NOT_SETTLE_EXT_DTO> ls = new List<INVOICE_NOT_SETTLE_EXT_DTO>();
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();
//保存导出文件到服务器存成二进制

7
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<PUB_ADJ_DETAIL, Guid> pubRepository, INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository, BBAC_CAN_SA_MNG bbacMng, HBPO_CAN_SA_MNG hbpoMng, PUB_CAN_SA_MNG pubMng, INV_MNG invMng,
TaskJobService service, INormalEfCoreRepository<PriceList, Guid> priceRepository
TaskJobService service,
BaseDomainService baseservice,
INormalEfCoreRepository<PriceList, Guid> 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;

15
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/BaseDomainServices/BaseDomainService.cs

@ -28,11 +28,7 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
private readonly INormalEfCoreRepository<MaterialRelationship, Guid> _relationshipRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<PriceListBJ, Guid> _pricebjRepository;
private readonly INormalEfCoreRepository<Bom, Guid> _bomshipRepository;
public BaseDomainService(
IGuidGenerator guidGenerator,
IObjectMapper objectMapper,
@ -53,6 +49,15 @@ namespace Win.Sfs.SettleAccount.Bases.DomainServices
_bomshipRepository = bomshipRepository;
}
public async Task<List<MaterialRelationship>> GetMaterialList()
{
List<MaterialRelationship> ls = new List<MaterialRelationship>();
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;
}
}

33
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<Guid>
{
public class TED_SA_INV {
public Guid GUID { set; get; }
public Guid TaskID { set; get; }
public int UID { set; get; }
/// <summary>
/// 发票号
/// </summary>
public string invoiceNumber { set; get; }
public string InvoiceNumber { set; get; }
/// <summary>
/// 结算系统发票号
/// </summary>
public string sasInvoiceNumber { set; get; }
public string SASInvoiceNumber { set; get; }
/// <summary>
/// 客户代码
@ -97,10 +106,15 @@ public class TED_SA_INV : AuditedAggregateRoot<Guid>
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<Guid>
InvoiceTax = invoiceTax;
this.begintime = begintime;
this.endtime = endtime;
Domain = domain;
}
public TED_SA_INV()

34
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> TED_SA_INV { set; get; }
public ExChangeCenterDbContext(DbContextOptions<WMSBJBMPTDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}

42
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<INVOICE_MAP_GROUP>(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<PUB_NOT_SA_DETAIL>(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<TED_SA_INV>(b =>
{
// builder.Entity<TED_SA_INV>(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);
// });
//}

Loading…
Cancel
Save