Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
6b17ed081d
  1. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  2. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  3. 104
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  4. 34
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

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

@ -328,7 +328,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
.Select(p => new UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) });
entity.UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList();
}
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC)
{
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
}
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
entity.INVOICE_MAP_GROUP = mdtos;
}
entity.ADJ_DETAIL = adjQuery.ToList().OrderBy(p=>p.GroupNum).ThenBy(p=>p.LU).ToList();
return entity;
}
@ -420,6 +429,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
_excel.Append(unsettle, "未结零件结算汇总");
}
if (first.BusinessType == EnumBusinessType.JisHBPO)
{
_excel.Append(unsettle, "未结零件列表");
}
foreach (var itm in entities)

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs

@ -571,7 +571,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//}
var dto1s = ObjectMapper.Map<List<PUB_CAN_SA_DETAIL>, List<PUB_CAN_SA_DETAIL_DTO>>(entitys);
var q = from d in dto1s
join p in priceList on d.PartCode equals p.LU
join p in priceList on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == inv.Site//客户零件号
select new TEMP_CAN_SA_DETAIL
{

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

@ -1,6 +1,7 @@
using EFCore.BulkExtensions;
using EmptyFiles;
using Hangfire;
using Hangfire.Storage.Monitoring;
using Microsoft.AspNetCore.Razor.Language.Intermediate;
using Microsoft.AspNetCore.SignalR;
using Microsoft.CodeAnalysis.CSharp.Syntax;
@ -43,6 +44,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _nothbpoRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
@ -66,7 +68,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
INormalEfCoreRepository<CodeSetting, Guid> codesetRepository
INormalEfCoreRepository<CodeSetting, Guid> codesetRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> nothbpoRepository
)
{
@ -83,6 +86,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_pdhbpoRepository=pdhbpoRepository;
_pdpubRepository =pdpubRepository;
_codesetRepository = codesetRepository;
_nothbpoRepository = nothbpoRepository;
}
public INV_MNG()
@ -564,7 +568,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
version: itm.Version,
billNum: itm.InvbillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
@ -579,9 +582,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
extend3: string.Empty,
extend4: itm.PartCode,
p_businessType:itm.BusinessType
);//厂内实际零件号
detail.RELU = string.IsNullOrEmpty(itm.RealPartCode) ? itm.PartCode : itm.RealPartCode;//厂内替换零件号
detail.Extend2 = itm.ErpLoc;//ERP库位
bbacDetail.Add(detail);
@ -942,7 +943,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
await _bbacMng.SetNewState(groupbillNum);
}
else if (first.BusinessType == EnumBusinessType.JisHBPO)
else if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType==EnumBusinessType.JisHBPO)
{
await _hbpoMng.SetNewState(groupbillNum);
}
@ -962,38 +963,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return true;
}
//public INVOICE_GRP FindAncestor(List<INVOICE_GRP> p_list,INVOICE_GRP currentNode, string invbillNum)
//{
// if (currentNode == null || currentNode.InvbillNum == invbillNum)
// {
// return currentNode;
// }
// var parentNode=p_list.Where(p => p.InvbillNum == currentNode.InvbillNum).FirstOrDefault();
// return FindAncestor(p_list, parentNode, invbillNum);
//}
//public virtual async Task<bool> IsSplittingMultipleInvoices(List<string> invs, string p_invbillnum)
//{
// _repository.Where(p=>)
//}
/// <summary>
/// 返回到财务审核状态
/// </summary>
@ -1690,7 +1659,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
var key = group.Key;//发票票号
var ls = group.Value;//发票明细
//更新结算记录更新
var query = from itm in dtos
join itm1 in ls
@ -1716,6 +1684,57 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
adjlist.Add(itm);
}
}
if (p_first == true)//第一次开票需要有分组号
{
var mapList = new List<INVOICE_MAP_GROUP>();
var invoiceGroupList = query.GroupBy(p => new { p.GroupNum, p.PN }).Select(p => p.FirstOrDefault()).ToList();
foreach (var groupnum in invoiceGroupList)//一次开票可结
{
mapList.Add(new INVOICE_MAP_GROUP(
guid: GuidGenerator.Create(),
version: p_version,
invbillNum: key,
invGroupNum: p_InvGroupNum,
settleGroupNum: groupnum.GroupNum,
amt: 0,
extend1: groupnum.PN,
extend2: string.Empty
)
);
}
if (mapList.Count > 0)
{
groupList.AddRange(mapList);
}
var notsettle= _nothbpoRepository.Where(p => p.SettleBillNum == p_InvGroupNum);//一次开票时查找不可结数据,追加需求
if (notsettle != null && notsettle.Count() > 0)
{
var innotls = new List<INVOICE_NOT_SETTLE>();
foreach (var nitm in notsettle)
{
innotls.Add(new INVOICE_NOT_SETTLE(
guid: GuidGenerator.Create(),
version: p_version,
invGroupNum: p_InvGroupNum,
settleGroupNum: nitm.GroupNum,
lU: nitm.LU,
lU1: nitm.LU,
extend1: "不可结算",
extend2: string.Empty,
qty: nitm.Qty,
p_invbillnum: string.Empty
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
}
//invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
foreach (var detail in ls)
{
@ -1744,8 +1763,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
decimal amt = detailList.Sum(k => k.Amt);//金额
decimal txtAmt = detailList.Sum(k => k.Amt) + Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税后金额
decimal realAmt = Math.Round(detailList.Sum(k => k.Amt) * 0.13m, 2);//税额
var invbill = new INVOICE_GRP
(guid: GuidGenerator.Create(),
realnvBillNum: string.Empty,
@ -1763,14 +1780,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
taxDiff: 0,
clientCode: "C004",
realAmt: realAmt
);
invbill.Site = dtos.FirstOrDefault().Site;
invbill.CreationTime = DateTime.Now;
invlist.Add(invbill);
}
await _repository.DbContext.BulkInsertAsync(invlist);
//await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(groupList);
await _repository.DbContext.BulkInsertAsync(detailList);
if (salist.Count > 0)
{
@ -1780,7 +1796,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
await _repository.DbContext.BulkUpdateAsync(adjlist);
}
//await _repository.DbContext.BulkInsertAsync(notDetialList);
await _repository.DbContext.BulkInsertAsync(notDetialList);
_invls = invlist.Select(p => p.InvbillNum).ToList();
}
return _invls;
@ -1820,7 +1836,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("CINV");
}
List<string> invoiceGroupNumList = new List<string>();//每个发票对应的结算分组号
List<string> List = new List<string>();
decimal sum = itm.Value;//初始分组合计金额
@ -1857,7 +1872,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
if (invoiceMap.Keys.Count > 0)
{
var groupList = new List<INVOICE_MAP_GROUP>();
var notDetialList = new List<INVOICE_NOT_SETTLE>();
var detailList = new List<INVOICE_WAIT_DETAIL>();

34
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

@ -655,7 +655,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var notDetialList = new List<INVOICE_NOT_SETTLE>();
var invlist = new List<INVOICE_GRP>();
var salist = new List<TDetail>();
//var salist = new List<TDetail>();
var adjlist = new List<PUB_ADJ_DETAIL>();
foreach (var itm in invoiceMap)//分组影响和
@ -663,22 +663,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var key = itm.Key;//发票票号
var ls = itm.Value;//结算分组号列表
//反向查找结算数据
var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in invdetails)
{
detail.InvbillNum = key;
salist.Add(detail);
}
if (!string.IsNullOrEmpty(p_parentInvBillNum))
{
//反向查找调整数据
var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
foreach (var detail in adjdetails)
{
detail.InvBillNum = key;
}
}
//var invdetails = p_list.Where(p => ls.Contains(p.GroupNum)).ToList();
//foreach (var detail in invdetails)
//{
// detail.InvbillNum = key;
// salist.Add(detail);
//}
//if (!string.IsNullOrEmpty(p_parentInvBillNum))
//{
// //反向查找调整数据
// var adjdetails = p_adjlist.Where(p => ls.Contains(p.GroupNum)).ToList();
// foreach (var detail in adjdetails)
// {
// detail.InvBillNum = key;
// adjlist.Add(detail);
// }
//}
var detailDtos = dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p => new { p.InvGroupNum, p.PartCode, p.Price, p.BeginDate, p.EndDate, p.ContractDocID,p.LU })
.Select(itm => new
{

Loading…
Cancel
Save