Browse Source

未结生成可结算校验等

master
学 赵 1 year ago
parent
commit
9580c044e6
  1. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  2. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  3. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
  4. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_NOT_SA_SERVICE.cs
  5. 31
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  6. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs
  7. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  8. 152
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PUB_NOT_SA_MNG.cs

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

@ -1,6 +1,7 @@
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NetTaste;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
@ -17,6 +18,7 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -49,7 +51,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
await _bbacNotMng.GenerateSettlementOrder(entitys);
var errors=await _bbacNotMng.GenerateSettlementOrder(entitys);
if (errors.Count > 0)
{
List<ERR_EXP_DTO> errorlist = new List<ERR_EXP_DTO>();
foreach (var itm in errors)
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return await ExportErrorReportAsync(errorlist);
}
return ApplicationConsts.SuccessStr;
}

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

@ -2,6 +2,7 @@ using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NetTaste;
using SettleAccount.Domain.BQ;
using System;
using System.Collections.Generic;
@ -17,6 +18,7 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -49,7 +51,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public override async Task<string> GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input)
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
await _hbpoNotMng.GenerateSettlementOrder(entitys);
var errors=await _hbpoNotMng.GenerateSettlementOrder(entitys);
if (errors.Count > 0)
{
List<ERR_EXP_DTO> errorlist = new List<ERR_EXP_DTO>();
foreach (var itm in errors)
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return await ExportErrorReportAsync(errorlist);
}
return ApplicationConsts.SuccessStr;
}

25
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs

@ -126,34 +126,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
if (input.BillNum.Substring(0, 1) == "C")//一次开票
{
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
}
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var strs = await _invmng.BJInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos,new List<TEMP_NOT_SA_DETAIL>(),main.Version, main.InvGroupNum,string.Empty, main.BusinessType);
}
else
{
await FirstInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
}
}
else//二次开票
{
if (main.BusinessType == EnumBusinessType.MaiDanJianHBPO)
{
var strs=await _invmng.MakeInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType, true);
}
if (main.BusinessType == EnumBusinessType.BeiJian)
{
var strs = await _invmng.BJInvoice(entitys, new List<PUB_ADJ_DETAIL>(), dtos, new List<TEMP_NOT_SA_DETAIL>(), main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
}
else
{
await SecInvoice(entitys,new List<PUB_ADJ_DETAIL>(), dtos, main.Version, main.InvGroupNum, string.Empty, main.BusinessType);
}
}
}
}

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

@ -17,6 +17,7 @@ using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -44,7 +45,19 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public override async Task<string> GenerateSettlementOrder(PUB_NOT_SA_DETAIL_REQ_DTO input)
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
_pubNotMng.GenerateSettlementOrder(entitys);
var errors=await _pubNotMng.GenerateSettlementOrder(entitys);
if (errors.Count > 0)
{
List<ERR_EXP_DTO> errorlist= new List<ERR_EXP_DTO>();
foreach (var itm in errors)
{
errorlist.Add(new ERR_EXP_DTO() { Message = itm });
}
return await ExportErrorReportAsync(errorlist);
}
return ApplicationConsts.SuccessStr;
}

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

@ -10,6 +10,7 @@ using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.SettleAccount.Bases;
using EFCore.BulkExtensions;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Bases.DomainServices;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
@ -25,13 +26,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<BBAC_CAN_SA, Guid> _repository;
private readonly INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository;
private readonly BaseDomainService _service;
public BBAC_NOT_SA_MNG()
{
}
public BBAC_NOT_SA_MNG
(
INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository,
BaseDomainService service,
INormalEfCoreRepository<BBAC_CAN_SA, Guid> repository,
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository
)
@ -39,9 +41,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_repository = repository;
_detailRepository = detailRepository;
_notRepository = notRepository;
_service = service;
}
public virtual async Task<bool> GenerateSettlementOrder(List<BBAC_NOT_SA_DETAIL> p_list)
public virtual async Task<List<string>> GenerateSettlementOrder(List<BBAC_NOT_SA_DETAIL> p_list)
{
List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list);
if (priceErrors.Count > 0)
{
foreach (var itm in priceErrors)
{
errors.Add($"发货单号或交付识别号零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
if (errors.Count > 0)
{
return errors;
}
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new BBAC_CAN_SA();
_entity.BillNum = billNumber;
@ -80,7 +103,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _repository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<BBAC_CAN_SA>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
return true;
return errors;
}

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

@ -10,6 +10,7 @@ using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.SettleAccount.Bases;
using EFCore.BulkExtensions;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.Bases.DomainServices;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
@ -27,6 +28,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 BaseDomainService _service;
public HBPO_NOT_SA_MNG()
{
@ -36,16 +38,30 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
(
INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository,
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> notRepository
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> notRepository,
BaseDomainService service
)
{
_repository = repository;
_detailRepository = detailRepository;
_notRepository = notRepository;
_service = service;
}
public virtual async Task<bool> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list)
public virtual async Task<List<string>> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list)
{
List<string> errors = new List<string>();
var priceErrors = await _service.CheckPriceList(p_list);
if (priceErrors.Count > 0)
{
foreach (var itm in priceErrors)
{
errors.Add($"发货单号或交付识别号零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
if (errors.Count > 0)
{
return errors;
}
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new HBPO_CAN_SA();
@ -81,7 +97,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<HBPO_CAN_SA>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
return true;
return errors;
}

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

@ -1866,6 +1866,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return _invls;
}
/// <summary>
/// 重开一次开票
/// </summary>
@ -2205,9 +2209,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return _invls;
}
/// <summary>
/// 重开二次开票
/// </summary>

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

@ -10,6 +10,8 @@ using Win.Sfs.Shared.RepositoryBase;
using Win.Sfs.SettleAccount.Bases;
using EFCore.BulkExtensions;
using SettleAccount.Domain.BQ;
using System.Security.Cryptography;
using Win.Sfs.SettleAccount.Bases.DomainServices;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
@ -27,6 +29,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<PUB_CAN_SA, Guid> _repository;
private readonly INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> _notRepository;
private readonly BaseDomainService _service;
public PUB_NOT_SA_MNG()
{
@ -36,50 +39,129 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
(
INormalEfCoreRepository<PUB_CAN_SA, Guid> repository,
INormalEfCoreRepository<PUB_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> notRepository
INormalEfCoreRepository<PUB_NOT_SA_DETAIL, Guid> notRepository,
BaseDomainService service
)
{
_service = service;
_repository = repository;
_detailRepository = detailRepository;
_notRepository = notRepository;
}
public virtual async Task<bool> GenerateSettlementOrder(List<PUB_NOT_SA_DETAIL> p_list)
public virtual async Task<List<string>> GenerateSettlementOrder(List<PUB_NOT_SA_DETAIL> p_list)
{
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA();
_entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month;
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in p_list)
List<string> errors = new List<string>();
var query = p_list.Select(p => p.BusinessType).Distinct();
foreach (var itm in query.ToList())
{
var _detailEntity = new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: billNumber,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: billNumber,
invbillnum: string.Empty,
partcode:itm.PartCode
);
_entityList.Add(_detailEntity);
errors.Add("选择项有不在同一业务的数据!");
}
if (errors.Count > 0)
{
return errors;
}
var first= p_list.FirstOrDefault();
if (first.BusinessType == EnumBusinessType.ZhiGongJianBBAC || first.BusinessType == EnumBusinessType.ZhiGongJianHBPO
|| first.BusinessType == EnumBusinessType.BeiJian
)
{
var ls = p_list.Select(p => p.GroupNum).Distinct().ToList();
var notlist = _notRepository.Where(p => ls.Contains(p.GroupNum)).ToList();//JIT_ASN整发
var priceErrors = await _service.CheckPriceList(notlist);
if (priceErrors.Count > 0)
{
foreach (var itm in priceErrors)
{
errors.Add($"发货单号或交付识别号零件{itm.LU}结算日期{itm.SettleDate}无价格区间数据");
}
}
if (errors.Count > 0)
{
return errors;
}
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA();
_entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month;
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in notlist)
{
var _detailEntity = new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: billNumber,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: billNumber,
invbillnum: string.Empty,
partcode: itm.PartCode
);
_entityList.Add(_detailEntity);
}
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<PUB_CAN_SA>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
}
else
{
var billNumber = OrderNumberGenerator.GenerateOrderNumber("N");
var _entity = new PUB_CAN_SA();
_entity.BillNum = billNumber;
_entity.InvGroupNum = billNumber;
_entity.Version = DateTime.Now.Year + DateTime.Now.Month;
_entity.State = SettleBillState.;
_entity.SettleBillNum = string.Empty;
var _entityList = new List<PUB_CAN_SA_DETAIL>();
foreach (var itm in p_list)
{
var _detailEntity = new PUB_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm.KeyCode,
version: itm.Version,
billNum: billNumber,
settleBillNum: itm.SettleBillNum,
lU: itm.LU,
pN: itm.PN,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
businessType: itm.BusinessType,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
invGroupNum: billNumber,
invbillnum: string.Empty,
partcode: itm.PartCode
);
_entityList.Add(_detailEntity);
}
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<PUB_CAN_SA>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
}
await _notRepository.DbContext.BulkDeleteAsync(p_list);
await _repository.DbContext.BulkInsertAsync(new List<PUB_CAN_SA>() { _entity });
await _repository.DbContext.BulkInsertAsync(_entityList);
return true;
return errors;
}

Loading…
Cancel
Save