wanggang 1 year ago
parent
commit
1efeaa6082
  1. 40
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  2. 38
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
  3. 48
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  4. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  5. 12
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  6. 4147
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.Designer.cs
  7. 53
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.cs
  8. 109
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  9. 24
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  10. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

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

@ -120,7 +120,47 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos
/// </summary>
public class PUB_SA_DETAIL_EXPORT_DTO
{
/// <summary>
/// 结算单号
/// </summary>
[Display(Name = "结算单号")]
[ExporterHeader(DisplayName = "结算单号")]
public string BillNum { set; get; }
/// <summary>
/// 结算日期(收货日期)
/// </summary>
[Display(Name = "结算日期(收货日期)")]
[ExporterHeader(DisplayName = "Pstng Date")]
public DateTime SettleDate { set; get; }
/// <summary>
/// 零件号
/// </summary>
[Display(Name = "零件号")]
[ExporterHeader(DisplayName = "Material")]
public string LU { get; set; }
/// <summary>
/// 数量
/// </summary>
[Display(Name = "数量")]
[ExporterHeader(DisplayName = "Quantity")]
public decimal Qty { get; set; }
/// <summary>
/// 发货单号
/// </summary>
[Display(Name = "发货单号")]
[ExporterHeader(DisplayName = "External Delivery ID")]
public string PN { get; set; }
/// <summary>
/// 结算分组
/// </summary>
[Display(Name = "结算分组")]
[ExporterHeader(DisplayName = "Delivery")]
public string GroupNum { get; set; }
}
}

38
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
@ -7,13 +8,17 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.Services;
using SettleAccount.Job.Services.Report;
using Shouldly;
using TaskJob.EventArgs;
using Volo.Abp;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
@ -37,11 +42,14 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
/// </summary>
private readonly INormalEfCoreRepository<PUB_SA, Guid> _pubSaRepository;
private readonly TaskJobService _taskJobService;
/// <summary>
/// 构造
/// </summary>
public PUB_SA_DETAIL_SERVICE(INormalEfCoreRepository<PUB_SA_DETAIL, Guid> pubSaDetailRepository,
INormalEfCoreRepository<PUB_SA, Guid> pubSaRepository,
TaskJobService taskJobService,
IDistributedCache<PUB_SA_DETAIL> cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@ -50,6 +58,7 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
{
_pubSaDetailRepository = pubSaDetailRepository;
_pubSaRepository = pubSaRepository;
_taskJobService = taskJobService;
}
#region 导出
@ -59,13 +68,21 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
[HttpPost]
public async Task<string> ExportAsync(PUB_SA_DETAIL_EXPORT_REQUEST_DTO input)
{
var pubSaEntity = await _pubSaRepository.FirstOrDefaultAsync(t=>t.BillNum == input.BillNum);
var pubSaEntity = await _pubSaRepository.FirstOrDefaultAsync(t => t.BillNum == input.BillNum);
if (pubSaEntity == null)
{
throw new UserFriendlyException($"导出失败,结算单号不存在!", "400");
}
var businessType = pubSaEntity.BusinessType;
string fileName = $"{businessType.GetDisplayName()}结算数据_{Guid.NewGuid()}.xlsx";
var displayName = businessType.ToString();
DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
displayName = attributeOfType.Name;
}
string fileName = $"{displayName}的结算数据_{Guid.NewGuid()}.xlsx";
List<FilterCondition> filters = new List<FilterCondition>();
filters.Add(new FilterCondition("BillNum", input.BillNum, EnumFilterAction.Equal, EnumFilterLogic.And));
@ -81,4 +98,21 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase<PUB_SA_DETAIL>
}
#endregion
#region 对比
/// <summary>
/// Pub结算与发运比对
/// </summary>
[HttpPost]
public async Task<string> PubSaSeCompare(string version)
{
List<CustomCondition> customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = version ?? string.Empty });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = "结算与开票数据对比" });
var _taskid = await _taskJobService.ExportEnqueueAsync("Pub结算与发运核对汇总表", ExportExtentsion.Excel, version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
{
Console.WriteLine("TaskJob 回调了");
});
return _taskid;
}
#endregion
}

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

@ -102,59 +102,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
#region 直供件
#region 导入
#region 导入、导出
/// <summary>
/// 导入(直供件)
/// 导入
/// </summary>
[HttpPost]
public async Task<string> ImportByBusinessTypeAsync([FromForm] IFormFileCollection files, EnumBusinessType businessType)
{
return await ImportAsync(files, businessType);
}
///// <summary>
///// 导入(直供件)
///// </summary>
//[HttpPost]
//public async Task<string> ZhiGongJianImportAsync([FromForm] IFormFileCollection files)
//{
// return await ImportAsync(files, EnumBusinessType.ZhiGongJian);
//}
///// <summary>
///// 导入(备件)
///// </summary>
//[HttpPost]
//public async Task<string> BeiJianImportAsync([FromForm] IFormFileCollection files)
//{
// return await ImportAsync(files, EnumBusinessType.BeiJian);
//}
///// <summary>
///// 导入(备件)
///// </summary>
//[HttpPost]
//public async Task<string> BeiJianImportAsync([FromForm] IFormFileCollection files)
//{
// return await ImportAsync(files, EnumBusinessType.BeiJian);
//}
///// <summary>
///// 导入(备件)
///// </summary>
//[HttpPost]
//public async Task<string> BeiJianImportAsync([FromForm] IFormFileCollection files)
//{
// return await ImportAsync(files, EnumBusinessType.BeiJian);
//}
#endregion
#endregion
#region 导入、导出
#endregion
#region CURD

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

@ -145,6 +145,7 @@ namespace Win.Sfs.SettleAccount
CreateMapPUB_SE_DETAIL();
CreateMapPUB_SA();
CreateMapPUB_SA_DETAIL();
CreateMapBBAC_CAN_SA();
@ -973,11 +974,18 @@ namespace Win.Sfs.SettleAccount
private void CreateMapPUB_SA()
{
CreateMap<PUB_SA, PUB_SA_DTO>();
}
/// <summary>
/// PUB结算明细
/// </summary>
private void CreateMapPUB_SA_DETAIL()
{
CreateMap<PUB_SA_DETAIL, PUB_CAN_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_NOT_SA_DETAIL>()
.ForMember(x => x.SettleBillNum, y => y.MapFrom(d => d.BillNum));
CreateMap<PUB_SA_DETAIL, PUB_SA_DETAIL_EXPORT_DTO>();
CreateMap<PUB_SA_DETAIL_IMPORT_DTO, PUB_SA_DETAIL>();
}

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

@ -4,6 +4,7 @@ using SettleAccount.Domain.BQ;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
using Win.Sfs.SettleAccount.Boms;
using Win.Sfs.SettleAccount.Entities;
using Win.Sfs.SettleAccount.Entities.Boms;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Entities.CodeSettings;
@ -58,7 +59,7 @@ namespace Win.Sfs.SettleAccount
#endregion 基础数据
#region 北汽结算
builder.ConfigureTaskJob(options);
builder.ConfigureBBAC_CAN_SA(options);
builder.ConfigureBBAC_CAN_SA_DETAIL(options);
builder.ConfigureBBAC_NOT_SA_DETAIL(options);
@ -481,6 +482,15 @@ namespace Win.Sfs.SettleAccount
});
}
private static void ConfigureTaskJob(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<TaskJob>(b =>
{
b.ToTable($"{options.TablePrefix}_TaskJob", options.Schema);
b.ConfigureByConvention();
});
}
private static void ConfigureBBAC_CAN_SA(this ModelBuilder builder, SettleAccountModelBuilderConfigurationOptions options)
{
builder.Entity<BBAC_CAN_SA>(b =>

4147
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.Designer.cs

File diff suppressed because it is too large

53
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230719053130_20230719-3.cs

@ -0,0 +1,53 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202307193 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Set_TaskJob",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: true),
State = table.Column<string>(type: "nvarchar(max)", nullable: true),
TaskId = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Name = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
ActionName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Error = table.Column<string>(type: "nvarchar(max)", nullable: true),
Creator = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
Email = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
FileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
RealFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
RealDownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
DownFileName = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
ServiceName = table.Column<string>(type: "nvarchar(300)", maxLength: 300, 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_TaskJob", x => x.Id);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Set_TaskJob");
}
}
}

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

@ -4124,6 +4124,115 @@ namespace Win.Sfs.SettleAccount.Migrations
b.ToTable("Set_PriceListVersionBJ");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.Entities.TaskJob", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ActionName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
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<string>("Creator")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
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>("DownFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Email")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Error")
.HasColumnType("nvarchar(max)");
b.Property<string>("ExtraProperties")
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("FileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
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>("Name")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("RealDownFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("RealFileName")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("Remark")
.HasColumnType("nvarchar(max)");
b.Property<string>("ServiceName")
.HasMaxLength(300)
.HasColumnType("nvarchar(300)");
b.Property<string>("State")
.HasColumnType("nvarchar(max)");
b.Property<string>("TaskId")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Type")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Set_TaskJob");
});
modelBuilder.Entity("Win.Sfs.SettleAccount.MaterialRelationships.MaterialRelationship", b =>
{
b.Property<Guid>("Id")

24
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using TaskJob.EventArgs;
using TaskJob.Interfaces;
using Volo.Abp.DependencyInjection;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// Pub结算发运对比导出服务
/// </summary>
public class PubSaSeCompareExportService: ITransientDependency, IExportJob
{
public PubSaSeCompareExportService() { }
/// <summary>
/// 导出
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
return this.GetType().FullName;
}
}
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

@ -1,4 +1,4 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.Application;
@ -37,7 +37,9 @@ namespace Win.Sfs.SettleAccount
public override void ConfigureServices(ServiceConfigurationContext context)
{
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0});
context.Services.AddTransient<PubSaSeCompareExportService>();
context.Services.AddTransient<SettleAccountImportService>();
context.Services.AddTransient<InvoiceImportService>();
context.Services.AddTransient<InvoiceSettledDiffExportService>();
@ -79,6 +81,11 @@ namespace Win.Sfs.SettleAccount
{
Func<string, IExportJob> accesor = key =>
{
if (key.Equals(typeof(PubSaSeCompareExportService).FullName))
{
return implementationFactory.GetService<PubSaSeCompareExportService>();
}
if (key.Equals(typeof(InvoiceSettledDiffExportService).FullName))
{
return implementationFactory.GetService<InvoiceSettledDiffExportService>();

Loading…
Cancel
Save