|
@ -2,6 +2,7 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Text; |
|
|
using System.Text; |
|
|
|
|
|
using System.Text.Json; |
|
|
using System.Threading.Tasks; |
|
|
using System.Threading.Tasks; |
|
|
using AutoMapper; |
|
|
using AutoMapper; |
|
|
using CodeArts.Db.Lts; |
|
|
using CodeArts.Db.Lts; |
|
@ -12,6 +13,7 @@ using EFCore.BulkExtensions; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax; |
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
|
|
|
using Microsoft.Extensions.Logging; |
|
|
using Minio.DataModel; |
|
|
using Minio.DataModel; |
|
|
using Org.BouncyCastle.Asn1.Cmp; |
|
|
using Org.BouncyCastle.Asn1.Cmp; |
|
|
using SettleAccount.Bases; |
|
|
using SettleAccount.Bases; |
|
@ -50,9 +52,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
public class GenerateJisInvoiceService : ApplicationService, ITransientDependency, IExportJob |
|
|
public class GenerateJisInvoiceService : ApplicationService, ITransientDependency, IExportJob |
|
|
{ |
|
|
{ |
|
|
protected readonly SettleAccountDbContext _dbcontext; |
|
|
protected readonly SettleAccountDbContext _dbcontext; |
|
|
public GenerateJisInvoiceService(SettleAccountDbContext dbcontext) |
|
|
protected readonly ILogger<GenerateJisInvoiceService> _log; |
|
|
|
|
|
public GenerateJisInvoiceService(SettleAccountDbContext dbcontext, ILogger<GenerateJisInvoiceService> log) |
|
|
{ |
|
|
{ |
|
|
_dbcontext = dbcontext; |
|
|
_dbcontext = dbcontext; |
|
|
|
|
|
_log = log; |
|
|
} |
|
|
} |
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
|
{ |
|
|
{ |
|
@ -657,6 +661,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
; |
|
|
|
|
|
foreach (var big in biglist)//单条大于1000W的开票,拆成多张
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var groupList = new List<INVOICE_MAP_GROUP>(); |
|
|
var groupList = new List<INVOICE_MAP_GROUP>(); |
|
|
var notDetialList = new List<INVOICE_NOT_SETTLE>(); |
|
|
var notDetialList = new List<INVOICE_NOT_SETTLE>(); |
|
@ -664,8 +672,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
var invlist = new List<INVOICE_GRP>(); |
|
|
var invlist = new List<INVOICE_GRP>(); |
|
|
var salist = new List<TDetail>(); |
|
|
var salist = new List<TDetail>(); |
|
|
var adjlist = new List<PUB_ADJ_DETAIL>(); |
|
|
var adjlist = new List<PUB_ADJ_DETAIL>(); |
|
|
foreach (var big in biglist)//单条大于1000W的开票,拆成多张
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var list = p_list.Where(p => p.InvGroupNum == big.InvGroupNum && p.PartCode == big.PartCode && p.Price == big.Price && p.LU == big.LU ); |
|
|
var list = p_list.Where(p => p.InvGroupNum == big.InvGroupNum && p.PartCode == big.PartCode && p.Price == big.Price && p.LU == big.LU ); |
|
|
var gener = new InvoiceGeneratorSame<TDetail>(); |
|
|
var gener = new InvoiceGeneratorSame<TDetail>(); |
|
@ -921,6 +927,18 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_log.LogDebug(JsonSerializer.Serialize(invlist)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//foreach (var itm in invlist)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// itm.SetId(Guid.NewGuid());
|
|
|
|
|
|
//}
|
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(invlist); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(groupList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
|
_dbcontext.BulkInsert(detailList); |
|
@ -964,6 +982,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
if (smalllist.Count > 0) |
|
|
if (smalllist.Count > 0) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
smalllist = smalllist.OrderBy(p => p.Amt).ToList(); |
|
|
smalllist = smalllist.OrderBy(p => p.Amt).ToList(); |
|
|
_invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); |
|
|
_invls = GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType); |
|
|
} |
|
|
} |
|
@ -1045,7 +1064,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
foreach (var sitm in sq) |
|
|
foreach (var sitm in sq) |
|
|
{ |
|
|
{ |
|
|
innotls.Add(new INVOICE_NOT_SETTLE( |
|
|
innotls.Add(new INVOICE_NOT_SETTLE( |
|
|
guid: GuidGenerator.Create(), |
|
|
guid: Guid.NewGuid(), |
|
|
version: p_version, |
|
|
version: p_version, |
|
|
invGroupNum: p_InvGroupNum, |
|
|
invGroupNum: p_InvGroupNum, |
|
|
settleGroupNum: sitm.GroupNum, |
|
|
settleGroupNum: sitm.GroupNum, |
|
@ -1069,7 +1088,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
foreach (var sitm in sq) |
|
|
foreach (var sitm in sq) |
|
|
{ |
|
|
{ |
|
|
innotls.Add(new INVOICE_NOT_SETTLE( |
|
|
innotls.Add(new INVOICE_NOT_SETTLE( |
|
|
guid: GuidGenerator.Create(), |
|
|
guid: Guid.NewGuid(), |
|
|
version: p_version, |
|
|
version: p_version, |
|
|
invGroupNum: p_InvGroupNum, |
|
|
invGroupNum: p_InvGroupNum, |
|
|
settleGroupNum: sitm.GroupNum, |
|
|
settleGroupNum: sitm.GroupNum, |
|
@ -1118,7 +1137,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs |
|
|
} |
|
|
} |
|
|
var invbill = new INVOICE_GRP |
|
|
var invbill = new INVOICE_GRP |
|
|
( |
|
|
( |
|
|
guid: GuidGenerator.Create(), |
|
|
guid: Guid.NewGuid(), |
|
|
realnvBillNum: string.Empty, |
|
|
realnvBillNum: string.Empty, |
|
|
invbillNum: inv.InvBillNum, |
|
|
invbillNum: inv.InvBillNum, |
|
|
amt: amt, |
|
|
amt: amt, |
|
|