Browse Source

更新版本

master
zhaoxinyu 10 months ago
parent
commit
b08f7f3c9a
  1. 26
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  2. 291
      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

26
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 SettleAccount.Domain.BQ;
using Shouldly; using Shouldly;
using TaskJob.EventArgs; using TaskJob.EventArgs;
using Volo.Abp;
using Volo.Abp.Data; using Volo.Abp.Data;
using Win.Abp.Snowflakes; using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
@ -135,15 +136,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public override async Task<IActionResult> GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input) public override async Task<IActionResult> GenerateSettlementOrder(HBPO_NOT_SA_DETAIL_REQ_DTO input)
{ {
var flag = await _hbpoNotMng.IsCompleted().ConfigureAwait(false);
var filters= JsonSerializer.Serialize(input.Filters); if (flag == false)
List<CustomCondition> customConditionList = new List<CustomCondition>(); {
customConditionList.Add(new CustomCondition() { Name = "condition", Value = filters }); throw new UserFriendlyException("任务生成中请等待...", "400");
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) => else
{}).ConfigureAwait(false); {
return new JsonResult(new { Code = 200, Message = "生成成功" }); 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);
return new JsonResult(new { Code = 200, Message = "生成成功" });
}
} }
} }
} }

291
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 System.Threading.Tasks;
using DocumentFormat.OpenXml.Bibliography; using DocumentFormat.OpenXml.Bibliography;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using LinqToDB;
using Minio.DataModel; using Minio.DataModel;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using TaskJob.EventArgs; using TaskJob.EventArgs;
@ -18,6 +19,7 @@ using Volo.Abp.Domain.Entities;
using Volo.Abp.Uow; using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.Filter; using Win.Sfs.Shared.Filter;
using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData; 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>()); bbacquery = bbacquery.Where(filers.ToLambda<BBAC_NOT_SA_DETAIL>());
} }
var p_list = bbacquery.ToList(); 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 jis1 = p_list.Where(p => p.Site == "1040").ToList();
var jis2 = p_list.Where(p => p.Site == "1046").ToList(); var jis2 = p_list.Where(p => p.Site == "1046").ToList();
List<BBAC_NOT_SA_DETAIL> notlist = new List<BBAC_NOT_SA_DETAIL>(); 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>(); List<BBAC_CAN_SA_DETAIL> details = new List<BBAC_CAN_SA_DETAIL>();
foreach (var itm1 in ls) foreach (var itm1 in ls)
{ {
sum += (itm1.Qty * itm1.Price);
if (sum > 10000000) if (sum > 10000000)
{ {
var billNum = OrderNumberGenerator.GenerateOrderNumber("N"); var billNum = OrderNumberGenerator.GenerateOrderNumber("N");
@ -135,28 +131,28 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
sum = 0; sum = 0;
} }
var _detailEntity = new BBAC_CAN_SA_DETAIL( var _detailEntity = new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode, keyCode: itm1.KeyCode,
version: itm1.Version, version: itm1.Version,
billNum: string.Empty, billNum: string.Empty,
settleBillNum: itm1.SettleBillNum, settleBillNum: itm1.SettleBillNum,
lU: itm1.LU, lU: itm1.LU,
pN: itm1.PN, pN: itm1.PN,
site: itm1.Site, site: itm1.Site,
qty: itm1.Qty, qty: itm1.Qty,
price: itm1.Price, price: itm1.Price,
category: itm1.BusinessType, category: itm1.BusinessType,
isReturn: itm1.IsReturn, isReturn: itm1.IsReturn,
settleDate: itm1.SettleDate, settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum, groupNum: itm1.GroupNum,
invGroupNum: string.Empty, invGroupNum: string.Empty,
contactid: itm1.ContractDocID, contactid: itm1.ContractDocID,
invbillnum: string.Empty, invbillnum: string.Empty,
partcode: itm1.PartCode partcode: itm1.PartCode
); );
_detailEntity.RealPartCode = itm1.RealPartCode; _detailEntity.RealPartCode = itm1.RealPartCode;
details.Add(_detailEntity); details.Add(_detailEntity);
sum += (itm1.Qty * itm1.Price);
} }
var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N"); var billNum1 = OrderNumberGenerator.GenerateOrderNumber("N");
var bbac_sa1 = new BBAC_CAN_SA(); var bbac_sa1 = new BBAC_CAN_SA();
@ -171,9 +167,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
billList.Add(bbac_sa1); billList.Add(bbac_sa1);
foreach (var detail in details) foreach (var detail in details)
{ {
detail.SetBillNum(billNum1);
detail.SetGroupNum(billNum1);
billDetails.Add(detail); billDetails.Add(detail);
} }
} }
} }
if (part_group_small.Count > 0) if (part_group_small.Count > 0)
@ -263,42 +260,74 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
{ {
foreach (var itm in part_group_big) 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();
var billNum = OrderNumberGenerator.GenerateOrderNumber("N"); decimal sum = 0;
var bbac_sa = new BBAC_CAN_SA(); List<BBAC_CAN_SA_DETAIL> details = new List<BBAC_CAN_SA_DETAIL>();
bbac_sa.SetId(Guid.NewGuid());
bbac_sa.BillNum = billNum;
bbac_sa.InvGroupNum = billNum;
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "1046";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls) 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());
bbac_sa.BillNum = billNum;
bbac_sa.InvGroupNum = billNum;
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "1046";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
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( var _detailEntity = new BBAC_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode, keyCode: itm1.KeyCode,
version: itm1.Version, version: itm1.Version,
billNum: billNum, billNum: string.Empty,
settleBillNum: itm1.SettleBillNum, settleBillNum: itm1.SettleBillNum,
lU: itm1.LU, lU: itm1.LU,
pN: itm1.PN, pN: itm1.PN,
site: itm1.Site, site: itm1.Site,
qty: itm1.Qty, qty: itm1.Qty,
price: itm1.Price, price: itm1.Price,
category: itm1.BusinessType, category: itm1.BusinessType,
isReturn: itm1.IsReturn, isReturn: itm1.IsReturn,
settleDate: itm1.SettleDate, settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum, groupNum: itm1.GroupNum,
invGroupNum: billNum, invGroupNum: string.Empty,
contactid: itm1.ContractDocID, contactid: itm1.ContractDocID,
invbillnum: string.Empty, invbillnum: string.Empty,
partcode: itm1.PartCode partcode: itm1.PartCode
); );
_detailEntity.RealPartCode = itm1.RealPartCode; _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(billDetails);//插入可结主表
_dbcontext.BulkInsert(billList);//插入可结明细 _dbcontext.BulkInsert(billList);//插入可结明细
} }
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList(); var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "BBAC_NOT" && p.Value=="True").ToList();
foreach (var flag in flaglist) if (ls.Any())
{ {
flag.IsReturn = false; _dbcontext.BulkDelete(ls);
} }
_dbcontext.BulkUpdate(flaglist);//插入可结明细
transaction.Commit(); transaction.Commit();
} }
catch (Exception) catch (Exception)
@ -393,12 +421,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
else else
{ {
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList(); var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "BBAC_NOT" && p.Value == "True").ToList();
foreach (var flag in flaglist) if (ls.Any())
{ {
flag.IsReturn = false; _dbcontext.BulkDelete(ls);
} }
_dbcontext.BulkUpdate(flaglist);//插入可结明细
} }
} }
if (businesstype == "JisHBPO" || businesstype== "MaiDanJianHBPO") 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>()); bbacquery = bbacquery.Where(filers.ToLambda<HBPO_NOT_SA_DETAIL>());
} }
var p_list = bbacquery.ToList(); 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(); var jis1 = p_list.Where(p => p.Site == "104T").ToList();
if (jis1.Count > 0) if (jis1.Count > 0)
{ {
@ -462,46 +480,74 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
var part_group_small = t1.Where(p => p.Amt < 10000000).ToList(); var part_group_small = t1.Where(p => p.Amt < 10000000).ToList();
if (part_group_big.Count > 0) if (part_group_big.Count > 0)
{ {
foreach (var itm in part_group_big) foreach (var itm in part_group_big)
{ {
var ls = hbpo_can_list.Where(p => p.LU == itm.LU).ToList(); var ls = hbpo_can_list.Where(p => p.LU == itm.LU).ToList();
var billNum = OrderNumberGenerator.GenerateOrderNumber("N"); decimal sum = 0;
var bbac_sa = new HBPO_CAN_SA(); List<HBPO_CAN_SA_DETAIL> details = new List<HBPO_CAN_SA_DETAIL>();
bbac_sa.SetId(Guid.NewGuid());
bbac_sa.BillNum = billNum;
bbac_sa.InvGroupNum = billNum;
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "104T";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
foreach (var itm1 in ls) 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());
bbac_sa.BillNum = billNum;
bbac_sa.InvGroupNum = billNum;
bbac_sa.Version = int.Parse(DateTime.Now.ToString("yyyyMM"));
bbac_sa.State = SettleBillState.;
bbac_sa.SettleBillNum = string.Empty;
bbac_sa.Site = "1046";
bbac_sa.BusinessType = EnumBusinessType.JisBBAC;
billList.Add(bbac_sa);
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( var _detailEntity = new HBPO_CAN_SA_DETAIL(
guid: GuidGenerator.Create(), guid: GuidGenerator.Create(),
keyCode: itm1.KeyCode, keyCode: itm1.KeyCode,
version: itm1.Version, version: itm1.Version,
billNum: billNum, billNum: string.Empty,
settleBillNum: itm1.SettleBillNum, settleBillNum: itm1.SettleBillNum,
lU: itm1.LU, lU: itm1.LU,
pN: itm1.PN, pN: itm1.PN,
site: itm1.Site, site: itm1.Site,
qty: itm1.Qty, qty: itm1.Qty,
price: itm1.Price, price: itm1.Price,
businessType: itm1.BusinessType, businessType: itm1.BusinessType,
settleDate: itm1.SettleDate, settleDate: itm1.SettleDate,
groupNum: itm1.GroupNum, groupNum: itm1.GroupNum,
invGroupNum: billNum, invGroupNum: string.Empty,
invbillnum: string.Empty, invbillnum: string.Empty,
partcode: itm1.PartCode partcode: itm1.PartCode
); );
_detailEntity.RealPartCode = itm1.RealPartCode; _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.BulkDelete(notlist);//删除不可结数据
_dbcontext.BulkInsert(billDetails);//插入可结明细 _dbcontext.BulkInsert(billDetails);//插入可结明细
_dbcontext.BulkInsert(billList);//插入可结主表 _dbcontext.BulkInsert(billList);//插入可结主表
} }
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList(); var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "HBPO_NOT" && p.Value == "True").ToList();
foreach (var flag in flaglist) if (ls.Any())
{ {
flag.IsReturn = false; _dbcontext.BulkDelete(ls);
} }
_dbcontext.BulkUpdate(flaglist);//插入可结明细
transaction.Commit(); transaction.Commit();
} }
catch (Exception) catch (Exception)
@ -575,8 +619,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
if (issucess == true) if (issucess == true)
{ {
var result = from a in _dbcontext.Set<BBAC_SA_DETAIL>() var result = from a in _dbcontext.Set<HBPO_SA_DETAIL>()
join b in _dbcontext.Set<BBAC_CAN_SA_DETAIL>() on new { a.KeyCode, a.BusinessType } equals new { b.KeyCode, b.BusinessType } 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 where a.Price == 0
select new select new
{ {
@ -592,12 +636,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs
} }
else else
{ {
var flaglist = _dbcontext.Set<BBAC_NOT_SA_DETAIL>().Where(p => p.IsReturn == true).ToList(); var ls = _dbcontext.Set<CodeSetting>().Where(p => p.Project == "HBPO_NOT" && p.Value == "True").ToList();
foreach (var flag in flaglist) if (ls.Any())
{ {
flag.IsReturn = false; _dbcontext.BulkDelete(ls);
} }
_dbcontext.BulkUpdate(flaglist);//插入可结明细
} }
} }
return id.ToString(); 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; BusinessType = businessType;
PartCode = partcode; PartCode = partcode;
} }
public void SetBillNum(string billNum) {
BillNum = billNum;
}
public void SetGroupNum(string billNum)
{
BillNum = billNum;
}
public HBPO_CAN_SA_DETAIL() 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 Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.RepositoryBase; 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_SA_DETAIL, Guid> _sadetailRepository;
private readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository; private readonly INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<CodeSetting, Guid> _codesettingRepository;
private readonly BaseDomainService _service; private readonly BaseDomainService _service;
public BBAC_NOT_SA_MNG() 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_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository, INormalEfCoreRepository<BBAC_NOT_SA_DETAIL, Guid> notRepository,
INormalEfCoreRepository<PriceList, Guid> priceRepository, INormalEfCoreRepository<PriceList, Guid> priceRepository,
INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> sadetailRepository INormalEfCoreRepository<BBAC_SA_DETAIL, Guid> sadetailRepository,
INormalEfCoreRepository<CodeSetting, Guid> codesettingRepository
) )
{ {
_codesettingRepository = codesettingRepository;
_priceRepository = priceRepository; _priceRepository = priceRepository;
_repository = repository; _repository = repository;
_detailRepository = detailRepository; _detailRepository = detailRepository;
@ -56,23 +60,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<bool> IsCompleted() 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) if (list.Count > 0)
{ {
return false; return false;
} }
var first=_notRepository.FirstOrDefault(); await _codesettingRepository.InsertAsync(new CodeSetting(GuidGenerator.Create(), GuidGenerator.Create(),"BBAC_NOT","True","True")).ConfigureAwait(false);
if (first != null)
{
first.IsReturn = true;
_repository.DbContext.BulkUpdate(new List<BBAC_NOT_SA_DETAIL>() { first});
}
return true; 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.Security.Policy;
using System.Threading.Tasks; using System.Threading.Tasks;
using EFCore.BulkExtensions; using EFCore.BulkExtensions;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Domain.BQ; using SettleAccount.Domain.BQ;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Domain.Services; using Volo.Abp.Domain.Services;
using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Bases.DomainServices; using Win.Sfs.SettleAccount.Bases.DomainServices;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.Prices; using Win.Sfs.SettleAccount.Entities.Prices;
using Win.Sfs.Shared.RepositoryBase; 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_CAN_SA_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository; private readonly INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> _notRepository;
private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository; private readonly INormalEfCoreRepository<PriceList, Guid> _priceRepository;
private readonly INormalEfCoreRepository<CodeSetting, Guid> _codesettingRepository;
private readonly BaseDomainService _service; private readonly BaseDomainService _service;
public HBPO_NOT_SA_MNG() public HBPO_NOT_SA_MNG()
{ {
@ -36,6 +39,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public HBPO_NOT_SA_MNG public HBPO_NOT_SA_MNG
( (
INormalEfCoreRepository<CodeSetting, Guid> codesettingRepository,
INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository, INormalEfCoreRepository<HBPO_CAN_SA, Guid> repository,
INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository, INormalEfCoreRepository<HBPO_CAN_SA_DETAIL, Guid> detailRepository,
INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> notRepository, INormalEfCoreRepository<HBPO_NOT_SA_DETAIL, Guid> notRepository,
@ -48,7 +52,21 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_notRepository = notRepository; _notRepository = notRepository;
_service = service; _service = service;
_priceRepository = priceRepository; _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) public virtual async Task<List<string>> GenerateSettlementOrder(List<HBPO_NOT_SA_DETAIL> p_list)
{ {
if (p_list.Count > 0) if (p_list.Count > 0)

Loading…
Cancel
Save