Browse Source

更新发票

master
zhaoxinyu 4 months ago
parent
commit
e5341a4c16
  1. 3
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs
  2. 581
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs
  3. 20
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs
  4. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

3
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/SettleAccountHttpApiHostModule.cs

@ -71,6 +71,9 @@ namespace Win.Sfs.SettleAccount
public override void ConfigureServices(ServiceConfigurationContext context)
{
//IServiceCollection Services = new ServiceCollection();
//Services.GetConfiguration();
// System.AbpStringExtensions.ToCamelCase(System.String, Boolean)'
var configuration = context.Services.GetConfiguration();

581
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/GenerateJisInvoiceService.cs

@ -5,6 +5,8 @@ using System.Text;
using System.Threading.Tasks;
using AutoMapper;
using CodeArts.Db.Lts;
using DocumentFormat.OpenXml.Bibliography;
using DocumentFormat.OpenXml.Drawing.Diagrams;
using DocumentFormat.OpenXml.Presentation;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Mvc;
@ -18,6 +20,7 @@ using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.Application.Services;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Guids;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
@ -281,7 +284,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号
List<string> List = new List<string>();
decimal sum = itm.Value;//初始分组合计金额
if (copyDic.ContainsKey(itm.Key) == true)//是否存在分组
{
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO)
@ -292,7 +295,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
invoiceGroupNumList.Add(itm.Key);
continue;
}
}
sum += _itm1.Value;
if (sum > 10000000)
{
@ -321,7 +324,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
break;
}
sum += _itm1.Value;
if (sum > 10000000)
{
@ -540,26 +543,26 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
_dbcontext.BulkUpdate(salist);
//带库位发票
var detailext=salist.GroupBy(p => new { p.InvbillNum, p.InvGroupNum, p.PartCode,p.LU,p.Price, p.ErpLoc,p.BusinessType })
var detailext = salist.GroupBy(p => new { p.InvbillNum, p.InvGroupNum, p.PartCode, p.LU, p.Price, p.ErpLoc, p.BusinessType })
.Select(p => new INVOICE_DETAIL_EXT
{
Version=p_version,
InvbillNum= p.Key.InvbillNum,
InvGroupNum= p.Key.InvGroupNum,
PartCode=p.Key.PartCode,
PRICE= p.Key.Price,
ErpLoc=p.Key.ErpLoc,
Qty = p.Sum(k => k.Qty),
BussiessType=p.Key.BusinessType,
Amt = Math.Round(p.Sum(k => k.Qty) * p.Key.Price, 2),//税前
LU=p.Key.LU
Version = p_version,
InvbillNum = p.Key.InvbillNum,
InvGroupNum = p.Key.InvGroupNum,
PartCode = p.Key.PartCode,
PRICE = p.Key.Price,
ErpLoc = p.Key.ErpLoc,
Qty = p.Sum(k => k.Qty),
BussiessType = p.Key.BusinessType,
Amt = Math.Round(p.Sum(k => k.Qty) * p.Key.Price, 2),//税前
LU = p.Key.LU
}
).ToList();
foreach (var itm in detailext)
{
itm.SetId(GuidGenerator.Create());
itm.CreationTime = DateTime.Now;
itm.CreationTime = DateTime.Now;
}
_dbcontext.BulkInsert(detailext);
}
@ -613,177 +616,403 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
EndDate = itm.Key.EndDate
}).ToList();
List<GroupPartCode> biglist = new List<GroupPartCode>();
List<GroupPartCode> smalllist = new List<GroupPartCode>();
foreach (var itm in groupDtos)//分类1000W以上或1000W以下
if (groupDtos.Sum(p => p.Amt) < 10000000)
{
if (itm.Amt > 10000000)
var ls = new List<GroupPartCode>();
var orderbyList = groupDtos.OrderBy(p => p.Qty).ToList();
int i = 0;
int j = orderbyList.Count - 1;
while (i <= j)
{
biglist.Add(itm);
}
else
{
smalllist.Add(itm);
if (i == j)
{
ls.Add(orderbyList[i]);
}
else
{
ls.Add(orderbyList[i]);
ls.Add(orderbyList[j]);
}
i++;
j--;
}
_invls = GenSecInvoice(orderbyList, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
}
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的开票
else
{
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>();
gener.GenerateInvoices(p_list);
var invList = gener.Invoices;
foreach (var inv in invList)
List<GroupPartCode> biglist = new List<GroupPartCode>();
List<GroupPartCode> smalllist = new List<GroupPartCode>();
foreach (var itm in groupDtos)//分类1000W以上或1000W以下
{
var partlist = inv.Parts;
if (partlist.Count > 0)
if (itm.Amt > 10000000)
{
var query = from itm in partlist
join itm1 in dtos on itm.Id equals itm1.Id
select itm1;
var Dtos = query.ToList();
var detailDtos = Dtos.GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU })//明细
.Select(itm => new
{
PartCode = itm.Key.PartCode,
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.LU,
ContactDocID = itm.Key.ContractDocID,
Price = itm.Key.Price,
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税前
Tax = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2),//税
TaxAmt = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2) + Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税后进
Qty = itm.Sum(k => k.Qty),
BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate
}).ToList();
decimal amt = detailDtos.Sum(k => k.Amt);//金额
decimal txtAmt = detailDtos.Sum(k => k.TaxAmt);//税后金额
decimal realAmt = detailDtos.Sum(k => k.Tax);//税额
var invoicegrup = partlist.Select(p => p.GroupNum);
var mapList = new List<INVOICE_MAP_GROUP>();
foreach (var groupnum in invoicegrup)
{
mapList.Add(new INVOICE_MAP_GROUP(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: inv.InvBillNum,
invGroupNum: p_InvGroupNum,
settleGroupNum: groupnum,
amt: 0,
extend1: string.Empty,
extend2: string.Empty
)
);
}
if (mapList.Count > 0)
{
groupList.AddRange(mapList);
}
var innotls = new List<INVOICE_NOT_SETTLE>();
var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum });
foreach (var sitm in sq)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: sitm.GroupNum,
lU: sitm.LU,
lU1: sitm.LU,
extend1: "可结算",
extend2: string.Empty,
qty: sitm.Qty,
p_invbillnum: inv.InvBillNum
));
}
if (innotls.Count > 0)
biglist.Add(itm);
}
else
{
smalllist.Add(itm);
}
}
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 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>();
gener.GenerateInvoices(p_list);
var invList = gener.Invoices;
foreach (var inv in invList)
{
var partlist = inv.Parts;
if (partlist.Count > 0)
{
notDetialList.AddRange(innotls);
}
var query = from itm in partlist
join itm1 in dtos on itm.Id equals itm1.Id
select itm1;
var Dtos = query.ToList();
var detailDtos = Dtos.GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID, p.LU })//明细
.Select(itm => new
{
PartCode = itm.Key.PartCode,
InvGroupNum = itm.Key.InvGroupNum,
LU = itm.Key.LU,
ContactDocID = itm.Key.ContractDocID,
Price = itm.Key.Price,
Amt = Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税前
Tax = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2),//税
TaxAmt = Math.Round(Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2) * 0.13m, 2) + Math.Round(itm.Sum(k => k.Qty) * itm.Key.Price, 2),//税后进
Qty = itm.Sum(k => k.Qty),
BeginDate = itm.Key.BeginDate,
EndDate = itm.Key.EndDate
}).ToList();
#region 发票明细
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in detailDtos)
{
_entityDetailList.Add(
new INVOICE_WAIT_DETAIL(
decimal amt = detailDtos.Sum(k => k.Amt);//金额
decimal txtAmt = detailDtos.Sum(k => k.TaxAmt);//税后金额
decimal realAmt = detailDtos.Sum(k => k.Tax);//税额
var invoicegrup = partlist.Select(p => p.GroupNum);
var mapList = new List<INVOICE_MAP_GROUP>();
foreach (var groupnum in invoicegrup)
{
mapList.Add(new INVOICE_MAP_GROUP(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: inv.InvBillNum,
invGroupNum: p_InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContactDocID,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode: detail.PartCode
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
#endregion
#region 发票
var invbill = new INVOICE_GRP
(
guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
invbillNum: inv.InvBillNum,
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: businessType,
invGroupNum: p_InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
realAmt: realAmt
);
string site = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).FirstOrDefault().Site;
string clientCode = string.Empty;
switch (site)
{
case "1040":
clientCode = "C001";
break;
case "1046":
clientCode = "C171";
break;
default:
clientCode = "C004";
break;
settleGroupNum: groupnum,
amt: 0,
extend1: string.Empty,
extend2: string.Empty
)
);
}
if (mapList.Count > 0)
{
groupList.AddRange(mapList);
}
var innotls = new List<INVOICE_NOT_SETTLE>();
var sq = partlist.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
.Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum });
foreach (var sitm in sq)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: sitm.GroupNum,
lU: sitm.LU,
lU1: sitm.LU,
extend1: "可结算",
extend2: string.Empty,
qty: sitm.Qty,
p_invbillnum: inv.InvBillNum
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
#region 发票明细
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in detailDtos)
{
_entityDetailList.Add(
new INVOICE_WAIT_DETAIL(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: inv.InvBillNum,
invGroupNum: p_InvGroupNum,
lU: detail.LU,
qty: detail.Qty,
bussiessType: businessType,
amt: detail.Amt,
pRICE: detail.Price,
extend1: detail.ContactDocID,
extend2: string.Empty,
beginDate: detail.BeginDate,
endDate: detail.EndDate,
partcode: detail.PartCode
));
}
if (_entityDetailList.Count > 0)
{
detailList.AddRange(_entityDetailList);
}
#endregion
#region 发票
var invbill = new INVOICE_GRP
(
guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
invbillNum: inv.InvBillNum,
amt: amt,
taxAmt: txtAmt,
fileName: string.Empty,
businessType: businessType,
invGroupNum: p_InvGroupNum,
state: SettleBillState.,
invoiceBillState: InvoiceBillState.,
tax: 0.13m,
parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
preTaxDiff: 0,
taxDiff: 0,
clientCode: string.Empty,
realAmt: realAmt
);
string site = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).FirstOrDefault().Site;
string clientCode = string.Empty;
switch (site)
{
case "1040":
clientCode = "C001";
break;
case "1046":
clientCode = "C171";
break;
default:
clientCode = "C004";
break;
}
invbill.ClientCode = clientCode;
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.MinValue;
invbill.LastModificationTime = DateTime.Now;
invlist.Add(invbill);
#endregion
}
invbill.ClientCode = clientCode;
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.MinValue;
invbill.LastModificationTime = DateTime.Now;
invlist.Add(invbill);
#endregion
}
}
smalllist = smalllist.OrderBy(p => p.Amt).ToList();
_invls= GenSecInvoice(smalllist, p_list, p_adjlist, dtos, p_notlist, p_version, p_InvGroupNum, p_parentInvBillNum, businessType);
//smalllist = smalllist.OrderBy(p => p.Amt).ToList();
//var gener1 = new InvoiceGeneratorDiff();
//gener1.GenerateInvoices(smalllist);
//var invList1 = gener1.Invoices;
//foreach (var inv in invList1)//小于1000W的开票
//{
// var partlist = inv.Parts;
// var query = from part in p_list
// join part1 in partlist on
// new { part.InvGroupNum, part.PartCode, part.LU, part.Price } equals new { part1.InvGroupNum, part1.PartCode, part1.LU, part1.Price }
// select part;
// var entityList = query.ToList();
// foreach (var entity in entityList)
// {
// entity.InvbillNum = inv.InvBillNum;
// }
// salist.AddRange(entityList);
// if (partlist.Count > 0)
// {
// decimal amt = partlist.Sum(k => k.Amt);//金额
// decimal txtAmt = partlist.Sum(k => k.TaxAmt);//税后金额
// decimal realAmt = partlist.Sum(k => k.Tax);//税额
// var invoicegroupls = entityList.Select(p => p.GroupNum);
// var mapList = new List<INVOICE_MAP_GROUP>();
// foreach (var groupnum in invoicegroupls)
// {
// mapList.Add(new INVOICE_MAP_GROUP(
// guid: GuidGenerator.Create(),
// version: p_version,
// invbillNum: inv.InvBillNum,
// invGroupNum: p_InvGroupNum,
// settleGroupNum: groupnum,
// amt: 0,
// extend1: string.Empty,
// extend2: string.Empty
// )
// );
// }
// if (mapList.Count > 0)
// {
// groupList.AddRange(mapList);
// }
// var innotls = new List<INVOICE_NOT_SETTLE>();
// var sq = entityList.GroupBy(p => new { p.LU, p.GroupNum, p.InvbillNum })
// .Select(p => new { version = p_version, LU = p.Key.LU, Qty = p.Sum(itm => itm.Qty), InvBillNum = p.Key.InvbillNum, GroupNum = p.Key.GroupNum });
// foreach (var sitm in sq)
// {
// innotls.Add(new INVOICE_NOT_SETTLE(
// guid: GuidGenerator.Create(),
// version: p_version,
// invGroupNum: p_InvGroupNum,
// settleGroupNum: sitm.GroupNum,
// lU: sitm.LU,
// lU1: sitm.LU,
// extend1: "可结算",
// extend2: string.Empty,
// qty: sitm.Qty,
// p_invbillnum: sitm.InvBillNum
// ));
// }
// if (innotls.Count > 0)
// {
// notDetialList.AddRange(innotls);
// }
// List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
// foreach (var detail in partlist)
// {
// _entityDetailList.Add(
// new INVOICE_WAIT_DETAIL(
// guid: GuidGenerator.Create(),
// version: p_version,
// invbillNum: inv.InvBillNum,
// invGroupNum: p_InvGroupNum,
// lU: detail.LU,
// qty: detail.Qty,
// bussiessType: businessType,
// amt: detail.Amt,
// pRICE: detail.Price,
// extend1: detail.ContactDocID,
// extend2: string.Empty,
// beginDate: detail.BeginDate.Value,
// endDate: detail.EndDate.Value,
// partcode: detail.PartCode
// ));
// }
// if (_entityDetailList.Count > 0)
// {
// detailList.AddRange(_entityDetailList);
// }
// var invbill = new INVOICE_GRP
// (
// guid: GuidGenerator.Create(),
// realnvBillNum: string.Empty,
// invbillNum: inv.InvBillNum,
// amt: amt,
// taxAmt: txtAmt,
// fileName: string.Empty,
// businessType: businessType,
// invGroupNum: p_InvGroupNum,
// state: SettleBillState.已开票,
// invoiceBillState: InvoiceBillState.正常,
// tax: 0.13m,
// parent: !string.IsNullOrEmpty(p_parentInvBillNum) ? p_parentInvBillNum : string.Empty,
// preTaxDiff: 0,
// taxDiff: 0,
// clientCode: string.Empty,
// realAmt: realAmt
// );
// string site = dtos.Where(p => !string.IsNullOrEmpty(p.Site)).FirstOrDefault().Site;
// string clientCode = string.Empty;
// switch (site)
// {
// case "1040":
// clientCode = "C001";
// break;
// case "1046":
// clientCode = "C171";
// break;
// default:
// clientCode = "C004";
// break;
// }
// invbill.ClientCode = clientCode;
// invbill.Site = dtos.FirstOrDefault().Site;
// invbill.CreationTime = DateTime.MinValue;
// invbill.LastModificationTime = DateTime.Now;
// invlist.Add(invbill);
// }
//}
//if (salist.Count > 0)
//{
// _dbcontext.BulkUpdate(salist);
// var detailext = salist.GroupBy(p => new { p.InvbillNum, p.InvGroupNum, p.PartCode, p.LU, p.Price, p.ErpLoc, p.BusinessType })
// .Select(p => new INVOICE_DETAIL_EXT
// {
// Version = p_version,
// InvbillNum = p.Key.InvbillNum,
// InvGroupNum = p.Key.InvGroupNum,
// PartCode = p.Key.PartCode,
// PRICE = p.Key.Price,
// ErpLoc = p.Key.ErpLoc,
// Qty = p.Sum(k => k.Qty),
// BussiessType = p.Key.BusinessType,
// Amt = Math.Round(p.Sum(k => k.Qty) * p.Key.Price, 2),//税前
// LU = p.Key.LU
// }
// ).ToList();
// foreach (var itm in detailext)
// {
// itm.SetId(GuidGenerator.Create());
// itm.CreationTime = DateTime.Now;
// }
// _dbcontext.BulkInsert(detailext);
//}
//_dbcontext.BulkInsert(invlist);
//_dbcontext.BulkInsert(groupList);
//_dbcontext.BulkInsert(detailList);
//if (adjlist.Count > 0)
//{
// _dbcontext.BulkInsert(adjlist);
//}
//if (notDetialList.Count > 0)
//{
// _dbcontext.BulkInsert(notDetialList);
//}
//_invls = invlist.Select(p => p.InvbillNum).ToList();
}
smalllist = smalllist.OrderBy(p => p.Amt).ToList();
return _invls;
}
public List<string> GenSecInvoice<TDetail>(List<GroupPartCode> p_grouplist, List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_adjlist, List<TEMP_CAN_SA_DETAIL> dtos, List<TEMP_NOT_SA_DETAIL> p_notlist, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail : SA_CAN_BASE, new()
{
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>();
List<string> _invls = new List<string>();
var gener1 = new InvoiceGeneratorDiff();
gener1.GenerateInvoices(smalllist);
gener1.GenerateInvoices(p_grouplist);
var invList1 = gener1.Invoices;
foreach (var inv in invList1)//小于1000W的开票
{
@ -800,8 +1029,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
entity.InvbillNum = inv.InvBillNum;
}
salist.AddRange(entityList);
if (partlist.Count > 0)
@ -937,7 +1164,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
BussiessType = p.Key.BusinessType,
Amt = Math.Round(p.Sum(k => k.Qty) * p.Key.Price, 2),//税前
LU = p.Key.LU
}
).ToList();
foreach (var itm in detailext)
@ -952,7 +1178,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_dbcontext.BulkInsert(invlist);
_dbcontext.BulkInsert(groupList);
_dbcontext.BulkInsert(detailList);
if (adjlist.Count > 0)
{
_dbcontext.BulkInsert(adjlist);
@ -964,7 +1190,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_invls = invlist.Select(p => p.InvbillNum).ToList();
return _invls;
}
}

20
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -1223,6 +1223,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// <returns></returns>
private async Task<IActionResult> BeginTran<T>(List<T> p_list, List<VmiLog> logList) where T : SE_BASE, new()
{
IServiceCollection Services = new ServiceCollection();
/*
*
*/
Services.GetConfiguration();
Services.GetRequiredService<IConfiguration>();
Services.GetRequiredService<ILoggerFactory>();
//var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
@ -1725,6 +1732,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
reader.Close();
connection.Close();
foreach (var item in ls)
{
if (item.BusinessType == EnumBusinessType.JisBBAC.ToString() || item.BusinessType == EnumBusinessType.JisHBPO.ToString() || item.BusinessType == EnumBusinessType.MaiDanJianHBPO.ToString() || item.BusinessType == EnumBusinessType.MaiDanJianBBAC.ToString())
{
if (!string.IsNullOrEmpty(item.PartCode))
{
item.PartCode = item.LU.Replace(" ", "-");
}
}
}
return ls;
}

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs

@ -158,6 +158,8 @@ namespace SettleAccount.Domain.BQ
public string InvBillNum { set; get; }
public InvoiceByDiff() { }
private List<GroupPartCode> parts = new List<GroupPartCode>();
public IReadOnlyList<GroupPartCode> Parts => parts.AsReadOnly();
public decimal TotalAmount => parts.Sum(p => p.Amt);
public int PartCount => parts.GroupBy(p => new { p.LU, p.PartCode }).Count();
@ -169,7 +171,7 @@ namespace SettleAccount.Domain.BQ
{
if (CanAddPart(part))
{
//partCount.Add(part.PartCode);
parts.Add(part);
}

Loading…
Cancel
Save