Browse Source

更新版本

master
学 赵 1 year ago
parent
commit
b994ce6aaf
  1. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  2. 88
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
  3. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  4. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  5. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  6. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  7. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  8. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
  9. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  10. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  11. 47
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  12. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG_EXT.cs
  13. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

4
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -167,7 +167,7 @@ namespace Win.Sfs.SettleAccount.Bases
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, false).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, false).ConfigureAwait(false);//重开可以变多张发票
invlist = await _invmng.SecInvoice(p_list, p_adjlist, dtos, p_version, p_InvGroupNum, string.Empty, businessType).ConfigureAwait(false);
break;
case EnumBusinessType.BeiJian:
invlist = await _invmng.BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, p_InvGroupNum, string.Empty, businessType, false).ConfigureAwait(false);
@ -216,7 +216,7 @@ namespace Win.Sfs.SettleAccount.Bases
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, p_notlist, p_version, p_invGroupNum, string.Empty, businessType, true).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await _invmng.JITInvoice(p_list, p_adjlist, dtos, p_notlist, p_version, p_invGroupNum, string.Empty, businessType, true).ConfigureAwait(false);//重开可以变多张发票
invlist = await _invmng.FirstInvoice(p_list, p_adjlist, dtos, p_notlist, p_version, p_invGroupNum, string.Empty, businessType).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await _invmng.BJInvoice(p_list, p_adjlist, dtos, p_notlist, p_version, p_invGroupNum, string.Empty, businessType, true).ConfigureAwait(false);

88
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using Magicodes.ExporterAndImporter.Core;
@ -12,7 +13,10 @@ using Shouldly;
using Volo.Abp.Application.Dtos;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases
@ -24,15 +28,18 @@ namespace Win.Sfs.SettleAccount.Bases
where TEntityDetailExportDto : class, new()
{
protected readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly BaseDomainService _baseservice;
protected NOT_SA_SERVICE(
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository,
BaseDomainService baseservice
)
: base(excelImportService, snowflakeIdGenerator, commonManager)
{
_baseservice = baseservice;
_detailRepository = detailRepository;
}
@ -99,6 +106,85 @@ namespace Win.Sfs.SettleAccount.Bases
return new JsonResult(new { Code = 200, Message = "生成成功" });
}
/// <summary>
/// 校验规则
/// </summary>
/// <param name="dto1s"></param>
/// <param name="p_pricelist"></param>
/// <returns></returns>
protected async Task<List<ERR_EXP_DTO>> CheckInvoiceGenerationRules<T>(List<T> dto1s, string p_site, List<PriceList> p_pricelist, EnumBusinessType p_businessType) where T : SA_CAN_BASE
{
//var maxDate = p_pricelist.Max(p => p.Date);
var first = dto1s.FirstOrDefault();
var usepriceList = p_pricelist.Where(p => p.ClientCode == first.Site && p.IsCancel == false).ToList();
var errorlist = _baseservice.CheckPriceListContinuity(usepriceList);
var prices = p_pricelist.Where(p => p.ClientCode == p_site && p.IsCancel == false).ToList();
var inner = from d in dto1s
join p in prices on d.LU equals p.LU
where
d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.ClientCode == d.Site && p.IsCancel == false
select d;
var ls = inner.ToList();
var left = from d in dto1s
join p in inner on new { d.LU, d.PN } equals new { p.LU, p.PN }
into temp
from tm in temp.DefaultIfEmpty()//校验错误项
where tm == null
select d;
List<ERR_EXP_DTO> errorList = new List<ERR_EXP_DTO>();
string name = string.Empty;
string keyname = string.Empty;
switch (p_businessType)
{
case EnumBusinessType.MaiDanJianHBPO:
name = "HBPO买单件";
keyname = "生产码";
break;
case EnumBusinessType.ZhiGongJianHBPO:
name = "HBPO直供件";
keyname = "发货单号";
break;
case EnumBusinessType.ZhiGongJianBBAC:
name = "BBAC直供件";
keyname = "发货单号";
break;
case EnumBusinessType.YinDuJian:
name = "HBPO印度件";
keyname = "发货单号";
break;
case EnumBusinessType.JisBBAC:
name = "BBAC-JIS";
keyname = "生产码";
break;
case EnumBusinessType.JisHBPO:
name = "HBPO-JIS";
keyname = "生产码";
break;
case EnumBusinessType.BeiJian:
name = "备件";
keyname = "交付识别号";
break;
}
foreach (var error in errorlist)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU},价格表开始日期:{error.BeginTime}价格表结束日期:{error.EndTime}在用价格时间段有交集或价格时间不连续!" });
}
foreach (var error in left)
{
errorList.Add(new ERR_EXP_DTO() { ItemCode = error.LU, CustomCode = $"{name}", Message = $"LU:{error.LU}{keyname}:{error.PN},下线日期:{error.SettleDate}没有对应区间销售价格表!" });
}
return errorList;
}
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs

@ -7,6 +7,7 @@ using SettleAccount.Domain.BQ;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@ -31,8 +32,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
private readonly BBAC_NOT_SA_MNG _bbacNotMng;
public BBAC_NOT_SA_SERVICE(IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager, INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> detailRepository, BBAC_NOT_SA_MNG bbacNotMng) :
base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository)
ICommonManager commonManager, INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> detailRepository, BBAC_NOT_SA_MNG bbacNotMng, BaseDomainService baseservice) :
base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository,baseservice)
{
_bbacNotMng = bbacNotMng;
}
@ -47,6 +48,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
else
{
var errors = await _bbacNotMng.GenerateSettlementOrder(entitys).ConfigureAwait(false);
if (errors.Count > 0)
{

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

@ -60,6 +60,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
//var gList = mappingList.Select(p => p.SettleGroupNum).ToList();//获取发票所有结算分组
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum).ConfigureAwait(false);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false);
if (settle == null)
@ -218,7 +219,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
hbpolist.Add(new HBPO_CAN_SA_DETAIL(
@ -323,9 +323,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
var first = p_list.FirstOrDefault();
var invbillnum = first.InvBillNum;
var version = int.Parse(DateTime.Now.ToString("yyyymm"));
var inv = await GetInvoiceGroupByInvBillNum(invbillnum).ConfigureAwait(false);
var settle = await _hbpoMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false);
if (settle == null)
@ -365,16 +363,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode
));
}
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();//
var priceList = _priceRepository.ToList();
//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
//{

5
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs

@ -7,6 +7,7 @@ using SettleAccount.Domain.BQ;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@ -34,8 +35,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> detailRepository,
HBPO_NOT_SA_MNG hbpoNotMng
) : base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository)
HBPO_NOT_SA_MNG hbpoNotMng, BaseDomainService baseservice
) : base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository,baseservice)
{
_hbpoNotMng = hbpoNotMng;
}

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

@ -364,11 +364,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
.Select(p => new JIT_UNSETTLED_DETAIL_DTO { LU = p.Key.LU, GroupNum = p.Key.SettleGroupNum, Qty = p.Sum(itm => itm.Qty.Value) });
entity.JIT_UNSETTLED_DETAIL = unsettledList.ToList().OrderBy(p => p.GroupNum).ThenBy(p => p.LU).ToList();
}
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC)
if (first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO)
{
entity.INVOICE_MAP_GROUP = lscompare.ToList().OrderBy(p => p.SettleGroupNum).ToList();//包含不可结结算分组号
}
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO)
if (first.BusinessType == EnumBusinessType.MaiDanJianHBPO )
{
//List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO> maidan = new List<MAIDAN_HBPO_INVOICE_MAP_GROUP_DTO>();
@ -482,7 +482,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
#endregion
// 发票分组
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO)
{
if (m != null)
{
@ -512,7 +512,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
}
//jis业务,发票分组对应关系,未结数据,调整数据
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO)
if (first.BusinessType == EnumBusinessType.JisBBAC || first.BusinessType == EnumBusinessType.JisHBPO || first.BusinessType==EnumBusinessType.ZhiGongJianHBPO)
{
foreach (var itm in entities)
{

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

@ -220,8 +220,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var inv = await GetInvoiceGroupByInvBillNum(p_invbillnum).ConfigureAwait(false);
var settle = await _pubMng.GetMainAsync(inv.InvGroupNum).ConfigureAwait(false);
if (settle == null)
{
throw new BusinessException("8989", $"选择发票:{p_invbillnum}对应的可结算单不在请检查!");
@ -359,6 +357,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
throw new UserFriendlyException($"选择发票:{invbillnum}对应的可结算单不在请检查!", "400");
}
version = settle.Version;
if (inv != null)
{
if (inv.InvoiceState == InvoiceBillState.)
@ -374,15 +373,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
if (adjlist != null && adjlist.Count > 0)
{
var relationList = _relationRepository.Where(p => p.BusinessType == inv.BusinessType);
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)
{
return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorList).ConfigureAwait(false) });
}
foreach (var itm in adjlist)
{
bbaclist.Add(new PUB_CAN_SA_DETAIL(
@ -397,11 +393,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: itm.InvGroupNum,
invbillnum: string.Empty,
partcode: relist.FirstOrDefault(p => p.SettleMaterialCode == itm.LU).ErpMaterialCode,
pobillnum: string.Empty
@ -410,7 +404,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
var entitys = bbaclist;//合并库存调整单和就发票可结算明细数据
var gNumList = entitys.Select(p => p.GroupNum).Distinct().ToList();
var priceList = _priceRepository.ToList();//价格单
//var errorList = await CheckInvoiceGenerationRules(entitys, priceList, inv.BusinessType);
//if (errorList.Count() > 0)
@ -491,7 +484,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
invBill.RealAmt = realamt;
invBilllist.Add(invBill);
}
}
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs

@ -7,6 +7,7 @@ using SettleAccount.Domain.BQ;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
@ -29,8 +30,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> detailRepository,
PUB_NOT_SA_MNG pubNotMng
) : base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository)
PUB_NOT_SA_MNG pubNotMng,
BaseDomainService baseservice
) : base(excelImportService, snowflakeIdGenerator, commonManager, detailRepository,baseservice)
{
_pubNotMng = pubNotMng;

30
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs

@ -57,8 +57,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
errors.Add($"生产号{itm.PN}零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
if (errors.Count > 0)
{
return errors;
@ -74,7 +72,33 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.Site = first.Site;
_entity.BusinessType = EnumBusinessType.JisBBAC;
var _entityList = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm in p_list)
var site = first.Site;
var pricelist = _priceRepository.Where(p => p.ClientCode == site && p.IsCancel == false).ToList();
var query = from d in p_list
join p in pricelist
on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == first.Site
select new BBAC_CAN_SA_DETAIL()
{
ContractDocID = d.ContractDocID,
IsMaiDan=d.IsMaiDan,
Version=d.Version,
KeyCode=d.KeyCode,
Site = site,
BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc,
CreationTime = d.CreationTime,
GroupNum = d.GroupNum,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
PN = d.PN,
SettleBillNum = d.SettleBillNum,
Price = p.Price,
SettleDate = d.SettleDate,
RealPartCode = d.RealPartCode,
Qty = d.Qty
};
foreach (var itm in query.ToList())
{
var _detailEntity = new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),

30
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

@ -1,12 +1,14 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using SettleAccount.Domain.BQ;
using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
@ -25,6 +27,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<HBPO_CAN_SA, Guid> _repository;
private readonly INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly BaseDomainService _service;
public HBPO_NOT_SA_MNG()
{
@ -78,7 +81,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.SetId(Guid.NewGuid());
_entity.Site = first.Site;
var _entityList = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm in p_list)
var site= first.Site;
var pricelist=_priceRepository.Where(p => p.ClientCode == site && p.IsCancel == false).ToList();
var query = from d in p_list
join p in pricelist
on d.LU equals p.LU
where d.SettleDate >= p.BeginTime && d.SettleDate <= p.EndTime && p.IsCancel == false && p.ClientCode == first.Site
select new HBPO_NOT_SA_DETAIL()
{
Site = site,
BusinessType = d.BusinessType,
ErpLoc = d.ErpLoc,
CreationTime = d.CreationTime,
GroupNum = d.GroupNum,
InvGroupNum = d.InvGroupNum,
LU = d.LU,
PN = d.PN,
SettleBillNum = d.SettleBillNum,
Price = p.Price,
SettleDate = d.SettleDate,
RealPartCode = d.RealPartCode,
Qty = d.Qty
};
foreach (var itm in query.ToList())
{
var _detailEntity = new HBPO_CAN_SA_DETAIL(
GuidGenerator.Create(),

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

@ -27,6 +27,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _nothbpoRepository;
private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _notpubRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> _adjRepository;
protected readonly INormalEfCoreRepository<CodeSetting, Guid> _codesetRepository;
@ -50,7 +53,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> notRepository,
INormalEfCoreRepository<PUB_ADJ_DETAIL, Guid> adjRepository,
INormalEfCoreRepository<CodeSetting, Guid> codesetRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> nothbpoRepository
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> nothbpoRepository,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> notpubRepository
)
{
@ -68,6 +72,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_pdpubRepository = pdpubRepository;
_codesetRepository = codesetRepository;
_nothbpoRepository = nothbpoRepository;
_notpubRepository = notpubRepository;
}
public INV_MNG()
@ -1613,9 +1618,44 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
if (p_first == true)
{
var settleBillnum = string.Empty;
if (businessType == EnumBusinessType.ZhiGongJianHBPO)
{
var mng = await _pubMng.GetMainAsync(p_InvGroupNum);
settleBillnum=mng.SettleBillNum;
var notsettle = _nothbpoRepository.Where(p => p.SettleBillNum == settleBillnum);//一次开票时查找不可结数据,追加需求
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: nitm.PN,
extend2: string.Empty,
qty: nitm.Qty,
p_invbillnum: string.Empty
));
}
if (innotls.Count > 0)
{
notDetialList.AddRange(innotls);
}
}
}
else
{
var mng = await _hbpoMng.GetMainAsync(p_InvGroupNum);
var notsettle = _nothbpoRepository.Where(p => p.SettleBillNum == mng.SettleBillNum);//一次开票时查找不可结数据,追加需求
settleBillnum = mng.SettleBillNum;
var notsettle = _notpubRepository.Where(p => p.SettleBillNum == settleBillnum);//一次开票时查找不可结数据,追加需求
if (notsettle != null && notsettle.Count() > 0)
{
var innotls = new List<INVOICE_NOT_SETTLE>();
@ -1640,6 +1680,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
}
}
}
//invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
}
List<INVOICE_WAIT_DETAIL> _entityDetailList = new List<INVOICE_WAIT_DETAIL>();
@ -2012,7 +2053,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await JITInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);//重开可以变多张发票
invlist = await FirstInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await BJInvoice(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);

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

@ -803,7 +803,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.ZhiGongJianHBPO:
invlist = await JITInvoiceExtend(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);//重开可以变多张发票
invlist = await MakeInvoiceExtend(p_list, p_adjlist, dtos, p_version, inv.InvGroupNum, string.Empty, inv.BusinessType, true).ConfigureAwait(false);//重开可以变多张发票
break;
case EnumBusinessType.BeiJian:
invlist = await BJInvoiceExtend(p_list, p_adjlist, dtos, new List<TEMP_NOT_SA_DETAIL>(), p_version, inv.InvGroupNum, inv.InvbillNum, inv.BusinessType, true).ConfigureAwait(false);

16
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

@ -46,6 +46,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
public virtual async Task<List<string>> GenerateSettlementOrder(List<PUB_NOT_SA_DETAIL> p_list)
{
var first= p_list.FirstOrDefault();
List<string> errors = new List<string>();
var query = p_list.Select(p => p.BusinessType).Distinct().ToList();
if (query.Count > 1)
@ -60,8 +66,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
}
var first = p_list.FirstOrDefault();
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC
|| first.BusinessType == EnumBusinessType.BeiJian || first.BusinessType == EnumBusinessType.YinDuJian
)
{
@ -124,15 +130,16 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
);
_detailEntity.IndexNum = itm.IndexNum;
_detailEntity.RealPartCode = itm.RealPartCode;
_entityList.Add(_detailEntity);
}
await _repository.DbContext.BulkDeleteAsync(p_list).ConfigureAwait(false);
await _repository.DbContext.BulkInsertAsync(new List<PUB_CAN_SA>() { _entity }).ConfigureAwait(false);
await _repository.DbContext.BulkInsertAsync(_entityList).ConfigureAwait(false);
}
else
{
var _first=p_list.FirstOrDefault();
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA();
_entity.SetId(Guid.NewGuid());
@ -141,6 +148,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_entity.Version = int.Parse(DateTime.Now.ToString("yyyymm"));
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
_entity.BusinessType=_first.BusinessType;
_entity.Site = _first.Site;
var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in p_list)
{

Loading…
Cancel
Save