Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
1b1f7fc400
  1. 107
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/INVOICE_GRP_DTO.cs
  2. 112
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  3. 155
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  4. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  5. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs

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

@ -219,6 +219,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 发票明细
/// </summary>
public List<INVOICE_WAIT_DETAIL_DTO> INVOICE_WAIT_DETAIL { get; set; }
/// <summary>
/// 发票明细
/// </summary>
public List<INVOICE_WAIT_DETAIL_BBAC_DTO> INVOICE_WAIT_DETAIL_BBAC { get; set; }
public List<INVOICE_WAIT_DETAIL_BJ_DTO> INVOICE_WAIT_DETAIL_BJ { get; set; }
/// <summary>
/// 发票和结算分组对应关系
/// </summary>
@ -239,8 +250,96 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public class INVOICE_WAIT_DETAIL_BJ_DTO
{
/// <summary>
///期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "金税发票号")]
public string RealInvbillNum { get; set; }
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
/// <summary>
///扩展字段1
/// </summary>
[Display(Name = "凭证号")]
public string Extend1 { 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 LU { get; set; }
/// <summary>
///零件号
/// </summary>
[Display(Name = "零件号")]
public string PartCode { get; set; }
/// <summary>
///单价
/// </summary>
[Display(Name = "单价")]
public decimal PRICE { get; set; }
/// <summary>
///数量
/// </summary>
[Display(Name = "数量")]
public decimal Qty { get; set; }
/// <summary>
///金额
/// </summary>
[Display(Name = "金额")]
public decimal Amt { get; set; }
/// <summary>
///业务分类
/// </summary>
[Display(Name = "业务分类")]
public string BussiessType { get; set; }
/// <summary>
///扩展字段3
/// </summary>
[Display(Name = "价格开始日期")]
public DateTime BeginDate { get; set; }
/// <summary>
///扩展字段4
/// </summary>
[Display(Name = "价格结束日期")]
public DateTime EndDate { get; set; }
}
public class INVOICE_WAIT_DETAIL_EXT_DTO
public class INVOICE_WAIT_DETAIL_BBAC_DTO
{
/// <summary>
@ -335,8 +434,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
[Display(Name = "发票日期")]
public DateTime? InvDate { set; get; }
/// <summary>
///发票号
/// </summary>
@ -382,8 +479,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary>
///扩展字段1
/// </summary>
[Display(Name = "SA号")]
public string Extend1 { get; set; }
//[Display(Name = "SA号")]
//public string Extend1 { get; set; }
/// <summary>
///扩展字段3

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

@ -146,20 +146,91 @@ namespace Win.Sfs.SettleAccount.Bases
[HttpPost]
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 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);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
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
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BBAC = AMap;
}
else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
var B = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var BMap = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BJ_DTO>>(B);
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BJ = BMap;
}
else
{
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
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
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
// Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL = wdtos;
}
var notquery = from itm in sdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
@ -174,27 +245,6 @@ namespace Win.Sfs.SettleAccount.Bases
Qty = itm.Qty,
Extend1 = itm.Extend1,
};
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
var mquery = from itm in mdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
@ -206,13 +256,8 @@ namespace Win.Sfs.SettleAccount.Bases
InvGroupNum = itm.InvGroupNum,
SettleGroupNum = itm.SettleGroupNum
};
var adjs = await _adjRepository.GetListByFilterAsync(input.Filters);
var adjdtos = ObjectMapper.Map<List<PUB_ADJ_DETAIL>, List<PUB_ADJ_DETAIL_DTO>>(adjs);
var adjQuery = from itm in adjdtos
join itm1 in invs on itm.InvBillNum equals itm1.InvbillNum
select
@ -230,7 +275,6 @@ namespace Win.Sfs.SettleAccount.Bases
};
entity.INVOICE_NOT_SETTLE = notquery.ToList();
entity.INVOICE_WAIT_DETAIL = wquery.ToList();
entity.INVOICE_MAP_GROUP = mquery.ToList();
entity.ADJ_DETAIL = adjQuery.ToList();
return entity;

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

@ -1,6 +1,7 @@
using CodeArts.Db;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Diagrams;
using DocumentFormat.OpenXml.Spreadsheet;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
@ -149,11 +150,96 @@ 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 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);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);
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
select
new INVOICE_WAIT_DETAIL_BBAC_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BBAC = AMap;
}
else if (invs.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
var B = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var BMap = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_BJ_DTO>>(B);
var wquery = from itm in BMap
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_BJ_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL_BJ = BMap;
}
else
{
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
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
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
//Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
entity.INVOICE_WAIT_DETAIL = wdtos;
}
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
var adjs =await _adjRepository.GetListByFilterAsync(input.Filters);
@ -173,26 +259,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
Extend1 = itm.Extend1,
};
var wquery = from itm in wdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
new INVOICE_WAIT_DETAIL_DTO()
{
InvDate = itm1.CreationTime,
RealInvbillNum = string.IsNullOrEmpty(itm1.RealnvBillNum) ? string.Empty : itm1.RealnvBillNum,
Version = itm.Version,
InvbillNum = itm.InvbillNum,
InvGroupNum = itm.InvGroupNum,
LU = itm.LU,
PartCode = itm.PartCode,
PRICE = itm.PRICE,
Qty = itm.Qty,
Amt = itm.Amt,
BussiessType = itm.BussiessType,
Extend1 = itm.Extend1,
BeginDate = itm.BeginDate,
EndDate = itm.EndDate,
};
var mquery = from itm in mdtos
join itm1 in invs on itm.InvbillNum equals itm1.InvbillNum
select
@ -222,7 +289,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
};
entity.INVOICE_NOT_SETTLE = notquery.ToList();
entity.INVOICE_WAIT_DETAIL = wquery.ToList();
entity.INVOICE_MAP_GROUP = mquery.ToList();
entity.ADJ_DETAIL = adjQuery.ToList();
return entity;
@ -243,6 +310,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
byte[] result = null;
result = await _excel.ExportAsByteArray(dtoDetails);
//switch (input.FileType)
//{
// case 0:
@ -275,22 +351,51 @@ 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;
var not=invdetail.INVOICE_NOT_SETTLE;
var detail =invdetail.INVOICE_WAIT_DETAIL;
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";
foreach (var itm in entities)
{
var invlist = detail.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
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();
_excel.Append(invlist, "发票号" + itm.InvbillNum).SeparateBySheet();
if (entities.FirstOrDefault().BusinessType == EnumBusinessType.JisBBAC)
{
var bbaclist = bbac.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
_excel.Append(bbaclist, "发票号" + itm.InvbillNum).SeparateBySheet();
}
else if (entities.FirstOrDefault().BusinessType == EnumBusinessType.BeiJian)
{
var bjlist = bj.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
_excel.Append(bjlist, "发票号" + itm.InvbillNum).SeparateBySheet();
}
else
{
var invlist = detail.Where(p => p.InvbillNum == itm.InvbillNum).ToList();
_excel.Append(invlist, "发票号" + itm.InvbillNum).SeparateBySheet();
}
_excel.Append(mgroup, "发票结算分组对应" + itm.InvbillNum).SeparateBySheet();
_excel.Append(adjp, "发票调整数据" + itm.InvbillNum).SeparateBySheet();
_excel.Append(nolist, "结算分组零件" + itm.InvbillNum);

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

@ -288,8 +288,9 @@ namespace Win.Sfs.SettleAccount
private void CreateMapINVOICE_WAIT_DETAIL_EXTEND()
{
CreateMap<INVOICE_WAIT_DETAIL, INVOICE_WAIT_DETAIL_EXT_DTO>().ReverseMap();
CreateMap<INVOICE_WAIT_DETAIL, INVOICE_WAIT_DETAIL_BJ_DTO>().ReverseMap();
CreateMap<INVOICE_WAIT_DETAIL, INVOICE_WAIT_DETAIL_BBAC_DTO>().ReverseMap();
}

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

@ -1964,6 +1964,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);

Loading…
Cancel
Save