wanggang 1 year ago
parent
commit
0ac592a5db
  1. 2
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json
  2. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs
  3. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs
  4. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs
  5. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs
  6. 51
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  7. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs
  8. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs
  9. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs
  10. 29
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IHBPO_CAN_SA_SERVICE.cs
  11. 121
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs
  12. 107
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs
  13. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/OrderNumberGenerator.cs
  14. 103
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  15. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs
  16. 82
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs
  17. 167
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs
  18. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  19. 13
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  20. 3980
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230713031306_20230713-1.Designer.cs
  21. 206
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230713031306_20230713-1.cs
  22. 118
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

2
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/appsettings.json

@ -3,7 +3,7 @@
"CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088" "CorsOrigins": "https://*.abc.com,http://localhost:9527,http://149.223.116.5:8088"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True", "Default": "Server=dev.ccwin-in.com,13319;Database=BJABP;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True",
"SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;" "SettleAccountService": "Server=dev.ccwin-in.com,13319;Database=BQ_SA;User ID=ccwin-in;Password=Microsoft@2022;Trusted_Connection=False;TrustServerCertificate=True;"
}, },

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_DETAIL_DTO.cs

@ -1,13 +1,14 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// BBAC发运 /// BBAC发运
/// </summary> /// </summary>
public class BBAC_SE_DETAIL_DTO public class BBAC_SE_DETAIL_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 期间 /// 期间

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/BBAC_SE_EDI_DTO.cs

@ -1,13 +1,14 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// BBAC的EDI数据 /// BBAC的EDI数据
/// </summary> /// </summary>
public class BBAC_SE_EDI_DTO public class BBAC_SE_EDI_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// LU+生产码 /// LU+生产码

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_DETAIL_DTO.cs

@ -5,13 +5,14 @@ using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// HBPO发运单 /// HBPO发运单
/// </summary> /// </summary>
public class HBPO_SE_DETAIL_DTO public class HBPO_SE_DETAIL_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 期间 /// 期间

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/HBPO_SE_EDI_DTO.cs

@ -1,13 +1,14 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System; using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// HBPO的EDI数据 /// HBPO的EDI数据
/// </summary> /// </summary>
public class HBPO_SE_EDI_DTO public class HBPO_SE_EDI_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// LU+生产码 /// LU+生产码

51
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{
/// <summary>
/// PUB结算
/// </summary>
public class PUB_SA_DTO : EntityDto<Guid>
{
/// <summary>
/// 期间
/// </summary>
[Display(Name = "期间")]
public int Version { get; set; }
/// <summary>
/// 结算单据
/// </summary>
[Display(Name = "结算单据")]
public string BillNum { get; set; }
/// <summary>
/// 状态
/// </summary>
[Display(Name = "状态")]
public string State { get; set; }
}
/// <summary>
/// 导入
/// </summary>
public class PUB_SA_IMPORT_DTO
{
}
/// <summary>
/// 导出
/// </summary>
public class PUB_SA_EXPORT_DTO
{
}
}

3
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SE_DETAIL_DTO.cs

@ -5,13 +5,14 @@ using System.ComponentModel.DataAnnotations;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// PUB发运数据 /// PUB发运数据
/// </summary> /// </summary>
public class PUB_SE_DETAIL_DTO public class PUB_SE_DETAIL_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 期间 /// 期间

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PURCHASE_PRICE_DTO.cs

@ -1,5 +1,7 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
using Win.Sfs.Shared.DtoBase; using Win.Sfs.Shared.DtoBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
@ -7,7 +9,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// <summary> /// <summary>
/// 采购价格单 /// 采购价格单
/// </summary> /// </summary>
public class PURCHASE_PRICE_DTO public class PURCHASE_PRICE_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 零件号 /// 零件号

4
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/TB_RePartsRelationship_DTO.cs

@ -1,12 +1,14 @@
using Magicodes.ExporterAndImporter.Core; using Magicodes.ExporterAndImporter.Core;
using System;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using Volo.Abp.Application.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
{ {
/// <summary> /// <summary>
/// 客户替换件关系 /// 客户替换件关系
/// </summary> /// </summary>
public class TB_RePartsRelationship_DTO public class TB_RePartsRelationship_DTO : EntityDto<Guid>
{ {
/// <summary> /// <summary>
/// 零件号 /// 零件号

29
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/IHBPO_CAN_SA_SERVICE.cs

@ -1,13 +1,40 @@
using System; using SettleAccount.Bases;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
using Win.Sfs.SettleAccount.Bases;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos; using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
namespace Win.Sfs.SettleAccount.Entities.BQ namespace Win.Sfs.SettleAccount.Entities.BQ
{ {
public interface ICAN_SA_SERVICE<TEntity, TEntityDto, TEntityDetailDto, TRequestMainInput, TRequestDetailInput, TExportDto>
where TEntity : SA_CAN_BASE
where TEntityDto : class, IEntityDto<Guid>, new()
where TEntityDetailDto : class, IEntityDto<Guid>, new()
where TRequestMainInput : PagedAndSortedResultRequestDto
where TRequestDetailInput : PagedAndSortedResultRequestDto
{
Task<bool> GenerateInvoice(TRequestMainInput input);
Task<PagedResultDto<TEntityDto>> MainQueryAsync(TRequestMainInput input);
Task<PagedResultDto<TEntityDetailDto>> DetailQueryAsync(TRequestDetailInput input);
Task<string> ExportAsync(TRequestMainInput input);
// List<ErrorData> ISettlementOrderCheckRule<TEntity>(List<TEntity> p_list, Configuation config) where TEntity : ISABASE
//bList<ErrorData> ISettlementOrderCheckState<TEntity>(List<TEntity> p_list) where TEntity:ISABASE
}
public interface IHBPO_CAN_SA_SERVICE public interface IHBPO_CAN_SA_SERVICE
{ {
Task<bool> GenerateInvoice(HBPO_CAN_SA_REQ_DTO input); Task<bool> GenerateInvoice(HBPO_CAN_SA_REQ_DTO input);

121
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/CAN_SA_SERVICE.cs

@ -0,0 +1,121 @@
using AutoMapper;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Bases;
using Shouldly;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Volo.Abp.ObjectMapping;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases
{
public class CAN_SA_SERVICE<TEntity, TEntityDto, TEntityDetail, TEntityDetailDto, TRequestMainInput, TRequestDetailInput, TEntityDetailExportDto> :ApplicationService
where TEntity : class, IEntity<Guid>
where TEntityDetail:SA_CAN_BASE
where TEntityDto : class, IEntityDto<Guid>, new()
where TEntityDetailDto : class, IEntityDto<Guid>, new()
where TRequestMainInput : RequestInputBase
where TRequestDetailInput : RequestInputBase
where TEntityDetailExportDto : class, new()
{
private readonly INormalEfCoreRepository<TEntity, Guid> _repository;
private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly IExcelImportAppService _excelImportService;
protected CAN_SA_SERVICE(
INormalEfCoreRepository<TEntity, Guid> repository,
IExcelImportAppService excelImportService,
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
)
{
_excelImportService = excelImportService;
_repository = repository;
_detailRepository = detailRepository;
}
[HttpPost]
//[Route("detailquery")]
public virtual async Task<PagedResultDto<TEntityDetailDto>> DetailQueryAsync(TRequestDetailInput input)
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys);
return new PagedResultDto<TEntityDetailDto>(totalCount, dtos);
}
[HttpPost]
//[Route("export")]
public virtual async Task<string> ExportAsync(TRequestDetailInput input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtoDetails = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailExportDto>>(entities);
var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TEntityDetailExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;
switch (input.FileType)
{
case 0:
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
[HttpPost]
//[Route("generateinvoice")]
public Task<bool> GenerateInvoice(TRequestMainInput input)
{
throw new NotImplementedException();
}
[HttpPost]
//[Route("mainquery")]
public virtual async Task<PagedResultDto<TEntityDto>> MainQueryAsync(TRequestMainInput input)
{
var entitys = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<TEntity>, List<TEntityDto>>(entitys);
return new PagedResultDto<TEntityDto>(totalCount, dtos);
}
}
}

107
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/NOT_SA_SERVICE.cs

@ -0,0 +1,107 @@
using AutoMapper;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Csv;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Bases;
using Shouldly;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Entities;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Bases
{
internal class NOT_SA_SERVICE<TEntityDetail, TEntityDetailDto, TRequestDetailInput, TEntityDetailExportDto> : ApplicationService
where TEntityDetail : SA_CAN_BASE
where TEntityDetailDto : class, IEntityDto<Guid>, new()
where TRequestDetailInput : RequestInputBase
where TEntityDetailExportDto : class, new()
{
private readonly INormalEfCoreRepository<TEntityDetail, Guid> _detailRepository;
private readonly IExcelImportAppService _excelImportService;
protected NOT_SA_SERVICE(
IExcelImportAppService excelImportService,
INormalEfCoreRepository<TEntityDetail, Guid> detailRepository
)
{
_excelImportService = excelImportService;
_detailRepository = detailRepository;
}
[HttpPost]
//[Route("detailquery")]
public virtual async Task<PagedResultDto<TEntityDetailDto>> DetailQueryAsync(TRequestDetailInput input)
{
var entitys = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount);
var totalCount = await _detailRepository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailDto>>(entitys);
return new PagedResultDto<TEntityDetailDto>(totalCount, dtos);
}
[HttpPost]
//[Route("export")]
public virtual async Task<string> ExportAsync(TRequestDetailInput input)
{
IExporter _csv = new CsvExporter();
IExporter _excel = new ExcelExporter();
var entities = await _detailRepository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtoDetails = ObjectMapper.Map<List<TEntityDetail>, List<TEntityDetailExportDto>>(entities);
var classDisplayName = typeof(TEntityDetailExportDto).GetCustomAttribute<DisplayAttribute>()?.Name ?? typeof(TEntityDetailExportDto).Name;
string _fileName = $"{classDisplayName}_{Guid.NewGuid().ToString()}.xlsx";
byte[] result = null;
switch (input.FileType)
{
case 0:
result = await _csv.ExportAsByteArray(dtoDetails);
break;
case 1:
result = await _excel.ExportAsByteArray(dtoDetails);
break;
}
result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制
await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto
{
Name = _fileName,
Content = result
}
);
return _fileName;
}
}
}

37
code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/OrderNumberGenerator.cs

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Win.Sfs.SettleAccount.Bases
{
public class OrderNumberGenerator
{
private static readonly object lockObject = new object();
private static int sequence = 0;
/// <summary>
/// 如无类别
/// </summary>
/// <param name="p_OrderType"></param>
/// <returns></returns>
public static string GenerateOrderNumber(string p_OrderType)
{
lock (lockObject)
{
// 获取当前时间和日期部分
string currentDate = DateTime.Now.ToString("yyMMddHHmmss");
// 获取序列号部分
string sequenceNumber = Interlocked.Increment(ref sequence).ToString().PadLeft(6, '0');
// 拼接单号
string orderNumber = $"{p_OrderType}-{currentDate}-{sequenceNumber}";
return orderNumber;
}
}
}
}

103
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -0,0 +1,103 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Shouldly;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ
{
/// <summary>
/// PUB结算
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class PUB_SA_SERVICE : SettleAccountApplicationBase<TB_RePartsRelationship>
{
/// <summary>
/// PUB结算仓储
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA, Guid> _repository;
/// <summary>
/// 构造
/// </summary>
public PUB_SA_SERVICE(INormalEfCoreRepository<PUB_SA, Guid> repository,
IDistributedCache<TB_RePartsRelationship> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager
) : base(cache, excelImportService, snowflakeIdGenerator, commonManager)
{
_repository = repository;
}
#region 导入、导出
/// <summary>
/// 导入
/// </summary>
[HttpPost]
public async Task<string> ImportAsync([FromForm] IFormFileCollection files)
{
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<PUB_SA_IMPORT_DTO>(files, _excelImportService);
var _ls = ObjectMapper.Map<List<PUB_SA_IMPORT_DTO>, List<PUB_SA>>(result);
await _repository.InsertManyAsync(_ls);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导出
/// </summary>
[HttpPost]
public async Task<string> ExportAsync(RequestDto input)
{
string fileName = $"HBPO的EDI数据_{Guid.NewGuid()}.xlsx";
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue, 0, true);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_EXPORT_DTO>>(entities);
ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtos);
result.ShouldNotBeNull();
await _excelImportService.SaveBlobAsync(new SaveExcelImportInputDto { Name = fileName, Content = result });
return fileName;
}
#endregion
#region CURD
/// <summary>
/// 获取列表
/// </summary>
[HttpPost]
public async Task<PagedResultDto<PUB_SA_DTO>> GetListAsync(RequestDto input)
{
var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var dtos = ObjectMapper.Map<List<PUB_SA>, List<PUB_SA_DTO>>(entities);
return new PagedResultDto<PUB_SA_DTO>(totalCount, dtos);
}
/// <summary>
/// 删除
/// </summary>
[HttpPost]
public async Task DeleteAsync(Guid id)
{
await _repository.DeleteAsync(id);
}
#endregion
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs

@ -24,7 +24,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
/// 采购价格单 /// 采购价格单
/// </summary> /// </summary>
[AllowAnonymous] [AllowAnonymous]
[Route("api/settleaccount/PURCHASE_PRICE_LIST_Service")] [Route("api/settleaccount/[controller]/[action]")]
public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase<PURCHASE_PRICE> public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase<PURCHASE_PRICE>
{ {
/// <summary> /// <summary>

82
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Boms/BomAppService.cs

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Shouldly; using Shouldly;
using System; using System;
@ -27,12 +27,12 @@ namespace Win.Sfs.SettleAccount.Boms
public class BomAppService : SettleAccountApplicationBase<Bom> public class BomAppService : SettleAccountApplicationBase<Bom>
{ {
/// <summary> /// <summary>
/// BOM仓储 /// BOM�ִ�
/// </summary> /// </summary>
private readonly INormalEfCoreRepository<Bom, Guid> _repository; private readonly INormalEfCoreRepository<Bom, Guid> _repository;
/// <summary> /// <summary>
/// 构造 /// ����
/// </summary> /// </summary>
public BomAppService( public BomAppService(
INormalEfCoreRepository<Bom, Guid> repository, INormalEfCoreRepository<Bom, Guid> repository,
@ -45,9 +45,9 @@ namespace Win.Sfs.SettleAccount.Boms
_repository = repository; _repository = repository;
} }
#region 导出 #region ����
/// <summary> /// <summary>
/// 导出 /// ����
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public virtual async Task<string> ExportAsync(BomRequestDto input) public virtual async Task<string> ExportAsync(BomRequestDto input)
@ -57,14 +57,14 @@ namespace Win.Sfs.SettleAccount.Boms
0, true); 0, true);
var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto> >(entities); var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto> >(entities);
//声明导出容器 //������������
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.ExcelExporter(dtoDetails); var result = await _exportImporter.ExcelExporter(dtoDetails);
result.ShouldNotBeNull(); result.ShouldNotBeNull();
//保存导出文件到服务器存成二进制 //���浼���ļ�����������ɶ�����
await _excelImportService.SaveBlobAsync( await _excelImportService.SaveBlobAsync(
new SaveExcelImportInputDto new SaveExcelImportInputDto
{ {
@ -78,7 +78,7 @@ namespace Win.Sfs.SettleAccount.Boms
#region CURD #region CURD
/// <summary> /// <summary>
/// 获取列表 /// ��ȡ�б�
/// </summary> /// </summary>
[HttpPost] [HttpPost]
public async Task<PagedResultDto<BomDto>> GetListAsync(BomRequestDto input) public async Task<PagedResultDto<BomDto>> GetListAsync(BomRequestDto input)
@ -90,13 +90,13 @@ namespace Win.Sfs.SettleAccount.Boms
} }
#endregion #endregion
#region 原方法(废弃) #region ԭ������������
// #region 导入导出功能 // #region ���뵼������
// /// <summary> // /// <summary>
// /// 导入功能 // /// ���빦��
// /// </summary> // /// </summary>
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> // /// <param name="files">�ϴ����ļ�(ǰ���Ѿ�����ֻ���ϴ�һ������)</param>
// /// <returns></returns> // /// <returns></returns>
// [HttpPost] // [HttpPost]
// [Route("ExcelImport-Map")] // [Route("ExcelImport-Map")]
@ -121,7 +121,7 @@ namespace Win.Sfs.SettleAccount.Boms
// { // {
// if (itm.Count > 1) // if (itm.Count > 1)
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("���ܵ��븸����{0},�ӱ���{1}���ظ�����", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
// } // }
// } // }
// var _id = GuidGenerator.Create(); // var _id = GuidGenerator.Create();
@ -131,7 +131,7 @@ namespace Win.Sfs.SettleAccount.Boms
// { // {
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode)) // if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("���������ݲ��������Ϻ�{0}��", itm.ParentItemCode), string.Empty));
// continue; // continue;
// } // }
// itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory); // itm.SetValue(GuidGenerator.Create(), branchId, year, period, version, _id, factory);
@ -150,9 +150,9 @@ namespace Win.Sfs.SettleAccount.Boms
// /// <summary> // /// <summary>
// /// 导入功能 // /// ���빦��
// /// </summary> // /// </summary>
// /// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param> // /// <param name="files">�ϴ����ļ�(ǰ���Ѿ�����ֻ���ϴ�һ������)</param>
// /// <returns></returns> // /// <returns></returns>
// [HttpPost] // [HttpPost]
// [Route("ExcelImport")] // [Route("ExcelImport")]
@ -176,7 +176,7 @@ namespace Win.Sfs.SettleAccount.Boms
// { // {
// if (itm.Count > 1) // if (itm.Count > 1)
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("不能导入父编码{0},子编码{1}有重复数据", itm.ParentItmeCode, itm.ChildItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("���ܵ��븸����{0},�ӱ���{1}���ظ�����", itm.ParentItmeCode, itm.ChildItemCode), string.Empty));
// } // }
// } // }
// var _id = GuidGenerator.Create(); // var _id = GuidGenerator.Create();
@ -186,7 +186,7 @@ namespace Win.Sfs.SettleAccount.Boms
// { // {
// if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode)) // if (!_matList.Any(p => p.MaterialCode == itm.ParentItemCode))
// { // {
// checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("物料主数据不存在物料号{0}!", itm.ParentItemCode), string.Empty)); // checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, itm.ParentItemCode, string.Empty, string.Format("���������ݲ��������Ϻ�{0}��", itm.ParentItemCode), string.Empty));
// continue; // continue;
// } // }
// itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory); // itm.SetValue(GuidGenerator.Create(),branchId,year,period,version,_id,factory);
@ -201,7 +201,7 @@ namespace Win.Sfs.SettleAccount.Boms
// return ApplicationConsts.SuccessStr; // return ApplicationConsts.SuccessStr;
// } // }
// /// <summary> // /// <summary>
// /// 导出文件 // /// �����ļ�
// /// </summary> // /// </summary>
// /// <param name="input"></param> // /// <param name="input"></param>
// /// <returns></returns> // /// <returns></returns>
@ -212,7 +212,7 @@ namespace Win.Sfs.SettleAccount.Boms
// { // {
// IExporter _csv = new CsvExporter(); // IExporter _csv = new CsvExporter();
// IExporter _excel = new ExcelExporter(); // IExporter _excel = new ExcelExporter();
// //导出加上版本过滤条件,不能全导出 // //�������ϰ汾��������������ȫ����
// if (input.ParentId != Guid.Empty) // if (input.ParentId != Guid.Empty)
// { // {
// input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() }); // input.Filters.Add(new FilterCondition() { Action = EnumFilterAction.Equal, Column = "ParentId", Logic = EnumFilterLogic.And, Value = input.ParentId.ToString() });
@ -225,23 +225,23 @@ namespace Win.Sfs.SettleAccount.Boms
// 0, true); // 0, true);
// var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto>>(entities); // var dtoDetails = ObjectMapper.Map<List<Bom>, List<BomExportDto>>(entities);
// string _fileName = string.Empty; // string _fileName = string.Empty;
// //声明导出容器 // //������������
// byte[] result = null; // byte[] result = null;
// switch (input.FileType) // switch (input.FileType)
// { // {
// case 0: // case 0:
// _fileName = string.Format("产品结构_{0}.csv", input.UserId.ToString()); // _fileName = string.Format("��Ʒ�ṹ_{0}.csv", input.UserId.ToString());
// result = await _csv.ExportAsByteArray(dtoDetails); // result = await _csv.ExportAsByteArray(dtoDetails);
// break; // break;
// case 1: // case 1:
// _fileName = string.Format("产品结构_{0}.xlsx", input.UserId.ToString()); // _fileName = string.Format("��Ʒ�ṹ_{0}.xlsx", input.UserId.ToString());
// result = await _excel.ExportAsByteArray(dtoDetails); // result = await _excel.ExportAsByteArray(dtoDetails);
// break; // break;
// } // }
// result.ShouldNotBeNull(); // result.ShouldNotBeNull();
// //保存导出文件到服务器存成二进制 // //���浼���ļ�����������ɶ�����
// await _excelImportService.SaveBlobAsync( // await _excelImportService.SaveBlobAsync(
// new SaveExcelImportInputDto // new SaveExcelImportInputDto
// { // {
@ -254,13 +254,13 @@ namespace Win.Sfs.SettleAccount.Boms
// #endregion // #endregion
// /// <summary> // /// <summary>
// /// 按ID获取唯一实体 // /// ��ID��ȡΨһʵ��
// /// </summary> // /// </summary>
// /// <remarks> // /// <remarks>
// /// 返回实体全部属性 // /// ����ʵ��ȫ������
// /// </remarks> // /// </remarks>
// /// <param name="id">ID</param> // /// <param name="id">ID</param>
// /// <returns>实体DTO</returns> // /// <returns>ʵ��DTO</returns>
// [HttpGet] // [HttpGet]
// [Route("{id}")] // [Route("{id}")]
//[Authorize(SettleAccountPermissions.Boms.Default)] //[Authorize(SettleAccountPermissions.Boms.Default)]
@ -291,9 +291,9 @@ namespace Win.Sfs.SettleAccount.Boms
// } // }
// /// <summary> // /// <summary>
// /// 获取实体总数 // /// ��ȡʵ������
// /// </summary> // /// </summary>
// /// <returns>实体总数</returns> // /// <returns>ʵ������</returns>
// [HttpGet] // [HttpGet]
// [Route("count")] // [Route("count")]
//[Authorize(SettleAccountPermissions.Boms.Default)] //[Authorize(SettleAccountPermissions.Boms.Default)]
@ -305,10 +305,10 @@ namespace Win.Sfs.SettleAccount.Boms
// /// <summary> // /// <summary>
// /// 删除实体 // /// ɾ��ʵ��
// /// </summary> // /// </summary>
// /// <param name="id">ID</param> // /// <param name="id">ID</param>
// /// <returns></returns> // /// <returns>��</returns>
// [HttpDelete] // [HttpDelete]
// [Route("{id}")] // [Route("{id}")]
//[Authorize(SettleAccountPermissions.Boms.Delete)] //[Authorize(SettleAccountPermissions.Boms.Delete)]
@ -320,10 +320,10 @@ namespace Win.Sfs.SettleAccount.Boms
// } // }
// /// <summary> // /// <summary>
// /// 按IDs删除实体列表 // /// ��IDsɾ��ʵ���б�
// /// </summary> // /// </summary>
// /// <param name="ids">IDs</param> // /// <param name="ids">IDs</param>
// /// <returns>是否执行成功</returns> // /// <returns>�Ƿ�ִ�гɹ�</returns>
// [HttpPost] // [HttpPost]
// [Route("delete")] // [Route("delete")]
//[Authorize(SettleAccountPermissions.Boms.Delete)] //[Authorize(SettleAccountPermissions.Boms.Delete)]
@ -342,13 +342,13 @@ namespace Win.Sfs.SettleAccount.Boms
// ///// <summary> // ///// <summary>
// /// <summary> // /// <summary>
// /// 根据筛选条件获取实体列表 // /// ����ɸѡ������ȡʵ���б�
// /// </summary> // /// </summary>
// /// <remarks> // /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 // /// ������������:ɸѡ�����б�,��������,��������,ҳ��
// /// </remarks> // /// </remarks>
// /// <param name="input">请求条件</param> // /// <param name="input">��������</param>
// /// <returns>实体DTO列表</returns> // /// <returns>ʵ��DTO�б�</returns>
// [HttpPost] // [HttpPost]
// [Route("list")] // [Route("list")]
// [Authorize(SettleAccountPermissions.Boms.Default)] // [Authorize(SettleAccountPermissions.Boms.Default)]
@ -372,13 +372,13 @@ namespace Win.Sfs.SettleAccount.Boms
// ///// <summary> // ///// <summary>
// /// <summary> // /// <summary>
// /// 根据筛选条件获取实体列表 // /// ����ɸѡ������ȡʵ���б�
// /// </summary> // /// </summary>
// /// <remarks> // /// <remarks>
// /// 请求条件包括:筛选条件列表,排序条件,数据数量,页码 // /// ������������:ɸѡ�����б�,��������,��������,ҳ��
// /// </remarks> // /// </remarks>
// /// <param name="input">请求条件</param> // /// <param name="input">��������</param>
// /// <returns>实体DTO列表</returns> // /// <returns>ʵ��DTO�б�</returns>
// [HttpPost] // [HttpPost]
// [Route("listVersion")] // [Route("listVersion")]
// [Authorize(SettleAccountPermissions.Boms.Default)] // [Authorize(SettleAccountPermissions.Boms.Default)]

167
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Distributed;
using SettleAccount.Domain.BQ;
using Shouldly; using Shouldly;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
@ -21,10 +22,12 @@ using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Constant;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.CodeSettings; using Win.Sfs.SettleAccount.Entities.CodeSettings;
using Win.Sfs.SettleAccount.Entities.ImportMap; using Win.Sfs.SettleAccount.Entities.ImportMap;
using Win.Sfs.SettleAccount.ExcelImporter; using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.CacheBase; using Win.Sfs.Shared.CacheBase;
using Win.Sfs.Shared.RepositoryBase;
using Win.Utils; using Win.Utils;
namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
@ -33,83 +36,36 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
/// <summary> /// <summary>
/// 通用代码-相关应用服务 /// 通用代码-相关应用服务
/// </summary> /// </summary>
[Authorize(SettleAccountPermissions.CodeSettings.Default)] [AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")] [Route("api/settleaccount/[controller]/[action]")]
public class CodeSettingAppService : SettleAccountApplicationBase<CodeSetting>, ICodeSettingAppService public class CodeSettingAppService : SettleAccountApplicationBase<CodeSetting>
{ {
private readonly ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> _mapRepository; //private readonly ISettleAccountBranchEfCoreRepository<CodeSetting, Guid> _repository;
private readonly INormalEfCoreRepository<CodeSetting, Guid> _repository;
private readonly IExcelImportAppService _excelImportService;
private readonly ISettleAccountBranchEfCoreRepository<CodeSetting, Guid> _repository;
/// <summary> /// <summary>
/// 构建方法 /// 构建方法
/// </summary> /// </summary>
/// <param name="guidGenerator">构建UID</param>
/// <param name="objectMapper">自动map</param>
/// <param name="repository">仓储接口</param>
/// <param name="cache">缓存</param>
public CodeSettingAppService(IGuidGenerator guidGenerator, public CodeSettingAppService(IGuidGenerator guidGenerator,
IObjectMapper objectMapper, IObjectMapper objectMapper,
ISettleAccountBranchEfCoreRepository<CodeSetting, Guid> repository, INormalEfCoreRepository<CodeSetting, Guid> repository,
ISettleAccountBranchEfCoreRepository<ImportColumnMap, Guid> mapRepository,
IDistributedCache<CodeSetting> cache, IDistributedCache<CodeSetting> cache,
IExcelImportAppService excelImportService, IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator, ISnowflakeIdGenerator snowflakeIdGenerator,
ICommonManager commonManager ICommonManager commonManager
) : base(cache,excelImportService,snowflakeIdGenerator,commonManager) ) : base(cache,excelImportService,snowflakeIdGenerator,commonManager)
{ {
_mapRepository = mapRepository;
_repository = repository; _repository = repository;
_excelImportService = excelImportService;
} }
/// <summary> /// <summary>
/// 导入功能 /// 导入功能
/// </summary> /// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost]
[DisableRequestSizeLimit]
public async Task<string> CodeSettingUploadExcelImportMap([FromForm] IFormFileCollection files)
{
ExportImporter _exportImporter = new ExportImporter();
var _mapList= _mapRepository.Where(p => p.ProjectName == SettleAccountModuleName.CodeSetting).ToList();
var result = await _exportImporter.ExtendExcelImport<CodeSettingImportDto>(files, _excelImportService,_mapList);
var _ls = ObjectMapper.Map<List<CodeSettingImportDto>, List<CodeSetting>>(result);
foreach (var itm in _ls)
{
var _first = _repository.FirstOrDefault(p => p.Project == itm.Project && p.Value == itm.Value);
if (_first != null)
{
_first.Update(_first.Project, _first.Value, itm.Description);
await _repository.UpdateAsync(_first);
}
else
{
itm.SetId(GuidGenerator.Create(), GuidGenerator.Create());
await _repository.InsertAsync(itm);
}
}
var bulkConfig = new BulkConfig { SetOutputIdentity = true, BatchSize = 10000 };
//_repository.GetDbContext().BulkInsert(_ls, bulkConfig);
return ApplicationConsts.SuccessStr;
}
/// <summary>
/// 导入功能
/// </summary>
/// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
/// <returns></returns>
[HttpPost] [HttpPost]
[DisableRequestSizeLimit] [DisableRequestSizeLimit]
public async Task<string> CodeSettingUploadExcelImport([FromForm] IFormFileCollection files) public async Task<string> CodeSettingUploadExcelImport([FromForm] IFormFileCollection files)
{ {
ExportImporter _exportImporter = new ExportImporter(); ExportImporter _exportImporter = new ExportImporter();
var result = await _exportImporter.UploadExcelImport<CodeSettingImportDto>(files, _excelImportService); var result = await _exportImporter.UploadExcelImport<CodeSettingImportDto>(files, _excelImportService);
var _ls = ObjectMapper.Map<List<CodeSettingImportDto>, List<CodeSetting>>(result); var _ls = ObjectMapper.Map<List<CodeSettingImportDto>, List<CodeSetting>>(result);
@ -133,16 +89,9 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
return ApplicationConsts.SuccessStr; return ApplicationConsts.SuccessStr;
} }
/// <summary> /// <summary>
/// 按ID获取唯一实体 /// 按ID获取唯一实体
/// </summary> /// </summary>
/// <remarks>
/// 返回实体全部属性
/// </remarks>
/// <param name="id">ID</param>
/// <returns>实体DTO</returns>
[HttpPost] [HttpPost]
virtual public async Task<CodeSettingDto> GetAsync(Guid id) virtual public async Task<CodeSettingDto> GetAsync(Guid id)
{ {
@ -155,106 +104,21 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
private async Task<CodeSetting> GetFromCacheAsync(Guid id) private async Task<CodeSetting> GetFromCacheAsync(Guid id)
{ {
var result = await _repository.GetAsync(id); var result = await _repository.GetAsync(id);
return result; return result;
} }
private async Task<long> GetCountAsync(CodeSettingRequestDto input)
{
return await _repository.GetCountByFilterAsync(input.BranchId, input.Filters);
}
///// <summary>
/// <summary> /// <summary>
/// 根据筛选条件获取实体列表 /// 获取列表
/// </summary> /// </summary>
/// <remarks>
/// 请求条件包括:筛选条件列表,排序条件,数据数量,页码
/// </remarks>
/// <param name="input">请求条件</param>
/// <returns>实体DTO列表</returns>
[HttpPost] [HttpPost]
virtual public async Task<PagedResultDto<CodeSettingDto>> GetListAsync(CodeSettingRequestDto input) public async Task<PagedResultDto<CodeSettingDto>> GetListAsync(RequestDto input)
{ {
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, input.MaxResultCount, var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
input.SkipCount, true); var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
var totalCount = await GetCountAsync(input);
var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities); var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
dtos=dtos.OrderBy(p => p.Value).ToList();
return new PagedResultDto<CodeSettingDto>(totalCount, dtos); return new PagedResultDto<CodeSettingDto>(totalCount, dtos);
} }
/// <summary>
/// 获取实体总数
/// </summary>
/// <returns>实体总数</returns>
[HttpPost]
virtual public async Task<long> GetTotalCountAsync(Guid branchId)
{
return await _repository.GetCountAsync(branchId);
}
/// <summary>
/// 获取全部实体列表
/// </summary>
/// <returns>实体DTO列表</returns>
[HttpPost]
virtual public async Task<ListResultDto<CodeSettingDto>> GetAllAsync(Guid branchId)
{
var entities = await _repository.GetAllAsync(branchId, true);
var dtos = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingDto>>(entities);
return new ListResultDto<CodeSettingDto>(dtos);
}
///// <summary>
///// 导入功能
///// </summary>
///// <param name="files">上传的文件(前端已经限制只能上传一个附件)</param>
///// <returns></returns>
//[HttpPost]
//[Route("UomExcelImport")]
////[AllowAnonymous]
//public async Task<List<CodeSettingImportDto>> UploadExcelImport([FromForm] IFormFileCollection files)
//{
// ExportImporter _exportImporter = new ExportImporter();
// var result = await _exportImporter.UploadExcelImport<CodeSettingImportDto>(files);
// return result;
//}
/// <summary>
/// 批量导入实体列表
/// </summary>
/// <remarks>
/// 以ID为依据,数据库中找不到ID的实体会新增,已有ID的实体会修改
/// </remarks>
/// <param name="entities">实体列表</param>
/// <returns>是否导入成功</returns>
//[HttpPost]
//[Route("import")]
//[Authorize(SettleAccountPermissions.CodeSettings.Create)]
//virtual public async Task<bool> ImportAsync(List<CodeSettingCreateDto> dtos)
//{
// var entities =ObjectMapper.Map<List<CodeSettingCreateDto>, List<CodeSetting>>(dtos);
// var result = await _repository.ImportAsync(entities);
// return result;
//}
/// <summary> /// <summary>
/// 新增实体 /// 新增实体
/// </summary> /// </summary>
@ -298,7 +162,7 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
virtual public async Task<string> ExportAsync(CodeSettingRequestDto input) virtual public async Task<string> ExportAsync(CodeSettingRequestDto input)
{ {
string _fileName = string.Format("通用代码设置_{0}.xlsx",DateTime.Now.ToString("yyyyMMdd")); string _fileName = string.Format("通用代码设置_{0}.xlsx",DateTime.Now.ToString("yyyyMMdd"));
var entities = await _repository.GetListByFilterAsync(input.BranchId, input.Filters, input.Sorting, int.MaxValue, var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, int.MaxValue,
0, true); 0, true);
var dtoDetails = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingExportDto>>(entities); var dtoDetails = ObjectMapper.Map<List<CodeSetting>, List<CodeSettingExportDto>>(entities);
@ -367,8 +231,6 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
[HttpPost] [HttpPost]
virtual public async Task<bool> DeleteListAsync(List<Guid> ids) virtual public async Task<bool> DeleteListAsync(List<Guid> ids)
{ {
var _query = _repository.Where(p => ids.Contains(p.Id)); var _query = _repository.Where(p => ids.Contains(p.Id));
int i= await _query.BatchDeleteAsync(); int i= await _query.BatchDeleteAsync();
@ -377,7 +239,6 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables
return false; return false;
} }
return true; return true;
} }

12
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -136,11 +136,15 @@ namespace Win.Sfs.SettleAccount
CreateMapPURCHASE_PRICE(); CreateMapPURCHASE_PRICE();
CreateMapTB_RePartsRelationship(); CreateMapTB_RePartsRelationship();
CreateMapBBAC_SE_DETAIL(); CreateMapBBAC_SE_DETAIL();
CreateMapBBAC_SE_EDI(); CreateMapBBAC_SE_EDI();
CreateMapHBPO_SE_DETAIL(); CreateMapHBPO_SE_DETAIL();
CreateMapHBPO_SE_EDI(); CreateMapHBPO_SE_EDI();
CreateMapPUB_SE_DETAIL(); CreateMapPUB_SE_DETAIL();
CreateMapPUB_SA();
} }
#region BQ #region BQ
@ -809,5 +813,13 @@ namespace Win.Sfs.SettleAccount
CreateMap<PUB_SE_DETAIL, PUB_SE_DETAIL_EXPORT_DTO>(); CreateMap<PUB_SE_DETAIL, PUB_SE_DETAIL_EXPORT_DTO>();
} }
/// <summary>
/// PUB结算
/// </summary>
private void CreateMapPUB_SA()
{
CreateMap<PUB_SA, PUB_SA_DTO>();
}
} }
} }

13
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -65,6 +65,7 @@ namespace Win.Sfs.SettleAccount
); );
#region 基础数据 #region 基础数据
builder.ConfigureCodeSetting(options);
//价格 //价格
builder.ConfigurePriceListVersion(options); builder.ConfigurePriceListVersion(options);
builder.ConfigurePriceList(options); builder.ConfigurePriceList(options);
@ -295,6 +296,18 @@ namespace Win.Sfs.SettleAccount
}); });
} }
/// <summary>
/// 通用代码
/// </summary>
private static void ConfigureCodeSetting(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<CodeSetting>(b =>
{
b.ToTable($"{options.TablePrefix}_CodeSetting", options.Schema);
b.ConfigureByConvention();
});
}
private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options) private static void ConfigurePriceList(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{ {

3980
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230713031306_20230713-1.Designer.cs

File diff suppressed because it is too large

206
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230713031306_20230713-1.cs

@ -0,0 +1,206 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307131 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "State",
table: "Set_INVOICE_GRP",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "Extend1",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend2",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend3",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend4",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Site",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AlterColumn<int>(
name: "State",
table: "Set_HBPO_CAN_SA",
type: "int",
maxLength: 50,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend1",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend2",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend3",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Extend4",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Site",
table: "Set_BBAC_SE_EDI",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AlterColumn<int>(
name: "State",
table: "Set_BBAC_CAN_SA",
type: "int",
maxLength: 50,
nullable: false,
defaultValue: 0,
oldClrType: typeof(string),
oldType: "nvarchar(50)",
oldMaxLength: 50,
oldNullable: true);
migrationBuilder.CreateTable(
name: "Set_CodeSetting",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Project = table.Column<string>(type: "nvarchar(max)", nullable: true),
Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
ExtraProperties = table.Column<string>(type: "nvarchar(max)", nullable: true),
ConcurrencyStamp = table.Column<string>(type: "nvarchar(40)", maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
CreatorId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastModificationTime = table.Column<DateTime>(type: "datetime2", nullable: true),
LastModifierId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IsDeleted = table.Column<bool>(type: "bit", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DeletionTime = table.Column<DateTime>(type: "datetime2", nullable: true),
BranchId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Enabled = table.Column<bool>(type: "bit", nullable: false),
Remark = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Set_CodeSetting", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_CodeSetting");
migrationBuilder.DropColumn(
name: "State",
table: "Set_INVOICE_GRP");
migrationBuilder.DropColumn(
name: "Extend1",
table: "Set_HBPO_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend2",
table: "Set_HBPO_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend3",
table: "Set_HBPO_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend4",
table: "Set_HBPO_SE_EDI");
migrationBuilder.DropColumn(
name: "Site",
table: "Set_HBPO_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend1",
table: "Set_BBAC_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend2",
table: "Set_BBAC_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend3",
table: "Set_BBAC_SE_EDI");
migrationBuilder.DropColumn(
name: "Extend4",
table: "Set_BBAC_SE_EDI");
migrationBuilder.DropColumn(
name: "Site",
table: "Set_BBAC_SE_EDI");
migrationBuilder.AlterColumn<string>(
name: "State",
table: "Set_HBPO_CAN_SA",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 50);
migrationBuilder.AlterColumn<string>(
name: "State",
table: "Set_BBAC_CAN_SA",
type: "nvarchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(int),
oldType: "int",
oldMaxLength: 50);
}
}
}

118
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -79,9 +79,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("State") b.Property<int>("State")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("int");
b.Property<int>("Version") b.Property<int>("Version")
.HasColumnType("int"); .HasColumnType("int");
@ -679,6 +679,22 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<string>("Extend1")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend2")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend3")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend4")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)") .HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
@ -720,6 +736,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasColumnType("nvarchar(max)");
b.Property<int>("Version") b.Property<int>("Version")
.HasColumnType("int"); .HasColumnType("int");
@ -1000,9 +1019,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("State") b.Property<int>("State")
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("int");
b.Property<int>("Version") b.Property<int>("Version")
.HasColumnType("int"); .HasColumnType("int");
@ -1584,6 +1603,22 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("datetime2") .HasColumnType("datetime2")
.HasColumnName("DeletionTime"); .HasColumnName("DeletionTime");
b.Property<string>("Extend1")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend2")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend3")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Extend4")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("ExtraProperties") b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)") .HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties"); .HasColumnName("ExtraProperties");
@ -1625,6 +1660,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<string>("Site")
.HasColumnType("nvarchar(max)");
b.Property<int>("Version") b.Property<int>("Version")
.HasColumnType("int"); .HasColumnType("int");
@ -1919,6 +1957,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasMaxLength(50) .HasMaxLength(50)
.HasColumnType("nvarchar(50)"); .HasColumnType("nvarchar(50)");
b.Property<int>("State")
.HasColumnType("int");
b.Property<decimal>("TaxAmt") b.Property<decimal>("TaxAmt")
.HasColumnType("decimal(18,2)"); .HasColumnType("decimal(18,2)");
@ -3267,6 +3308,75 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_bom_version"); b.ToTable("Set_bom_version");
}); });
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.CodeSettings.CodeSetting", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("BranchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasMaxLength(40)
.HasColumnType("nvarchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime2")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("uniqueidentifier")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("uniqueidentifier")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime2")
.HasColumnName("DeletionTime");
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("bit")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime2")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("Project")
.HasColumnType("nvarchar(max)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<string>("Value")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Set_CodeSetting");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Controls.CentralizedControl", b => modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.Controls.CentralizedControl", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")

Loading…
Cancel
Save