Browse Source

修改作废发票业务逻辑

master
学 赵 1 year ago
parent
commit
ded15fbd17
  1. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  2. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  5. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs

9
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -89,9 +89,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum).ConfigureAwait(false);
var settle = await _bbacMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false);
if (settle == null)
{
throw new UserFriendlyException($"选择发票:{p_invbillnum}对应的可结算单不在请检查!", "400");
@ -269,7 +266,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
isReturn: itm.Qty > 0 ? false : true,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invGroupNum: inv.InvGroupNum,
contactid: itm.Extend1,//生产号
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
@ -388,7 +385,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList=await CheckAdJRules(adjlist, relist.ToList(),inv.BusinessType);
@ -526,7 +523,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _bbacMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs

@ -212,7 +212,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
// var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errors = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errors.Count > 0)
@ -235,7 +235,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
@ -344,7 +344,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _hbpoMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
foreach (var itm in adjlist)
{
@ -491,7 +491,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());

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

@ -99,7 +99,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
@ -125,7 +125,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invGroupNum: inv.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
@ -372,7 +372,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault());
var errorList = await CheckAdJRules(adjlist, relist.ToList(), inv.BusinessType);
if (errorList.Count > 0)
@ -543,7 +543,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var bbaclist = await _pubMng.GetContainsAsync(inv.InvbillNum).ConfigureAwait(false);//结算分组对应结算零件 //var adjlist = await _adjRepository.Where(p => p.OldInvBillNum == inv.InvbillNum).ToListAsync();//调整表明细
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType).ToList();
var relist = relationList.GroupBy(p => new { p.SettleMaterialCode, p.ErpMaterialCode }).Select(p => p.FirstOrDefault()).ToList();

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

@ -945,7 +945,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
/// <param name="p_version">版本号</param>
/// <param name="p_InvGroupNum">发票分组</param>
/// <param name="p_parentInvBillNum">原发票号</param>
[UnitOfWork(IsDisabled = false)]
[UnitOfWork(false)]
public async Task<List<string>> SecInvoice<TDetail>(List<TDetail> p_list, List<PUB_ADJ_DETAIL> p_ajdlist, List<TEMP_CAN_SA_DETAIL> dtos, int p_version, string p_InvGroupNum, string p_parentInvBillNum, EnumBusinessType businessType)
where TDetail : SA_CAN_BASE
{

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

@ -467,7 +467,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
var groupList = new List<INVOICE_MAP_GROUP>();
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 group in invoiceMap)
{
@ -479,11 +479,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
on new { LU = itm.PartCode, itm.BeginDate, itm.EndDate } equals new { itm1.LU, itm1.BeginDate, itm1.EndDate }
join itm2 in details on new { itm.LU, itm.PartCode, itm.PN, itm.SettleDate } equals new { itm2.LU, itm2.PartCode, itm2.PN, itm2.SettleDate }
select itm2;
foreach (var itm in query)
{
itm.InvbillNum = key;
salist.Add(itm);
}
//foreach (var itm in query)
//{
// itm.InvbillNum = key;
// salist.Add(itm);
//}
if (!string.IsNullOrEmpty(p_parentInvBillNum))//发票作废开票
{
var query1 = from itm in dtos

Loading…
Cancel
Save