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