Browse Source

提交domainservice

master
学 赵 1 year ago
parent
commit
15be2a98a0
  1. 86
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/ExportReports/ErrorExportDto.cs
  2. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs
  3. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs
  4. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs
  5. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs
  6. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_NOT_SA_SERVICE.cs
  7. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs
  8. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_NOT_SA_SERVICE.cs
  9. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/INVOICE_SERVICE.cs
  10. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs
  11. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  12. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  13. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  14. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_PD_DETAIL.cs
  15. 50
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs
  16. 283
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/INV_MNG.cs
  17. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs
  18. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  19. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_PD_DETAIL.cs
  20. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs
  21. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

86
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/ExportReports/ErrorExportDto.cs

@ -1,4 +1,4 @@
// 闻荫智慧工厂管理套件
// 闻荫智慧工厂管理套件
// Copyright (c) 闻荫科技 www.ccwin-in.com
using Magicodes.ExporterAndImporter.Core;
@ -11,6 +11,90 @@ using Win.Sfs.Shared.Enums;
namespace Win.Sfs.SettleAccount.ExportReports
{
/// <summary>
/// 错误信息说明
/// </summary>
public class ERR_EXP_DTO : EntityDto
{
public ERR_EXP_DTO()
{
}
public ERR_EXP_DTO(string version, string customCode, string type, string model, string itemCode, string itemDesc, string message, string remark)
{
Version = version;
CustomCode = customCode;
Type = type;
Model = model;
ItemCode = itemCode;
ItemDesc = itemDesc;
Message = message;
Remark = remark;
}
/// <summary>
/// 版本
/// </summary>
[Display(Name = "版本")]
public string Version { set; get; }
/// <summary>
/// 客户代码
/// </summary>
[Display(Name = "客户代码")]
public string CustomCode { get; set; }
/// <summary>
/// 影响类型
/// </summary>
[Display(Name = "错误类型")]
public string Type { get; set; }
/// <summary>
/// 问题模块
/// </summary>
[Display(Name = "问题模块")]
public string Model { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
public string ItemCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
public string ItemDesc { get; set; }
/// <summary>
/// 错误信息
/// </summary>
[Display(Name = "提醒信息")]
public string Message { get; set; }
/// <summary>
/// 金额差异
/// </summary>
[Display(Name = "备注")]
public string Remark { get; set; }
}
/// <summary>
/// 错误信息说明
/// </summary>

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BASE_SERVICE.cs

@ -1,4 +1,4 @@
using Shouldly;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Linq;
@ -23,7 +23,7 @@ namespace Win.Sfs.SettleAccount.Bases
{
protected readonly IExcelImportAppService _excelImportService;
private readonly IExcelImportAppService _excelImportService;
protected readonly ISnowflakeIdGenerator _snowflakeIdGenerator;
@ -50,7 +50,7 @@ namespace Win.Sfs.SettleAccount.Bases
/// <param name="errorList"></param>
/// <param name="fileName"></param>
/// <returns></returns>
protected async Task<string> ExportErrorReportAsync(List<ErrorExportDto> errorList, string fileName = "")
protected async Task<string> ExportErrorReportAsync(List<ERR_EXP_DTO> errorList, string fileName = "")
{
//没有信息返回成功
if (errorList == null || errorList.Count == 0)

39
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs

@ -1,7 +1,10 @@
using Magicodes.ExporterAndImporter.Core;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using NPOI.SS.Formula.Functions;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using Shouldly;
@ -19,6 +22,7 @@ using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant;
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;
@ -31,6 +35,12 @@ namespace Win.Sfs.SettleAccount.Bases
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _wRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _sRepository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _mRepository;
private readonly CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> _pubMng;
private readonly CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> _bbacMng;
private readonly CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> _hbpoMng;
private readonly INV_MNG _invMng;
//private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly IExcelImportAppService _excelImportService;
@ -40,8 +50,11 @@ namespace Win.Sfs.SettleAccount.Bases
INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository,
IExcelImportAppService excelImportService
IExcelImportAppService excelImportService,
CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng,
CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng,
CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng,
INV_MNG invMng
//INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
)
@ -52,6 +65,11 @@ namespace Win.Sfs.SettleAccount.Bases
_wRepository = wRepository;
_mRepository = mRepository;
_sRepository = sRepository;
_pubMng = pubMng;
_bbacMng = bbacMng;
_hbpoMng = hbpoMng;
_invMng = invMng;
}
/// <summary>
@ -156,9 +174,20 @@ namespace Win.Sfs.SettleAccount.Bases
protected virtual async Task<string> RuleAsync(INVOICE_GRP_REQ_DTO input)
[HttpPost]
public virtual async Task<string> ReceivedAsync(INVOICE_GRP_REQ_DTO input)
{
var entity=await _invMng.GetMainAsync(input.InvGroupNum);
if (entity != null)
{
bool flag = await _invMng.ReceivedAsync(entity.InvGroupNum);
if (flag == true)
{
await _invMng.SetForwardState(entity, InvoiceBillState.);
}
}
return ApplicationConsts.SuccessStr;
}

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/PD_SERVICE.cs

@ -1,8 +1,9 @@
using AutoMapper;
using AutoMapper;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Bases;
using Shouldly;
using System;
@ -141,6 +142,17 @@ namespace Win.Sfs.SettleAccount.Bases
return ApplicationConsts.SuccessStr;
}
public virtual async Task<TEntity> GetMainByBillNum(string billNum)
{
return await _repository.Where(p=>p.InvGroupNum == billNum).FirstOrDefaultAsync();
}
public virtual async Task<List<TEntityDetail>> GetDetailByBillNum(string billNum)
{
return await _detailRepository.Where(p => p.InvGroupNum == billNum).ToListAsync();
}

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -20,9 +21,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/bbac_ba_service")]
public class BBAC_BA_SERVICE : BA_SERVICE
{
public BBAC_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository,
INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService)
: base(repository, wRepository, sRepository, mRepository, excelImportService)
public BBAC_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng, CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng, CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
{
}
}

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

@ -1,4 +1,4 @@
using EFCore.BulkExtensions;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
@ -46,7 +46,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
billNum: billNum,
settleBillNum: string.Empty,
state: SettleBillState.,
invGroupNum: billNum
invGroupNum: billNum,
site:entitys.FirstOrDefault().Site
);
List<BBAC_CAN_SA_DETAIL> ls = new List<BBAC_CAN_SA_DETAIL>();
@ -70,6 +72,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
);
}
await _detailRepository.DbContext.BulkInsertAsync(ls);
await _detailRepository.DbContext.BulkDeleteAsync(entitys);
await _detailRepository.DbContext.BulkInsertAsync(new List<BBAC_CAN_SA>() { bbac});

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

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -17,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/hbpo_ba_service")]
public class HBPO_BA_SERVICE : BA_SERVICE
{
public HBPO_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService) : base(repository, wRepository, sRepository, mRepository, excelImportService)
public HBPO_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng, CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng, CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
{
}
}

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

@ -1,4 +1,4 @@
using EFCore.BulkExtensions;
using EFCore.BulkExtensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -42,7 +42,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
billNum: billNum,
settleBillNum: string.Empty,
state: SettleBillState.,
invGroupNum: billNum
invGroupNum: billNum,
site:entitys.FirstOrDefault().Site
);
List<HBPO_CAN_SA_DETAIL> ls = new List<HBPO_CAN_SA_DETAIL>();

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

@ -1,4 +1,4 @@
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Authorization;
@ -15,6 +15,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
@ -57,15 +58,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_bbacMng = bbacMng;
_hbpoMng = hbpoMng;
_invMng = invMng;
}
[HttpPost]
public virtual async Task<string> ApprovalPassed(INVOICE_GRP_REQ_DTO input)
{
var inv=_repository.Where(p=>p.InvGroupNum == input.InvGroupNum).FirstOrDefault();
return string.Empty;
await _invMng.SetForwardState(inv, InvoiceBillState.);
return ApplicationConsts.SuccessStr;
}
[HttpPost]
@ -82,11 +90,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
INVOICE_GRP_DETAIL_DTO _entity = new INVOICE_GRP_DETAIL_DTO();
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var m = await _mRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var mdtos = ObjectMapper.Map<List<INVOICE_MAP_GROUP>, List<INVOICE_MAP_GROUP_DTO>>(m);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var w = await _wRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var wdtos = ObjectMapper.Map<List<INVOICE_WAIT_DETAIL>, List<INVOICE_WAIT_DETAIL_DTO>>(w);
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var s = await _sRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, input.SkipCount);
var sdtos = ObjectMapper.Map<List<INVOICE_NOT_SETTLE>, List<INVOICE_NOT_SETTLE_DTO>>(s);
_entity.INVOICE_NOT_SETTLE = sdtos;
_entity.INVOICE_WAIT_DETAIL = wdtos;

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

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using SettleAccount.Domain.BQ;
using System;
@ -9,6 +9,7 @@ using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Managers;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
@ -17,7 +18,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
[Route("api/settleaccount/pub_ba_service")]
public class PUB_BA_SERVICE : BA_SERVICE
{
public PUB_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService) : base(repository, wRepository, sRepository, mRepository, excelImportService)
public PUB_BA_SERVICE(INormalEfCoreRepository<INVOICE_GRP, Guid> repository, INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> wRepository, INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> sRepository, INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> mRepository, IExcelImportAppService excelImportService, CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng, CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng, CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng, INV_MNG invMng) : base(repository, wRepository, sRepository, mRepository, excelImportService, pubMng, bbacMng, hbpoMng, invMng)
{
}
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@ -61,6 +61,9 @@ namespace SettleAccount.Bases
[Display(Name = "发票分组号")]
public virtual string InvGroupNum { get; set; } = null!;
public virtual string Site { get; set; }
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
@ -35,7 +35,7 @@ public class BBAC_CAN_SA : SA_CAN_BASE_MAIN
public BBAC_CAN_SA(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum)
public BBAC_CAN_SA(Guid guid, int version, string billNum, string settleBillNum, SettleBillState state, string invGroupNum,string site)
{
Id = guid;
Version = version;
@ -43,6 +43,7 @@ public class BBAC_CAN_SA : SA_CAN_BASE_MAIN
SettleBillNum = settleBillNum;
State = state;
InvGroupNum = invGroupNum;
Site = site;
}
}

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

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
@ -31,16 +31,17 @@ public class HBPO_CAN_SA : SA_CAN_BASE_MAIN
/// <summary>
/// 工厂地点
/// </summary>
[Display(Name = "工厂地点")]
public string Site { get; set; } = null!;
//[Display(Name = "工厂地点")]
//public string Site { get; set; } = null!;
public HBPO_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, SettleBillState state, string invGroupNum)
public HBPO_CAN_SA(Guid guid, int version, string settleBillNum, string billNum, SettleBillState state, string invGroupNum,string site)
{
Version = version;
SettleBillNum = settleBillNum;
BillNum = billNum;
State = state;
InvGroupNum = invGroupNum;
Site = site;
}
public HBPO_CAN_SA()

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_PD_DETAIL.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
@ -45,7 +45,9 @@ public class HBPO_PD_DETAIL :PD_BASE
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
public HBPO_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, string invGroupNum, DateTime settleDate, string groupNum)
public HBPO_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, string invGroupNum,
DateTime settleDate, string groupNum, string extend1, string extend2, string extend3, string extend4
)
{
Id = guid;
KeyCode = keyCode;
@ -61,6 +63,11 @@ public class HBPO_PD_DETAIL :PD_BASE
InvGroupNum = invGroupNum;
SettleDate = settleDate;
GroupNum = groupNum;
Extend1 = extend1;
Extend2 = extend2;
Extend3 = extend3;
Extend4 = extend4;
}
public HBPO_PD_DETAIL()

50
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/CAN_SA_MNG.cs

@ -1,4 +1,4 @@
using EFCore.BulkExtensions;
using EFCore.BulkExtensions;
using Hangfire.Annotations;
using Microsoft.EntityFrameworkCore;
using SettleAccount.Bases;
@ -41,10 +41,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
return true;
}
else
{
return false;
}
}
@ -89,13 +87,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
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", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
throw new BusinessException("8989", "当前状态不是[财务已审核],无法设置成【客户已收票】状态");
}
break;
}
@ -110,7 +118,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<bool> SetNewState(TEntity p_entiy)
{
await SetNewState(p_entiy.BillNum);
return await SetNewState(p_entiy.BillNum);
}
@ -118,20 +125,37 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
public virtual async Task<bool> SetNewState(string billNum)
{
var ls = _repository.Where(p => p.InvGroupNum == billNum).ToList();
foreach (var l in ls)
var entity= await GetMainAsync(billNum);
if (entity != null )
{
l.State = SettleBillState.;
}
await _repository.DbContext.BulkReadAsync(ls);
entity.State = SettleBillState.;
await _repository.UpdateAsync(entity);
return true;
}
public virtual async Task<List<TEntityDetail>> GetAllList(string billNum)
return false;
;
}
/// <summary>
/// 获得所有明细
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<List<TEntityDetail>> GetDetalListAsync(string billNum)
{
return await _detailRepository.Where(p=>p.InvGroupNum==billNum).ToListAsync();
}
/// <summary>
/// 获得主表信息
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<TEntity> GetMainAsync(string billNum)
{
return await _repository.Where(p => p.InvGroupNum == billNum).FirstOrDefaultAsync();
}

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

@ -1,4 +1,6 @@
using EFCore.BulkExtensions;
using EFCore.BulkExtensions;
using Hangfire;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using NPOI.SS.Formula.Functions;
using SettleAccount.Bases;
@ -9,6 +11,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;
using Win.Sfs.Shared.RepositoryBase;
@ -18,11 +21,22 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
{
//private readonly INormalEfCoreRepository<TCAN_SA, Guid> _canRepository;
private readonly INormalEfCoreRepository<INVOICE_GRP, Guid> _repository;
private readonly INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> _groupRepository;
private readonly INormalEfCoreRepository<INVOICE_WAIT_DETAIL, Guid> _detailRepository;
private readonly INormalEfCoreRepository<INVOICE_NOT_SETTLE, Guid> _notRepository;
private readonly CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> _pubMng;
private readonly CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> _bbacMng;
private readonly CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> _hbpoMng;
public INV_MNG
(
CAN_SA_MNG<PUB_CAN_SA, PUB_CAN_SA_DETAIL> pubMng,
CAN_SA_MNG<BBAC_CAN_SA, BBAC_CAN_SA_DETAIL> bbacMng,
CAN_SA_MNG<HBPO_CAN_SA, HBPO_CAN_SA_DETAIL> hbpoMng,
//INormalEfCoreRepository<TCAN_SA, Guid> canRepository,
INormalEfCoreRepository<INVOICE_GRP, Guid> repository,
INormalEfCoreRepository<INVOICE_MAP_GROUP, Guid> groupRepository,
@ -36,7 +50,23 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
_detailRepository = detailRepository;
_groupRepository = groupRepository;
_notRepository = notRepository;
_pubMng = pubMng;
_bbacMng = bbacMng;
_hbpoMng = hbpoMng;
}
public virtual async Task<bool> SetForwardState(string p_groupBillnum , InvoiceBillState p_State)
{
var _first=_repository.Where(p => p.InvbillNum == p_groupBillnum).FirstOrDefault();
if (_first != null)
{
return await SetForwardState(_first, p_State);
}
return false;
}
public virtual async Task<bool> SetForwardState(INVOICE_GRP p_entiy, InvoiceBillState p_State)
{
var state = p_State;
@ -63,13 +93,13 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
break;
case InvoiceBillState.:
if (state == InvoiceBillState.)
if (state == InvoiceBillState.)
{
p_entiy.State = state;
}
else
{
throw new BusinessException("8989", "当前状态不是【商务已审核】,无法设置成【财务已审核】状态");
throw new BusinessException("8989", "当前状态不是【客户已收票】状态,无法设置成【已扣减】状态");
}
break;
}
@ -77,11 +107,176 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
return true;
}
public virtual async Task<INVOICE_GRP> GetEntityByBillNum(string p_billNum)
/// <summary>
/// 获得发票主表
/// </summary>
/// <param name="p_billNum"></param>
/// <returns></returns>
public virtual async Task<INVOICE_GRP> GetMainAsync(string p_groupbillNum)
{
return await _repository.Where(p => p.InvbillNum == p_groupbillNum).FirstOrDefaultAsync();
}
/// <summary>
/// 已收票
/// </summary>
/// <param name="p_groupbillnum">发票分组号</param>
/// <returns></returns>
public virtual async Task<bool> ReceivedAsync(string p_groupbillnum)
{
var inv = _repository.Where(p => p.InvGroupNum == p_groupbillnum).FirstOrDefault();
if (inv.BusinessType == EnumBusinessType.BBAC)
{
var entity = await _bbacMng.GetMainAsync(inv.InvGroupNum);
if (entity == null)
{
var entityDetail = await _bbacMng.GetDetalListAsync(inv.InvGroupNum);
var bbac = new BBAC_PD(
guid: entity.Id,
version: entity.Version,
billNum: entity.BillNum,
settleBillNum: entity.SettleBillNum,
state: SettleBillState.,
invGroupNum: entity.InvGroupNum,
site: entity.Site
);
var bbacDetail = new List<BBAC_PD_DETAIL>();
foreach (var itm in entityDetail)
{
bbacDetail.Add(
new BBAC_PD_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.BillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
));
await _repository.DbContext.BulkInsertAsync(new List<BBAC_PD>() { bbac });
await _repository.DbContext.BulkInsertAsync(bbacDetail);
return true;
}
}
}
else if (inv.BusinessType == EnumBusinessType.HBPO)
{
var entity = await _hbpoMng.GetMainAsync(inv.InvGroupNum);
if (entity != null)
{
var entityDetail = await _hbpoMng.GetDetalListAsync(inv.InvGroupNum);
if (entityDetail != null && entityDetail.Count() > 0)
{
var hbpo = new HBPO_PD(
guid: entity.Id,
version: entity.Version,
billNum: entity.BillNum,
settleBillNum: entity.SettleBillNum,
state: SettleBillState.,
invGroupNum: entity.InvGroupNum,
site: entity.Site
);
var hbpoDetail = new List<HBPO_PD_DETAIL>();
foreach (var itm in entityDetail)
{
hbpoDetail.Add(
new HBPO_PD_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.BillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty
));
}
await _repository.DbContext.BulkInsertAsync(new List<HBPO_PD>() { hbpo });
await _repository.DbContext.BulkInsertAsync(hbpoDetail);
return true;
}
}
}
else
{
var entity = await _pubMng.GetMainAsync(inv.InvGroupNum);
if (entity != null)
{
var entityDetail = await _pubMng.GetDetalListAsync(inv.InvGroupNum);
if (entityDetail != null && entityDetail.Count() > 0)
{
return await _repository.Where(p => p.InvGroupNum == p_billNum).FirstOrDefaultAsync();
var pub = new PUB_PD(
guid: entity.Id,
version: entity.Version,
billNum: entity.BillNum,
settleBillNum: entity.SettleBillNum,
state: SettleBillState.,
invGroupNum: entity.InvGroupNum,
site: entity.Site
);
var pubDetail = new List<PUB_PD_DETAIL>();
foreach (var itm in entityDetail)
{
pubDetail.Add(
new PUB_PD_DETAIL(
guid: itm.Id,
keyCode: itm.KeyCode,
version: itm.Version,
billNum: itm.BillNum,
lU: itm.LU,
rELU: string.Empty,
pN: itm.PN,
rEPN: string.Empty,
site: itm.Site,
qty: itm.Qty,
price: itm.Price,
invGroupNum: itm.InvGroupNum,
settleDate: itm.SettleDate,
groupNum: itm.GroupNum,
extend1: string.Empty,
extend2: string.Empty,
extend3: string.Empty,
extend4: string.Empty,
businessType: itm.BusinessType
));
}
await _repository.DbContext.BulkInsertAsync(new List<PUB_PD>() { pub });
await _repository.DbContext.BulkInsertAsync(pubDetail);
return true;
}
}
}
return false;
}
public virtual async Task<bool> Reject(INVOICE_GRP p_entity)
@ -95,11 +290,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
public virtual async Task<bool> Reject(string billNum)
/// <summary>
/// 退回
/// </summary>
/// <param name="billNum">发票分组号</param>
/// <returns></returns>
public virtual async Task<bool> Reject(string groupbillNum)
{
var _ls=await _repository.Where(p => p.InvGroupNum == billNum).ToListAsync();
var _ls=await _repository.Where(p => p.InvGroupNum == groupbillNum).ToListAsync();
if (_ls != null && _ls.Count > 0)
{
@ -145,6 +344,74 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Managers
}
/// <summary>
/// 返回到财务审核状态
/// </summary>
/// <param name="billNum"></param>
/// <returns></returns>
public virtual async Task<bool> Back(string billNum)
{
var _ls = await _repository.Where(p => p.InvGroupNum == billNum).ToListAsync();
if (_ls != null && _ls.Count > 0)
{
foreach (var p_entity in _ls)
{
}
}
//if (_ls != null && _ls.Count > 0)
//{
// foreach (var p_entity in _ls)
// {
// if (p_entity.State == InvoiceBillState.财务已审核
// || p_entity.State == InvoiceBillState.已开票 || p_entity.State == InvoiceBillState.商务已审核)
// {
// var entList = _repository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
// var groupList = _groupRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
// var notList = _notRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
// var detailList = _detailRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
// //var canList = _canRepository.Where(p => p.InvGroupNum == p_entity.InvGroupNum).ToList();
// //foreach (var itm in canList)
// //{
// // itm.State = SettleBillState.未结状态;
// //}
// await _repository.DbContext.BulkDeleteAsync(entList);
// await _repository.DbContext.BulkDeleteAsync(groupList);
// await _repository.DbContext.BulkDeleteAsync(notList);
// await _repository.DbContext.BulkDeleteAsync(detailList);
// //await _repository.DbContext.BulkUpdateAsync(canList);
// }
// if (p_entity.State == InvoiceBillState.已扣减)
// {
// }
// }
//}
//else
//{
//}
return true;
}

10
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Managers/PD_MNG.cs

@ -0,0 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Entities.BQ.Managers;
public class PD_MNG
{
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;

15
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_PD_DETAIL.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Win.Sfs.SettleAccount;
@ -52,7 +52,12 @@ public class PUB_PD_DETAIL :PD_BASE
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
public PUB_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, EnumBusinessType businessType, string invGroupNum, DateTime settleDate, string groupNum)
public PUB_PD_DETAIL(Guid guid, string keyCode, int version, string billNum, string lU, string rELU, string pN, string rEPN, string site, decimal qty, decimal price, EnumBusinessType businessType, string invGroupNum, DateTime settleDate, string groupNum
, string extend1, string extend2, string extend3, string extend4
)
{
Id = guid;
KeyCode = keyCode;
@ -69,6 +74,12 @@ public class PUB_PD_DETAIL :PD_BASE
InvGroupNum = invGroupNum;
SettleDate = settleDate;
GroupNum = groupNum;
Extend1 = extend1;
Extend2 = extend2;
Extend3 = extend3;
Extend4 = extend4;
}
public PUB_PD_DETAIL()

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs

@ -1,4 +1,4 @@
using SettleAccount.Bases;
using SettleAccount.Bases;
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;

12
code/src/Modules/SettleAccount/src/SettleAccount.Domain/EnumBillState.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
@ -27,7 +27,9 @@ namespace Win.Sfs.SettleAccount
[Description("财务已审核")]
= 3,
[Description("已扣减")]
= 4,
= 5,
[Description("客户已收票")]
= 4,
}
@ -40,7 +42,11 @@ namespace Win.Sfs.SettleAccount
[Description("财务已审核")]
= 3,
[Description("已扣减")]
= 4,
= 5,
[Description("客户已收票")]
= 4,
}

Loading…
Cancel
Save