Browse Source

更新版本

master
zhaoxinyu 10 months ago
parent
commit
b08f7f3c9a
  1. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  2. 149
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  4. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/BBAC_NOT_SA_MNG.cs
  5. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/HBPO_NOT_SA_MNG.cs

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

@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Shouldly;
using TaskJob.EventArgs;
using Volo.Abp;
using Volo.Abp.Data;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
@ -136,14 +137,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
var filters= JsonSerializer.Serialize(input.Filters);
var flag = await _hbpoNotMng.IsCompleted().ConfigureAwait(false);
if (flag == false)
{
throw new UserFriendlyException("任务生成中请等待...", "400");
}
else
{
var filters = JsonSerializer.Serialize(input.Filters);
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters });
customConditionList.Add(new CustomCondition() { Name = "businesstype", Value = EnumBusinessType.JisHBPO.ToString() });
var _taskid = await _service.ExportEnqueueAsync($"{EnumBusinessType.JisHBPO.ToString()}生成可结算单任务", ExportExtentsion.Excel, DateTime.Now.ToString("yyyyMM"), string.Empty, CurrentUser, typeof(MakeCanSettlementService), customConditionList, (rs) =>
{}).ConfigureAwait(false);
{ }).ConfigureAwait(false);
return new JsonResult(new { Code = 200, Message = "生成成功" });
}
}
}
}

149
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MakeCanSettlementService.cs

@ -7,6 +7,7 @@ using System.Text.Json;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography;
using EFCore.BulkExtensions;
using LinqToDB;
using Minio.DataModel;
using SettleAccount.Domain.BQ;
using TaskJob.EventArgs;
@ -18,6 +19,7 @@ using Volo.Abp.Domain.Entities;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.Filter;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
@ -50,15 +52,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbacquery = bbacquery.Where(filers.ToLambda<BBAC_NOT_SA_DETAIL>());
}
var p_list = bbacquery.ToList();
if (p_list.Count == 0)
{
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
{
flag.IsReturn = false;
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
}
var jis1 = p_list.Where(p => p.Site == "1040").ToList();
var jis2 = p_list.Where(p => p.Site == "1046").ToList();
List<BBAC_NOT_SA_DETAIL> notlist = new List<BBAC_NOT_SA_DETAIL>();
@ -112,6 +107,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
List<BBAC_CAN_SA_DETAIL> details = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm1 in ls)
{
sum += (itm1.Qty * itm1.Price);
if (sum > 10000000)
{
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
@ -156,7 +152,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
);
_detailEntity.RealPartCode = itm1.RealPartCode;
details.Add(_detailEntity);
sum += (itm1.Qty * itm1.Price);
}
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new BBAC_CAN_SA();
@ -171,9 +167,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
billList.Add(bbac_sa1);
foreach (var detail in details)
{
detail.SetBillNum(billNum1);
detail.SetGroupNum(billNum1);
billDetails.Add(detail);
}
}
}
if (part_group_small.Count > 0)
@ -263,7 +260,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{
foreach (var itm in part_group_big)
{
var ls= bbac_can_list.Where(p=>p.LU==itm.LU).ToList();
var ls = bbac_can_list.Where(p => p.LU == itm.LU).ToList();
decimal sum = 0;
List<BBAC_CAN_SA_DETAIL> details = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm1 in ls)
{
sum += (itm1.Qty * itm1.Price);
if (sum > 10000000)
{
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa = new BBAC_CAN_SA();
bbac_sa.SetId(Guid.NewGuid());
@ -275,13 +279,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbac_sa.Site = "1046";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls)
foreach (var itm2 in details)
{
itm2.SetBillNum(billNum);
itm2.SetGroupNum(billNum);
billDetails.Add(itm2);
}
details = new List<BBAC_CAN_SA_DETAIL>();
sum = 0;
}
var _detailEntity = new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode,
version: itm1.Version,
billNum: billNum,
billNum: string.Empty,
settleBillNum: itm1.SettleBillNum,
lU: itm1.LU,
pN: itm1.PN,
@ -292,13 +303,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
isReturn: itm1.IsReturn,
settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum,
invGroupNum: billNum,
invGroupNum: string.Empty,
contactid: itm1.ContractDocID,
invbillnum: string.Empty,
partcode: itm1.PartCode
);
_detailEntity.RealPartCode = itm1.RealPartCode;
billDetails.Add(_detailEntity);
details.Add(_detailEntity);
}
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new BBAC_CAN_SA();
bbac_sa1.SetId(Guid.NewGuid());
bbac_sa1.BillNum = billNum1;
bbac_sa1.InvGroupNum = billNum1;
bbac_sa1.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa1.State = SettleBillState.;
bbac_sa1.SettleBillNum = string.Empty;
bbac_sa1.Site = "1046";
bbac_sa1.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa1);
foreach (var detail in details)
{
detail.SetBillNum(billNum1);
detail.SetGroupNum(billNum1);
billDetails.Add(detail);
}
}
}
@ -356,12 +385,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_dbcontext.BulkInsert(billDetails);//插入可结主表
_dbcontext.BulkInsert(billList);//插入可结明细
}
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "BBAC_NOT" && p.Value=="True").ToList();
if (ls.Any())
{
flag.IsReturn = false;
_dbcontext.BulkDelete(ls);
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
transaction.Commit();
}
catch (Exception)
@ -393,12 +421,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
else
{
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "BBAC_NOT" && p.Value == "True").ToList();
if (ls.Any())
{
flag.IsReturn = false;
_dbcontext.BulkDelete(ls);
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
}
}
if (businesstype == "JisHBPO" || businesstype== "MaiDanJianHBPO")
@ -412,15 +439,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbacquery = bbacquery.Where(filers.ToLambda<HBPO_NOT_SA_DETAIL>());
}
var p_list = bbacquery.ToList();
if (p_list.Count == 0)
{
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
{
flag.IsReturn = false;
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
}
var jis1 = p_list.Where(p => p.Site == "104T").ToList();
if (jis1.Count > 0)
{
@ -462,13 +480,17 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
var part_group_small = t1.Where(p => p.Amt < 10000000).ToList();
if (part_group_big.Count > 0)
{
foreach (var itm in part_group_big)
{
var ls = hbpo_can_list.Where(p => p.LU == itm.LU).ToList();
decimal sum = 0;
List<HBPO_CAN_SA_DETAIL> details = new List<HBPO_CAN_SA_DETAIL>();
foreach (var itm1 in ls)
{
sum += (itm1.Qty * itm1.Price);
if (sum > 10000000)
{
var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa = new HBPO_CAN_SA();
bbac_sa.SetId(Guid.NewGuid());
@ -477,16 +499,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "104T";
bbac_sa.Site = "1046";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls)
foreach (var itm2 in details)
{
itm2.SetBillNum(billNum);
itm2.SetGroupNum(billNum);
billDetails.Add(itm2);
}
details = new List<HBPO_CAN_SA_DETAIL>();
sum = 0;
}
var _detailEntity = new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode,
version: itm1.Version,
billNum: billNum,
billNum: string.Empty,
settleBillNum: itm1.SettleBillNum,
lU: itm1.LU,
pN: itm1.PN,
@ -496,12 +525,29 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
businessType: itm1.BusinessType,
settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum,
invGroupNum: billNum,
invGroupNum: string.Empty,
invbillnum: string.Empty,
partcode: itm1.PartCode
);
_detailEntity.RealPartCode = itm1.RealPartCode;
billDetails.Add(_detailEntity);
details.Add(_detailEntity);
}
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new HBPO_CAN_SA();
bbac_sa1.SetId(Guid.NewGuid());
bbac_sa1.BillNum = billNum1;
bbac_sa1.InvGroupNum = billNum1;
bbac_sa1.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa1.State = SettleBillState.;
bbac_sa1.SettleBillNum = string.Empty;
bbac_sa1.Site = "1046";
bbac_sa1.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa1);
foreach (var detail in details)
{
detail.SetBillNum(billNum1);
detail.SetGroupNum(billNum1);
billDetails.Add(detail);
}
}
}
@ -556,14 +602,12 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
_dbcontext.BulkDelete(notlist);//删除不可结数据
_dbcontext.BulkInsert(billDetails);//插入可结明细
_dbcontext.BulkInsert(billList);//插入可结主表
}
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "HBPO_NOT" && p.Value == "True").ToList();
if (ls.Any())
{
flag.IsReturn = false;
_dbcontext.BulkDelete(ls);
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
transaction.Commit();
}
catch (Exception)
@ -575,8 +619,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
if (issucess == true)
{
var result = from a in _dbcontext.Set<BBAC_SA_DETAIL>()
join b in _dbcontext.Set<BBAC_CAN_SA_DETAIL>() on new { a.KeyCode, a.BusinessType } equals new { b.KeyCode, b.BusinessType }
var result = from a in _dbcontext.Set<HBPO_SA_DETAIL>()
join b in _dbcontext.Set<HBPO_CAN_SA_DETAIL>() on new { a.KeyCode, a.BusinessType } equals new { b.KeyCode, b.BusinessType }
where a.Price == 0
select new
{
@ -592,12 +636,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
}
else
{
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList();
foreach (var flag in flaglist)
var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "HBPO_NOT" && p.Value == "True").ToList();
if (ls.Any())
{
flag.IsReturn = false;
_dbcontext.BulkDelete(ls);
}
_dbcontext.BulkUpdate(flaglist);//插入可结明细
}
}
return id.ToString();

8
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs

@ -139,7 +139,13 @@ namespace SettleAccount.Domain.BQ
BusinessType = businessType;
PartCode = partcode;
}
public void SetBillNum(string billNum) {
BillNum = billNum;
}
public void SetGroupNum(string billNum)
{
BillNum = billNum;
}
public HBPO_CAN_SA_DETAIL()
{
}

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

@ -10,6 +10,7 @@ using Volo.Abp;
using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.RepositoryBase;
@ -29,6 +30,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
private readonly INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> _sadetailRepository;
private readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<CodeSetting, Guid> _codesettingRepository;
private readonly BaseDomainService _service;
public BBAC_NOT_SA_MNG()
{
@ -40,9 +42,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
INormalEfCoreRepository<BBAC_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> sadetailRepository
INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> sadetailRepository,
INormalEfCoreRepository<CodeSetting, Guid> codesettingRepository
)
{
_codesettingRepository = codesettingRepository;
_priceRepository = priceRepository;
_repository = repository;
_detailRepository = detailRepository;
@ -56,23 +60,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<bool> IsCompleted()
{
var list=await _notRepository.Where(p=>p.IsReturn==true).ToListAsync().ConfigureAwait(false);
var list=await _codesettingRepository.Where(p=>p.Project=="BBAC_NOT" && p.Value=="True").ToListAsync().ConfigureAwait(false);
if (list.Count > 0)
{
return false;
}
var first=_notRepository.FirstOrDefault();
if (first != null)
{
first.IsReturn = true;
_repository.DbContext.BulkUpdate(new List<BBAC_NOT_SA_DETAIL>() { first});
}
await _codesettingRepository.InsertAsync(new CodeSetting(GuidGenerator.Create(), GuidGenerator.Create(),"BBAC_NOT","True","True")).ConfigureAwait(false);
return true;
}

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

@ -4,11 +4,13 @@ using System.Linq;
using System.Security.Policy;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.RepositoryBase;
@ -29,6 +31,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
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 INormalEfCoreRepository<CodeSetting, Guid> _codesettingRepository;
private readonly BaseDomainService _service;
public HBPO_NOT_SA_MNG()
{
@ -36,6 +39,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public HBPO_NOT_SA_MNG
(
INormalEfCoreRepository<CodeSetting, Guid> codesettingRepository,
INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository,
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> notRepository,
@ -48,7 +52,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_notRepository = notRepository;
_service = service;
_priceRepository = priceRepository;
_codesettingRepository = codesettingRepository;
}
public virtual async Task<bool> IsCompleted()
{
var list = await _codesettingRepository.Where(p => p.Project == "HBPO_NOT" && p.Value == "True").ToListAsync().ConfigureAwait(false);
if (list.Count > 0)
{
return false;
}
await _codesettingRepository.InsertAsync(new CodeSetting(GuidGenerator.Create(), GuidGenerator.Create(), "HBPO_NOT", "True", "True")).ConfigureAwait(false);
return true;
}
public virtual async Task<List<string>> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list)
{
if (p_list.Count > 0)

Loading…
Cancel
Save