diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
index e862b2ea..8016a829 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_CAN_SA_DTO.cs
@@ -1,4 +1,4 @@
-using Magicodes.ExporterAndImporter.Core;
+using Magicodes.ExporterAndImporter.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -94,6 +94,10 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// 结算分组号
///
public string GroupNum { get; set; }
+ ///
+ /// 金额
+ ///
+ public decimal Amt { get; set; }
}
public class BBAC_CAN_SA_DETAIL_EXP_DTO
@@ -191,6 +195,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
public string SettleBillNum { get; set; }
[Display(Name = "状态")]
public string State { get; set; }
+ [Display(Name = "发票分组号")]
+ public string InvGroupNum { get; set; }
}
public class BBAC_CAN_SA_DETAIL_REQ_DTO : RequestInputBase
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs
index 94b1b5b3..a859f92b 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs
@@ -83,12 +83,5 @@ namespace Win.Sfs.SettleAccount.Bases
);
return fileName;
}
-
-
-
-
}
-
-
-
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
index 1b0313a8..205310aa 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
@@ -31,7 +31,7 @@ namespace Win.Sfs.SettleAccount.Bases
{
public abstract class BA_SERVICE: BASE_SERVICE
{
- private readonly INormalEfCoreRepository _repository;
+ protected readonly INormalEfCoreRepository _repository;
private readonly INormalEfCoreRepository _wRepository;
private readonly INormalEfCoreRepository _sRepository;
private readonly INormalEfCoreRepository _mRepository;
@@ -77,8 +77,13 @@ namespace Win.Sfs.SettleAccount.Bases
///
///
///
+
+
public virtual async Task GenerateInvoice(INVOICE_GRP_REQ_DTO input)
{
+
+ await _invMng.SetForwardState(input.InvGroupNum, SettleBillState.商务已审核);
+
return ApplicationConsts.SuccessStr;
}
@@ -183,7 +188,7 @@ namespace Win.Sfs.SettleAccount.Bases
bool flag = await _invMng.ReceivedAsync(entity.InvGroupNum);
if (flag == true)
{
- await _invMng.SetForwardState(entity, InvoiceBillState.客户已收票);
+ await _invMng.SetForwardState(entity,SettleBillState.客户已收票);
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
index d73c2735..1835e4e2 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
@@ -1,4 +1,4 @@
-using AutoMapper;
+using AutoMapper;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
@@ -22,6 +22,7 @@ using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.SettleAccount.ExportReports;
using Win.Sfs.Shared.RepositoryBase;
@@ -37,19 +38,20 @@ namespace Win.Sfs.SettleAccount.Bases
where TRequestDetailInput : RequestInputBase
where TEntityDetailExportDto : class, new()
{
-
- private readonly INormalEfCoreRepository _repository;
- private readonly INormalEfCoreRepository _detailRepository;
+
+ protected readonly INormalEfCoreRepository _repository;
+ protected readonly INormalEfCoreRepository _detailRepository;
private readonly IExcelImportAppService _excelImportService;
-
-
+ protected readonly INV_MNG _invmng;
protected CAN_SA_SERVICE(
INormalEfCoreRepository repository,
IExcelImportAppService excelImportService,
- INormalEfCoreRepository detailRepository
+ INormalEfCoreRepository detailRepository,
+ INV_MNG invmng
)
{
+ _invmng= invmng;
_excelImportService = excelImportService;
_repository = repository;
_detailRepository = detailRepository;
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
index 67d2bc41..a376ea5f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
@@ -142,12 +142,12 @@ namespace Win.Sfs.SettleAccount.Bases
return ApplicationConsts.SuccessStr;
}
- public virtual async Task GetMainByBillNum(string billNum)
+ public virtual async Task GetMainAsync(string billNum)
{
return await _repository.Where(p=>p.InvGroupNum == billNum).FirstOrDefaultAsync();
}
- public virtual async Task> GetDetailByBillNum(string billNum)
+ public virtual async Task> GetDetailAsync(string billNum)
{
return await _detailRepository.Where(p => p.InvGroupNum == billNum).ToListAsync();
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
index 5cdc9c79..6b5c245d 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
@@ -18,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// BBAC业务商务审核
///
[AllowAnonymous]
- [Route("api/settleaccount/bbac_ba_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class BBAC_BA_SERVICE : BA_SERVICE
{
public BBAC_BA_SERVICE(INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG pubMng, CAN_SA_MNG bbacMng, CAN_SA_MNG hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
index a4a839fa..cf12964c 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NPOI.SS.Formula.Functions;
@@ -10,10 +10,12 @@ using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
+using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@@ -35,57 +37,189 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
BBAC_CAN_SA_DETAIL_EXP_DTO
>
{
- protected BBAC_CAN_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(repository, excelImportService, detailRepository)
+ private readonly INormalEfCoreRepository _notRepository;
+ public BBAC_CAN_SA_SERVICE(
+ INormalEfCoreRepository repository,
+ IExcelImportAppService excelImportService,
+ INormalEfCoreRepository detailRepository,
+ INormalEfCoreRepository notRepository,
+ INV_MNG invmng) : base(repository, excelImportService, detailRepository, invmng)
{
+ _notRepository = notRepository;
}
+
+ ///
+ /// 生成发票
+ ///
+ ///
+ ///
[HttpPost]
//[Route("generateinvoice")]
public async override Task GenerateInvoice(BBAC_CAN_SA_REQ_DTO input)
{
- List _ls = new List();
- var _query= _ls.GroupBy(p => new { p.GroupNum }).Select(p =>new {GroupNum=p.Key.GroupNum, Qty=p.Sum(itm=>itm.Price)});
- Dictionary _dic = new Dictionary();
- Dictionary _dic1 = new Dictionary();
+
+ var main=_repository.Where(p => p.InvGroupNum == input.Filters.Where(p => p.Column == "BillNum").FirstOrDefault().Value).FirstOrDefault();
+ var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);//可结算
+
+ var groupNumList= entitys.Select(p=>p.GroupNum).Distinct().ToList();
+
+ var notList =_notRepository.Where(p => groupNumList.Contains(p.InvGroupNum)).ToList();//不能结算
+
+ var dtos = ObjectMapper.Map, List>(entitys);
+
+ dtos.ForEach(dto =>
+ {
+ dto.Amt = Math.Round(dto.Price * dto.Qty, 2);
+ });
+
+ var _query= dtos.GroupBy(p => new { p.GroupNum }).Select(p =>new {GroupNum=p.Key.GroupNum, Amt=p.Sum(itm=>itm.Amt)});
+
+ Dictionary dic = new Dictionary();//原本
+
+ Dictionary copyDic = new Dictionary();//变换数组副本
+
foreach (var itm in _query.ToList())
{
- _dic.Add(itm.GroupNum, itm.Qty);
- _dic1.Add(itm.GroupNum, itm.Qty);
+ dic.Add(itm.GroupNum, itm.Amt);
+ copyDic.Add(itm.GroupNum, itm.Amt);
}
- Dictionary> _invoice=new Dictionary>();
- foreach (var _itm in _dic)
+ Dictionary> invoiceMap=new Dictionary>();
+ foreach (var itm in dic)
{
- string invoiceBillNum = Guid.NewGuid().ToString();
- List invoiceGroupNumList = new List();
+ string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
+ List invoiceGroupNumList = new List();//每个发票对应的结算分组号
List List = new List();
- decimal sum = _itm.Value;//初始价格
- List luList= _ls.Where(p => p.GroupNum == _itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
- foreach (var _itm1 in _dic1)
+ decimal sum = itm.Value;//初始分组合计金额
+ List luList= dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
+
+ if (copyDic.ContainsKey(itm.Key)==true)//是否存在分组
{
- if (_itm.Key == _itm1.Key)
+ foreach (var _itm1 in copyDic)
{
- continue;
+ if (itm.Key == _itm1.Key)//相同结算分组项不计算,已初始化
+ {
+ invoiceGroupNumList.Add(itm.Key);
+ continue;
+ }
+ var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
+ luList.AddRange(grouplist);
+ luList = luList.Distinct().ToList();
+ if (luList.Count > 20)//累加零件不超过20种
+ {
+ continue;
+ }
+ if (sum > 10000000)
+ {
+ break;
+ }
+ sum += _itm1.Value;
+ invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
}
- var grouplist=_ls.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
- luList.AddRange(grouplist);
- luList = luList.Distinct().ToList();
- if (luList.Count > 20)//累加零件不超过20种
+
+ invoiceMap.Add(invoiceBillNum, invoiceGroupNumList);//记录发票对应关系
+ foreach (var rem in invoiceGroupNumList)//移除
+ {
+ copyDic.Remove(rem);
+ }
+ }
+ }
+ if(invoiceMap.Keys.Count > 0) {
+
+ var inv=new INVOICE_GRP();
+ var groupList = new List();
+ var notDetialList=new List();
+ var detailList= new List();
+
+
+
+ foreach (var itm in invoiceMap)
+ {
+ var key = itm.Key;//发票票号
+ var ls = itm.Value;//结算分组号列表
+ var detailDtos= dtos.Where(p => ls.Contains(p.GroupNum)).GroupBy(p=>new {p.InvGroupNum, p.LU,p.Price })
+ .Select(itm=>new { InvGroupNum=itm.Key.InvGroupNum,
+ LU=itm.Key.LU,
+ Price=itm.Key.Price,Amt=Math.Round(itm.Sum(k=>k.Qty)*itm.Key.Price,2) ,
+ Qty= itm.Sum(k => k.Qty) })
+ .ToList();
+ var invbill=new INVOICE_GRP();
+
+
+ foreach (var obj in detailDtos)
{
- continue;
+ new INVOICE_WAIT_DETAIL(
+ guid: GuidGenerator.Create(),
+ version:main.Version,
+ invbillNum: key,
+ invGroupNum: obj.InvGroupNum,
+ lU: obj.LU,
+ qty: obj.Qty,
+ bussiessType: EnumBusinessType.BBAC,
+ amt: obj.Amt,
+ pRICE:obj.Price,
+ extend1: string.Empty, extend2: string.Empty, extend3: string.Empty, extend4: string.Empty
+ );
+
}
- sum += _itm1.Value;
- if (sum > 10000000)
+
+
+ foreach (var groupnum in ls)
{
- continue;
+
}
- invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
}
+
}
- return ApplicationConsts.SuccessStr;
- // return true;
+
+ return ApplicationConsts.SuccessStr;
}
-
+ //private Dictionary GenerateInvoice(Dictionary p_dic)
+ //{
+
+ // string invoiceBillNum = OrderNumberGenerator.GenerateOrderNumber("INV");
+ // List invoiceGroupNumList = new List();//每个发票对应的结算分组号
+
+ // List List = new List();
+ // decimal sum = p_dic.Value;//初始分组合计金额
+ // List luList = dtos.Where(p => p.GroupNum == itm.Key).Select(p => p.LU).Distinct().ToList(); //初始LU种类
+
+
+ // foreach (var _itm1 in copyDic)
+ // {
+ // if (itm.Key == _itm1.Key)//相同结算分组项不计算
+ // {
+ // invoiceGroupNumList.Add(itm.Key);
+ // continue;
+ // }
+ // var grouplist = dtos.Where(p => p.GroupNum == _itm1.Key).Select(p => p.LU).Distinct().ToList();//每项LU种类
+ // luList.AddRange(grouplist);
+ // luList = luList.Distinct().ToList();
+ // if (luList.Count > 20)//累加零件不超过20种
+ // {
+ // continue;
+ // }
+
+ // if (sum > 10000000)
+ // {
+ // break;
+ // }
+ // sum += _itm1.Value;
+ // invoiceGroupNumList.Add(_itm1.Key);//所有条件都满足添加发票和结算分组对应关系
+ // }
+ // foreach (var rem in invoiceGroupNumList)//移除
+ // {
+ // copyDic.Remove(rem);
+ // }
+
+
+
+ // return
+ //}
+
+
+
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
index 3e794532..43837a7f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_PD_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@@ -18,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// BBAC寄售库库存扣减审批
///
[AllowAnonymous]
- [Route("api/settleaccount/bbac_pd_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class BBAC_PD_SERVICE : PD_SERVICE
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
index 1f678b53..9fd615da 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
@@ -15,7 +15,7 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
[AllowAnonymous]
- [Route("api/settleaccount/hbpo_ba_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class HBPO_BA_SERVICE : BA_SERVICE
{
public HBPO_BA_SERVICE(INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG pubMng, CAN_SA_MNG bbacMng, CAN_SA_MNG hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
index d6a3cd77..ed0465ff 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_CAN_SA_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
@@ -12,6 +12,7 @@ using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@@ -33,7 +34,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
HBPO_CAN_SA_DETAIL_EXP_DTO
>
{
- protected HBPO_CAN_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(repository, excelImportService, detailRepository)
+ public HBPO_CAN_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository, INV_MNG invmng) : base(repository, excelImportService, detailRepository, invmng)
{
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
index d4151a86..e973acd6 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
@@ -44,6 +44,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
state: SettleBillState.未结状态,
invGroupNum: billNum,
site:entitys.FirstOrDefault().Site
+
);
List ls = new List();
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
index 5541dd50..d3561ea3 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_PD_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@@ -16,7 +16,7 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
[AllowAnonymous]
- [Route("api/settleaccount/hbpo_pd_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class HBPO_PD_SERVICE : PD_SERVICE
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
index 6ac5d98c..13a9f3f8 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
@@ -68,7 +68,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
- await _invMng.SetForwardState(inv, InvoiceBillState.财务已审核);
+ await _invMng.SetForwardState(inv, SettleBillState.财务已审核);
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
index db5e4865..c348a325 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
@@ -15,7 +15,7 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
[AllowAnonymous]
- [Route("api/settleaccount/pub_ba_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class PUB_BA_SERVICE : BA_SERVICE
{
public PUB_BA_SERVICE(INormalEfCoreRepository repository, INormalEfCoreRepository wRepository, INormalEfCoreRepository sRepository, INormalEfCoreRepository mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG pubMng, CAN_SA_MNG bbacMng, CAN_SA_MNG hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
index 8fd4eca0..95560c1d 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_CAN_SA_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
@@ -12,6 +12,7 @@ using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@@ -33,7 +34,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
PUB_CAN_SA_DETAIL_EXP_DTO
>
{
- protected PUB_CAN_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository) : base(repository, excelImportService, detailRepository)
+ public PUB_CAN_SA_SERVICE(INormalEfCoreRepository repository, IExcelImportAppService excelImportService, INormalEfCoreRepository detailRepository, INV_MNG invmng) : base(repository, excelImportService, detailRepository, invmng)
{
}
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
index 990278ea..b59acbab 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_PD_SERVICE.cs
@@ -1,4 +1,4 @@
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@@ -16,7 +16,7 @@ using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
[AllowAnonymous]
- [Route("api/settleaccount/pub_pd_service")]
+ [Route("api/settleaccount/[controller]/[action]")]
public class PUB_PD_SERVICE : PD_SERVICE
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
index a35f3b82..96bbb7a1 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_GRP.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
using Win.Sfs.SettleAccount;
@@ -33,9 +33,14 @@ public class INVOICE_GRP : FullAuditedAggregateRoot
[Display(Name = "状态")]
- public InvoiceBillState State { get; set; }
+ public SettleBillState State { get; set; }
- public INVOICE_GRP(Guid guid, string realnvBillNum, string invbillNum, decimal amt, decimal taxAmt, string invGroupNum, string fileName, EnumBusinessType businessType, InvoiceBillState state)
+ [Display(Name = "发票状态")]
+ public InvoiceBillState InvoiceState { get; set; }
+
+
+
+ public INVOICE_GRP(Guid guid, string realnvBillNum, string invbillNum, decimal amt, decimal taxAmt, string invGroupNum, string fileName, EnumBusinessType businessType, SettleBillState state,InvoiceBillState invoiceBillState)
{
Id= guid;
RealnvBillNum = realnvBillNum;
@@ -46,6 +51,7 @@ public class INVOICE_GRP : FullAuditedAggregateRoot
FileName = fileName;
BusinessType = businessType;
State = state;
+ InvoiceState = invoiceBillState;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs
index 49cb3240..e4451186 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/INVOICE_WAIT_DETAIL.cs
@@ -1,6 +1,7 @@
-using System;
+using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
+using Win.Sfs.SettleAccount;
namespace SettleAccount.Domain.BQ;
@@ -32,7 +33,7 @@ public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot
/// 1、BBAC-JIS 2、HBPO-JIS 3、JIT 4、备件 5、印度件
///
[Display(Name = "业务分类")]
- public string BussiessType { get; set; } = null!;
+ public EnumBusinessType BussiessType { get; set; }
[Display(Name = "扩展字段1")]
public string Extend1 { get; set; } = null!;
@@ -46,7 +47,7 @@ public class INVOICE_WAIT_DETAIL :FullAuditedAggregateRoot
[Display(Name = "扩展字段4")]
public string Extend4 { get; set; } = null!;
- public INVOICE_WAIT_DETAIL(Guid guid, int version, string invbillNum, string invGroupNum, string lU, decimal pRICE, decimal qty, decimal amt, string bussiessType, string extend1, string extend2, string extend3, string extend4)
+ public INVOICE_WAIT_DETAIL(Guid guid, int version, string invbillNum, string invGroupNum, string lU, decimal pRICE, decimal qty, decimal amt, EnumBusinessType bussiessType, string extend1, string extend2, string extend3, string extend4)
{
Id = guid;
Version = version;
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs
index 45524521..e3269444 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs
@@ -45,15 +45,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
-
+ ///
+ /// 向前流程
+ ///
+ ///
+ ///
+ ///
+ ///
public virtual async Task SetForwardState(string p_billNum, SettleBillState state)
{
var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList();
-
+ if (ls != null && ls.Count > 0)
+ {
+ throw new BusinessException("8989", string.Format("不存在编号为{0}",p_billNum));
+ }
foreach (TEntity p_entiy in ls)
{
-
switch (p_entiy.State)
{
case SettleBillState.财务已审核:
@@ -108,11 +116,85 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
break;
}
await _repository.UpdateAsync(p_entiy);
-
+ return true;
}
+ return false;
+ }
+ ///
+ /// 向后流程
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual async Task SetBackwardState(string p_billNum, SettleBillState state)
+ {
+ var ls = _repository.Where(p => p.InvGroupNum == p_billNum).ToList();
+ if (ls != null && ls.Count > 0)
+ {
+ throw new BusinessException("8989", string.Format("不存在发票分组号为{0}的可结算单", p_billNum));
+ }
+ foreach (TEntity p_entiy in ls)
+ {
- return true;
+ switch (p_entiy.State)
+ {
+ case SettleBillState.商务已审核:
+ if (state == SettleBillState.财务已审核)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态");
+ }
+ break;
+ case SettleBillState.已开票:
+ if (state == SettleBillState.商务已审核)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】");
+ }
+ break;
+ case SettleBillState.未结状态:
+ if (state == SettleBillState.已开票)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【未结状态】");
+ }
+ break;
+ case SettleBillState.客户已收票:
+ if (state == SettleBillState.已扣减)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【财务已审核客户收票】状态");
+ }
+ break;
+ case SettleBillState.财务已审核:
+ if (state == SettleBillState.客户已收票)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是[客户已收票],无法设置成【财务已审核】状态");
+ }
+ break;
+ }
+ await _repository.UpdateAsync(p_entiy);
+ return true;
+ }
+ return false;
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
index 034283c4..26c632dd 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
@@ -11,6 +11,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
+using Volo.Abp.Auditing;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.RepositoryBase;
@@ -55,7 +56,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_hbpoMng = hbpoMng;
}
- public virtual async Task SetForwardState(string p_groupBillnum , InvoiceBillState p_State)
+ public virtual async Task SetForwardState(string p_groupBillnum , SettleBillState p_State)
{
var _first=_repository.Where(p => p.InvbillNum == p_groupBillnum).FirstOrDefault();
if (_first != null)
@@ -65,15 +66,178 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return false;
}
+
+ private async Task SetSettleState(INVOICE_GRP p_entiy, SettleBillState p_State,bool IsForward=true)
+ {
+ if (p_entiy.BusinessType == EnumBusinessType.BeiJian ||
+ p_entiy.BusinessType == EnumBusinessType.YingDuJian ||
+ p_entiy.BusinessType == EnumBusinessType.MaiDanJian ||
+ p_entiy.BusinessType == EnumBusinessType.ZhiGongJian
+ )
+ {
+ bool isSucc = false;
+ if (IsForward == true)
+ {
+ isSucc = await _pubMng.SetForwardState(p_entiy.InvGroupNum, p_State);
+ }
+ else
+ {
+ isSucc = await _pubMng.SetBackwardState(p_entiy.InvGroupNum, p_State);
+ }
+ return isSucc;
+ }
+ else if (p_entiy.BusinessType == EnumBusinessType.BBAC)
+ {
+ bool isSucc = false;
+ if (IsForward == true)
+ {
+ isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, p_State);
+ }
+ else
+ {
+ isSucc = await _bbacMng.SetBackwardState(p_entiy.InvGroupNum, p_State);
+ }
+ //switch ((int)p_State)
+ //{
+ // case (int)SettleBillState.财务已审核:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.财务已审核);
+ // }
+ // else
+ // {
+ // isSucc = await _bbacMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.财务已审核);
+ // }
+ // break;
+ // case (int)SettleBillState.商务已审核:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.商务已审核);
+ // }
+ // else
+ // {
+ // isSucc = await _bbacMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.商务已审核);
+ // }
+ // break;
+ // case (int)SettleBillState.已开票:
+ // if (IsForward == true)
+ // {
+
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已开票);
+ // }
+ // else
+ // {
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已开票);
+ // }
+ // break;
+ // case (int)SettleBillState.客户已收票:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.客户已收票);
+ // }
+ // else
+ // {
+ // isSucc = await _bbacMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.客户已收票);
+ // }
+ // break;
+ // case (int)SettleBillState.已扣减:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _bbacMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已扣减);
+ // }
+ // else
+ // {
+ // isSucc = await _bbacMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.已扣减);
+ // }
+ // break;
+ //}
+ return isSucc;
+ }
+ else if (p_entiy.BusinessType == EnumBusinessType.HBPO)
+ {
+ bool isSucc = false;
- public virtual async Task SetForwardState(INVOICE_GRP p_entiy, InvoiceBillState p_State)
+ if (IsForward == true)
+ {
+ isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, p_State);
+ }
+ else
+ {
+ isSucc = await _hbpoMng.SetBackwardState(p_entiy.InvGroupNum, p_State);
+ }
+ //switch ((int)p_State)
+ //{
+ // case (int)SettleBillState.财务已审核:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.财务已审核);
+ // }
+ // else
+ // {
+ // isSucc = await _hbpoMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.财务已审核);
+ // }
+ // break;
+ // case (int)SettleBillState.商务已审核:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.商务已审核);
+ // }
+ // else
+ // {
+ // isSucc = await _hbpoMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.商务已审核);
+ // }
+ // break;
+ // case (int)SettleBillState.已开票:
+ // if (IsForward == true)
+ // {
+
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已开票);
+ // }
+ // else
+ // {
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已开票);
+ // }
+ // break;
+ // case (int)SettleBillState.客户已收票:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.客户已收票);
+ // }
+ // else
+ // {
+ // isSucc = await _hbpoMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.客户已收票);
+ // }
+ // break;
+ // case (int)SettleBillState.已扣减:
+ // if (IsForward == true)
+ // {
+ // isSucc = await _hbpoMng.SetForwardState(p_entiy.InvGroupNum, SettleBillState.已扣减);
+ // }
+ // else
+ // {
+ // isSucc = await _hbpoMng.SetBackwardState(p_entiy.InvGroupNum, SettleBillState.已扣减);
+ // }
+ // break;
+ //}
+ return isSucc;
+ }
+ return false;
+ }
+ ///
+ /// 向前流程
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual async Task SetForwardState(INVOICE_GRP p_entiy, SettleBillState p_State)
{
var state = p_State;
switch (p_entiy.State)
{
- case InvoiceBillState.财务已审核:
- if (state == InvoiceBillState.商务已审核)
+ case SettleBillState.财务已审核:
+ if (state == SettleBillState.商务已审核)
{
p_entiy.State = state;
}
@@ -82,8 +246,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
}
break;
- case InvoiceBillState.商务已审核:
- if (state == InvoiceBillState.已开票)
+ case SettleBillState.商务已审核:
+ if (state == SettleBillState.已开票)
{
p_entiy.State = state;
}
@@ -92,8 +256,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
throw new BusinessException("8989", "当前状态不是【已开票】状态,无法设置成【商务已审核】");
}
break;
- case InvoiceBillState.已扣减:
- if (state == InvoiceBillState.客户已收票)
+ case SettleBillState.已扣减:
+ if (state == SettleBillState.客户已收票)
{
p_entiy.State = state;
}
@@ -103,12 +267,79 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
break;
}
+
+
+ var flag= await SetSettleState(p_entiy, p_State,true);
+ if (flag == true)
+ {
+ await _repository.UpdateAsync(p_entiy);
+
+ return false;
+ }
+ return false;
+ }
+
+ ///
+ /// 向后流程
+ ///
+ ///
+ ///
+ ///
+ ///
+ public virtual async Task SetBackwardState(INVOICE_GRP p_entiy, SettleBillState p_State)
+ {
+ var state = p_State;
+ switch (p_entiy.State)
+ {
+ case SettleBillState.商务已审核:
+ if (state == SettleBillState.财务已审核)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【财务已审核】,无法设置成【商务已审核】状态");
+ }
+ break;
+ case SettleBillState.已开票:
+ if (state == SettleBillState.商务已审核)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【商务已审核】状态,无法设置成【已开票】");
+ }
+ break;
+ case SettleBillState.客户已收票:
+ if (state == SettleBillState.已扣减)
+ {
+ p_entiy.State = state;
+ }
+ else
+ {
+ throw new BusinessException("8989", "当前状态不是【已扣减】状态,无法设置成【客户已收票】状态");
+ }
+ break;
+ }
+
+
+ var flag = await SetSettleState(p_entiy, p_State,false);
+ if (flag == false)
+ {
+ return false;
+ }
await _repository.UpdateAsync(p_entiy);
+
+
return true;
}
+
+
+
///
/// 获得发票主表
///
@@ -304,8 +535,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
foreach (var p_entity in _ls)
{
- if (p_entity.State == InvoiceBillState.财务已审核
- || p_entity.State == InvoiceBillState.已开票 || p_entity.State == InvoiceBillState.商务已审核)
+ if (p_entity.State == SettleBillState.财务已审核
+ || p_entity.State == SettleBillState.已开票 || p_entity.State == SettleBillState.商务已审核)
{
var entList = _repository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
var groupList = _groupRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
@@ -325,7 +556,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
- if (p_entity.State == InvoiceBillState.已扣减)
+ if (p_entity.State == SettleBillState.已扣减)
{
}
@@ -349,7 +580,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
///
///
///
- public virtual async Task Back(string billNum)
+ public virtual async Task BackAsync(string billNum)
{
var _ls = await _repository.Where(p => p.InvGroupNum == billNum).ToListAsync();
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs
index 4ceab066..e85fb8c5 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs
@@ -3,8 +3,50 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Microsoft.EntityFrameworkCore;
+using SettleAccount.Bases;
+using Volo.Abp.Application.Dtos;
+using Volo.Abp.Domain.Repositories;
+using Volo.Abp.Domain.Services;
+using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers;
-public class PD_MNG
+public class PD_MNG:DomainService
+ where TEntity : PD_BASE_MAIN
+ where TEntityDetail : PD_BASE
+
{
+
+ private readonly INormalEfCoreRepository _repository;
+ private readonly INormalEfCoreRepository _detailRepository;
+
+
+
+ protected PD_MNG(
+ INormalEfCoreRepository repository,
+
+ INormalEfCoreRepository detailRepository
+
+ )
+ {
+
+ _repository = repository;
+ _detailRepository = detailRepository;
+
+
+ }
+
+
+ public virtual async Task GetMainAsync(string billNum)
+ {
+ return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync();
+ }
+
+ public virtual async Task> GetDetailAsync(string billNum)
+ {
+ return await _detailRepository.Where(p => p.InvGroupNum == billNum).ToListAsync();
+ }
+
+
+
}