mahao 1 year ago
parent
commit
b5172c38d0
  1. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs
  2. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  3. 41
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs
  4. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs
  5. 39
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs
  6. 57
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs
  7. 148
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs
  8. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACSeEidCompareReport.cs
  9. 11
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOSeEidCompareReport.cs
  10. 25
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs
  11. 5781
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230908031607_20230908-1.Designer.cs
  12. 179
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230908031607_20230908-1.cs
  13. 26
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs
  14. 162
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs
  15. 155
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs
  16. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  17. 200
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs

6
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SE_DETAIL_SERVICE.cs

@ -90,11 +90,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
public async Task<string> TextExportAsync()
{
var fileName = $"发运数据_{Guid.NewGuid()}.xlsx";
var haveEdiHaveSeList = new List<JisBBACEidSeCompareExport>();
var haveEdiHaveSeList = new List<JisBBACSeEidCompareReport>();
for (int i = 0; i < 2_000_000; i++)
{
haveEdiHaveSeList.Add(new JisBBACEidSeCompareExport()
haveEdiHaveSeList.Add(new JisBBACSeEidCompareReport()
{
Category = "JIS",
WmsBillNum = i.ToString(),
@ -119,7 +119,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
});
}
var jisBBACEidSeCompareEexcelExporterAttribute = typeof(JisBBACEidSeCompareExport).GetAttribute<ExcelExporterAttribute>();
var jisBBACEidSeCompareEexcelExporterAttribute = typeof(JisBBACSeEidCompareReport).GetAttribute<ExcelExporterAttribute>();
var jisBBACEidSeCompareEexcelMaxRowNumberOnASheet = 9_000_000;
if (jisBBACEidSeCompareEexcelExporterAttribute != null)
{

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

@ -600,6 +600,19 @@ namespace SettleAccount.Bases
/// 数量
/// </summary>
public decimal Qty { get; set; }
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; } = null!;
[Display(Name = "小总成号")]
public string AssemblyCode { get; set; } = null!;
[Display(Name = "注塑码")]
public string InjectionCode { get; set; } = null!;
[Display(Name = "订单时间")]
public DateTime BeginDate { get; set; }
}
public class PD_BASE : FullAuditedAggregateRoot<Guid>, ISBASE
{

41
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_DETAIL.cs

@ -1,54 +1,13 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using SettleAccount.Bases;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
namespace SettleAccount.Domain.BQ;
[Display(Name = "BBAC发运单")]
public class BBAC_SE_DETAIL : JisSeBase
{
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "LU+生产码")]
//public string KeyCode { get; set; } = null!;
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "零件号")]
//public string LU { get; set; } = null!;
//[Display(Name = "生产码")]
//public string PN { get; set; } = null!;
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; } = null!;
[Display(Name = "小总成号")]
public string AssemblyCode { get; set; } = null!;
[Display(Name = "注塑码")]
public string InjectionCode { get; set; } = null!;
//[Display(Name = "发货数量")]
//public decimal Qty { get; set; }
[Display(Name = "订单时间")]
public DateTime BeginDate { get; set; }
//[Display(Name = "发货时间")]
//public DateTime ShippingDate { get; set; }
//[Display(Name = "Wms发货单号")]
//public string WmsBillNum { get; set; } = null!;
public BBAC_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, DateTime shippingDate, string wmsBillNum)
{
Id= guid;

14
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_SE_EDI.cs

@ -3,8 +3,8 @@ using System.ComponentModel.DataAnnotations;
using Volo.Abp.Domain.Entities.Auditing;
namespace SettleAccount.Domain.BQ;
[Display(Name = "BBAC的EDI数据")]
public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
public class SE_EDI : FullAuditedAggregateRoot<Guid>
{
[Display(Name = "LU+生产码")]
public string KeyCode { get; set; } = null!;
@ -43,7 +43,7 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
public string Extend2 { set; get; }
[Display(Name = "生产码序列号")]
public string Extend3 { set; get; }
[Display(Name ="车型")]
[Display(Name = "车型")]
public string Extend4 { set; get; }
/// <summary>
@ -54,7 +54,7 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
/// <summary>
/// 生产线
/// </summary>
[Display(Name ="生产线")]
[Display(Name = "生产线")]
[MaxLength(50)]
public string LineStationCode { set; get; }
@ -63,7 +63,11 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
[Display(Name = "原客户零件号")]
[MaxLength(50)]
public string CustomerPartCodeNoSpace { set; get; }
}
[Display(Name = "BBAC的EDI数据")]
public class BBAC_SE_EDI : SE_EDI
{
public BBAC_SE_EDI()
{ }
public BBAC_SE_EDI(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate
@ -86,7 +90,7 @@ public class BBAC_SE_EDI:FullAuditedAggregateRoot<Guid>
Extend2 = extend2;
Extend3 = extend3;
Extend4 = extend4;
customerPartCodeNoSpace = customerPartCodeNoSpace;
CustomerPartCodeNoSpace = customerPartCodeNoSpace;
}
public BBAC_SE_EDI SetQty(decimal qty)

39
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_DETAIL.cs

@ -8,45 +8,6 @@ namespace SettleAccount.Domain.BQ;
[Display(Name = "HBPO发运数据")]
public class HBPO_SE_DETAIL : JisSeBase
{
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "LU+生产码")]
//public string KeyCode { get; set; } = null!;
//[Display(Name = "期间")]
//public int Version { get; set; }
//[Display(Name = "零件号")]
//public string LU { get; set; } = null!;
//[Display(Name = "生产码")]
//public string PN { get; set; } = null!;
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; } = null!;
[Display(Name = "小总成号")]
public string AssemblyCode { get; set; } = null!;
[Display(Name = "注塑码")]
public string InjectionCode { get; set; } = null!;
//[Display(Name = "发货数量")]
//public decimal Qty { get; set; }
[Display(Name = "订单时间")]
public DateTime BeginDate { get; set; }
//[Display(Name = "发货时间")]
//public DateTime ShippingDate { get; set; }
//[Display(Name = "Wms发货单号")]
//public string WmsBillNum { get; set; } = null!;
public HBPO_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, DateTime shippingDate, string wmsBillNum)
{
this.Id = guid;

57
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_SE_EDI.cs

@ -4,63 +4,8 @@ using Volo.Abp.Domain.Entities.Auditing;
namespace SettleAccount.Domain.BQ;
[Display(Name = "HBPO的EDI数据")]
public class HBPO_SE_EDI :FullAuditedAggregateRoot<Guid>
public class HBPO_SE_EDI : SE_EDI
{
[Display(Name = "LU+生产码")]
public string KeyCode { get; set; } = null!;
[Display(Name = "期间")]
public int Version { get; set; }
[Display(Name = "零件号")]
public string LU { get; set; } = null!;
/// <summary>
/// 对应字段ExternalCalNumber
/// </summary>
[Display(Name = "生产码")]
public string PN { get; set; } = null!;
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; } = null!;
[Display(Name = "小总成号")]
public string AssemblyCode { get; set; } = null!;
[Display(Name = "注塑码")]
public string InjectionCode { get; set; } = null!;
[Display(Name = "EDI数量")]
public decimal Qty { get; set; }
[Display(Name = "订货时间")]
public DateTime BeginDate { get; set; }
[Display(Name = "工厂")]
public string Site { get; set; }
public string Extend1 { set; get; }
public string Extend2 { set; get; }
public string Extend3 { set; get; }
public string Extend4 { set; get; }
/// <summary>
/// 是否有发运数据
/// </summary>
[Display(Name = "是否有发运数据")]
public bool IsHaveSeData { get; set; }
[Display(Name = "原客户零件号")]
[MaxLength(50)]
public string CustomerPartCodeNoSpace { set; get; }
public HBPO_SE_EDI(Guid guid ,string keyCode, int version, string lU, string pN, string seqNumber, string assemblyCode, string injectionCode, decimal qty, DateTime beginDate, string site, string extend1, string extend2, string extend3, string extend4, string customerPartCodeNoSpace)
{
Id = guid;

148
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs

@ -1,148 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisBBAC Edi与发运对比
/// </summary>
public class JisBBACEidSeCompareReport
{
}
public class JisBBACEidSeCompareExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
public string Category { get; set; }
/// <summary>
/// 车型
/// </summary>
[Display(Name = "车型")]
[ExporterHeader(DisplayName = "车型")]
public string CarModeCode { get; set; }
/// <summary>
/// 生产线
/// </summary>
[Display(Name = "生产线")]
[ExporterHeader(DisplayName = "生产线")]
public string LineStationcode { get; set; }
/// <summary>
/// 生产码序列号日期
/// </summary>
[Display(Name = "生产码序列号日期")]
[ExporterHeader(DisplayName = "生产码序列号日期")]
public string SequenceNumber { get; set; }
/// <summary>
/// 生产码
/// </summary>
[Display(Name = "生产码")]
[ExporterHeader(DisplayName = "生产码")]
public string PN { get; set; }
/// <summary>
/// 物料号
/// </summary>
[Display(Name = "物料号")]
[ExporterHeader(DisplayName = "物料号")]
public string MaterialNumber { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string MaterialDes { get; set; }
/// <summary>
/// WMS发货数量
/// </summary>
[Display(Name = "WMS发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// EDI数量
/// </summary>
[Display(Name = "EDI数量")]
[ExporterHeader(DisplayName = "EDI数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// WMS发货与EDI数量差
/// </summary>
[Display(Name = "WMS发货与EDI数量差")]
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal DiffQty => SEQty - EdiQty;
/// <summary>
/// 交货单号
/// </summary>
[Display(Name = "交货单号")]
[ExporterHeader(DisplayName = "交货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// ParType
/// </summary>
[Display(Name = "ParType")]
[ExporterHeader(DisplayName = "ParType")]
public string ParType { get; set; }
/// <summary>
/// 配置码
/// </summary>
[Display(Name = "配置码")]
[ExporterHeader(DisplayName = "配置码")]
public string MESConfigCode { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Display(Name = "序列号")]
[ExporterHeader(DisplayName = "序列号")]
public string Seq { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
[ExporterHeader(DisplayName = "PJIS日顺序号")]
public string PjsNum { get; set; }
/// <summary>
/// 客户下线时间
/// </summary>
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
public DateTime? AssemblyDate { get; set; }
/// <summary>
/// 小总成号
/// </summary>
[Display(Name = "小总成号")]
[ExporterHeader(DisplayName = "小总成号")]
public string MatchNumber { get; set; }
/// <summary>
/// 注塑码
/// </summary>
[Display(Name = "注塑码")]
[ExporterHeader(DisplayName = "注塑码")]
public string InjectionCode { get; set; }
/// <summary>
/// 是否完全匹配
/// </summary>
[Display(Name = "是否完全匹配")]
[ExporterHeader(DisplayName = "是否完全匹配")]
public string MateType { get; set; }
/// <summary>
/// 差异说明
/// </summary>
[Display(Name = "差异说明")]
[ExporterHeader(DisplayName = "差异说明")]
public string DiffDesc { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
[ExporterHeader(DisplayName = "备注")]
public string Remark { get; set; }
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACSeEidCompareReport.cs

@ -0,0 +1,11 @@
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisBBAC 发运、Edi与对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisBBACSeEidCompareReport : SeEidCompareReport
{
}

11
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOSeEidCompareReport.cs

@ -0,0 +1,11 @@
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisHBPO 发运、Edi与对比报告
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisHBPOSeEidCompareReport : SeEidCompareReport
{
}

25
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisHBPOEidSeCompareReport.cs → code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SeEidCompareReport.cs

@ -1,22 +1,13 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// JisHBPO Edi与发运对比
/// 发运、Edi与对比报告
/// </summary>
public class JisHBPOEidSeCompareReport
{
}
/// <summary>
/// JisHBPO Edi与发运对比导出
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 500_000)]
public class JisHBPOEidSeCompareExport
public class SeEidCompareReport
{
/// <summary>
/// 类别
@ -103,12 +94,6 @@ public class JisHBPOEidSeCompareExport
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 实际发货生产号
/// </summary>
[Display(Name = "实际发货生产号")]
[ExporterHeader(DisplayName = "实际发货生产号")]
public string RealCode { get; set; }
/// <summary>
/// 序列号
/// </summary>
[Display(Name = "序列号")]
@ -162,4 +147,10 @@ public class JisHBPOEidSeCompareExport
[Display(Name = "差异说明")]
[ExporterHeader(DisplayName = "差异说明")]
public string DiffDesc { get; set; }
/// <summary>
/// 备注
/// </summary>
[Display(Name = "备注")]
[ExporterHeader(DisplayName = "备注")]
public string Remark { get; set; }
}

5781
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230908031607_20230908-1.Designer.cs

File diff suppressed because it is too large

179
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230908031607_20230908-1.cs

@ -0,0 +1,179 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win.Sfs.SettleAccount.Migrations
{
public partial class _202309081 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LineStationCode",
table: "Set_HBPO_SE_EDI",
type: "nvarchar(50)",
maxLength: 50,
nullable: true);
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "47fe18e0c4174614b1fcf60db5a35627");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "7ef18156df8f444b97ea9c14d54dbd42");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "12c345ad1a5146f993350fef54c3c6a7");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "015197fa7217489f87d3f2aa90b88c9f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "0add991c7b55439d831a4df9d8073ea2");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "81771ab92b504c57bf3e240e41174522");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "02504a27952b462b8e294ff5886cb884");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "4962eff9d1874befaef668e046480d92");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "ac058682bcfd43a4922543012c542b0c");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "be930d1502d742a8ae7d784c1a05ff60");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "e32d05eeb3ba41148010a47c05753298");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LineStationCode",
table: "Set_HBPO_SE_EDI");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
column: "ConcurrencyStamp",
value: "540d27f55bd9415bae51a264d888b256");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
column: "ConcurrencyStamp",
value: "f311bbe27f2d4dd088690d28c4dd8495");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
column: "ConcurrencyStamp",
value: "a641ae00f7db4b3cbf58dc098442c08b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
column: "ConcurrencyStamp",
value: "fc2fa51cd9124e2593e457241b79bc2b");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
column: "ConcurrencyStamp",
value: "610f376ade18446f87589b9b99b16c6a");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
column: "ConcurrencyStamp",
value: "272db8024ec645dc837afb433687572f");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
column: "ConcurrencyStamp",
value: "54a845290661424dbd6600f40a77ec27");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
column: "ConcurrencyStamp",
value: "8c5c164e5abc471a97ec8dada4195a53");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
column: "ConcurrencyStamp",
value: "9072cbd6edd74b80821d92e9d98d8d61");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
column: "ConcurrencyStamp",
value: "090f151b1c6e418299e23b7b2397a0cb");
migrationBuilder.UpdateData(
table: "Set_JobItem",
keyColumn: "Id",
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
column: "ConcurrencyStamp",
value: "dcd7451cfe3d4472b8eca39f7e890038");
}
}
}

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

@ -2172,6 +2172,10 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("uniqueidentifier")
.HasColumnName("LastModifierId");
b.Property<string>("LineStationCode")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("PN")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
@ -4461,7 +4465,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("ef3d8e8a-a88e-ca1f-e615-714c6bc48824"),
ConcurrencyStamp = "090f151b1c6e418299e23b7b2397a0cb",
ConcurrencyStamp = "be930d1502d742a8ae7d784c1a05ff60",
Cron = "0 0 8 26 *",
IsDisabled = false,
IsRunning = false,
@ -4471,7 +4475,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("185c5968-e02b-267e-db2f-225fccfc9716"),
ConcurrencyStamp = "540d27f55bd9415bae51a264d888b256",
ConcurrencyStamp = "47fe18e0c4174614b1fcf60db5a35627",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4481,7 +4485,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("1bb02f67-ed05-6cc1-1507-502e8f6c7a31"),
ConcurrencyStamp = "f311bbe27f2d4dd088690d28c4dd8495",
ConcurrencyStamp = "7ef18156df8f444b97ea9c14d54dbd42",
Cron = "0 0/1 * * * ?",
IsDisabled = false,
IsRunning = false,
@ -4491,7 +4495,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
ConcurrencyStamp = "54a845290661424dbd6600f40a77ec27",
ConcurrencyStamp = "02504a27952b462b8e294ff5886cb884",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4501,7 +4505,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
ConcurrencyStamp = "a641ae00f7db4b3cbf58dc098442c08b",
ConcurrencyStamp = "12c345ad1a5146f993350fef54c3c6a7",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4511,7 +4515,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
ConcurrencyStamp = "610f376ade18446f87589b9b99b16c6a",
ConcurrencyStamp = "0add991c7b55439d831a4df9d8073ea2",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4521,7 +4525,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
ConcurrencyStamp = "fc2fa51cd9124e2593e457241b79bc2b",
ConcurrencyStamp = "015197fa7217489f87d3f2aa90b88c9f",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4531,7 +4535,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
ConcurrencyStamp = "dcd7451cfe3d4472b8eca39f7e890038",
ConcurrencyStamp = "e32d05eeb3ba41148010a47c05753298",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4541,7 +4545,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
ConcurrencyStamp = "272db8024ec645dc837afb433687572f",
ConcurrencyStamp = "81771ab92b504c57bf3e240e41174522",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4551,7 +4555,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
ConcurrencyStamp = "9072cbd6edd74b80821d92e9d98d8d61",
ConcurrencyStamp = "ac058682bcfd43a4922543012c542b0c",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
@ -4561,7 +4565,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
ConcurrencyStamp = "8c5c164e5abc471a97ec8dada4195a53",
ConcurrencyStamp = "4962eff9d1874befaef668e046480d92",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,

162
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs

@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly;
@ -23,20 +25,12 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// BBAC发运、Edi对比导出服务
/// </summary>
public class JisBBACSeEdiCompareExportService : ITransientDependency, IExportJob
public class JisBBACSeEdiCompareExportService : SeEdiCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
@ -45,11 +39,9 @@ namespace SettleAccount.Job.Services.Report
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext)
SettleAccountDbContext settleAccountDbContext) : base(settleAccountDbContext, hubContext)
{
_hubContext = hubContext;
_fileContainer = fileContainer;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
@ -63,141 +55,12 @@ namespace SettleAccount.Job.Services.Report
var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var businessTypeDisplayName = EnumBusinessType.JisBBAC.GetAttributeOfType<DisplayAttribute>()?.Name?? EnumBusinessType.JisBBAC.ToString();
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
// Sheet行数
var maxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var excelExporterAttribute = typeof(JisBBACEidSeCompareExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (excelExporterAttribute != null)
{
maxRowNumberOnASheet = excelExporterAttribute.MaxRowNumberOnASheet > 0 ? excelExporterAttribute.MaxRowNumberOnASheet : maxRowNumberOnASheet;
}
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new JisBBACEidSeCompareExport()
{
Category = "JIS",
CarModeCode = t.Max(t => t.Extend4),
LineStationcode = t.Max(t => t.LineStationCode),
SequenceNumber = t.Max(t => t.Extend3),
ParType = t.Max(t => t.Extend2),
PN = t.Key.PN,
MaterialNumber = t.Max(t => t.LU),
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
haveEdiNotHaveSeList.ForEach(t =>
{
t.SequenceNumber = GetSequenceNumberDate(t.SequenceNumber);
t.Remark = string.IsNullOrEmpty(t.SequenceNumber) ? "PJIS出单,AJIS未上" : "";
});
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new JisBBACEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = t.Max(t => t.BillNum),
MESConfigCode = t.Max(t => t.MESConfigCode),
ShippingDate = t.Max(t => t.BillTime),
PN = t.Max(t => t.PN),
Seq = t.Max(t => t.Seq),
PjsNum = t.Max(t => t.PjsNum),
MaterialNumber = t.Max(t => t.CustPartCode),
MaterialDes = t.Max(t => t.PartDesc),
SEQty = t.Sum(t => t.Qty),
InjectionCode = t.Max(t => t.InjectionCode),
MateType = "否",
DiffDesc = "WMS有发货EDI无订单"
}).ToList();
//有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
Extend2 = groupItem.Max(t => t.Extend2),
Extend3 = groupItem.Max(t => t.Extend3),
Extend4 = groupItem.Max(t => t.Extend4),
LineStationCode = groupItem.Max(t => t.LineStationCode)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
BillNum = groupItem.Max(t => t.BillNum),
MESConfigCode = groupItem.Max(t => t.MESConfigCode),
BillTime = groupItem.Max(t => t.BillTime),
Seq = groupItem.Max(t => t.Seq),
PjsNum = groupItem.Max(t => t.PjsNum),
CustPartCode = groupItem.Max(t => t.CustPartCode),
PartDesc = groupItem.Max(t => t.PartDesc),
InjectionCode = groupItem.Max(t => t.InjectionCode)
};
var haveEdiHaveSeList = (from edi in ediGroup
join se in seGroup
on new { edi.PN, edi.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
select new JisBBACEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = edi.Extend4,
LineStationcode = edi.LineStationCode,
SequenceNumber = edi.Extend3,
ParType = edi.Extend2,
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,
Seq = se.Seq,
PjsNum = se.PjsNum,
MaterialNumber = se.CustPartCode,
MaterialDes = se.PartDesc,
SEQty = se.Qty,
EdiQty = edi.Qty,
AssemblyDate = default,
MatchNumber = default,
InjectionCode = se.InjectionCode,
MateType = se.Qty == edi.Qty ? "是" : "否",
DiffDesc = "WMS有发货EDI有订单"
}).ToList();
haveEdiHaveSeList.ForEach(t => t.SequenceNumber = GetSequenceNumberDate(t.SequenceNumber));
haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList);
haveEdiNotHaveSeList.Reverse();
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.Reverse();
var excelExporter = new ExcelExporter();
// EDI数据和发货对比
excelExporter.Append(haveEdiNotHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"BBACEDI数据和发货对比");
for (var i = 1; i < haveEdiNotHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveEdiNotHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"BBACEDI数据和发货对比-{i}");
}
// 发货和EDI数据对比
excelExporter.Append(notHaveEdiHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"BBAC发货和EDI数据对比");
for (var i = 1; i < notHaveEdiHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = notHaveEdiHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"BBAC发货和EDI数据对比-{i}");
}
var excelExporter = GetSeEdiCompareData<BBAC_SE_DETAIL, BBAC_SE_EDI, JisBBACSeEidCompareReport>(seStartDateTime, seEndDateTime, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
@ -205,18 +68,5 @@ namespace SettleAccount.Job.Services.Report
Notify();
return id.ToString();
}
#region 私有方法
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
private string GetSequenceNumberDate(string sequenceNumber)
{
var sequenceNumberDate = sequenceNumber != null && sequenceNumber.Length >= 12 ? sequenceNumber[^12..^4] : sequenceNumber;
return sequenceNumberDate;
}
#endregion
}
}

155
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs

@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Shouldly;
@ -13,7 +13,6 @@ using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
@ -21,20 +20,12 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// HBPO发运、Edi对比导出服务
/// </summary>
public class JisHBPOSeEdiCompareExportService : ITransientDependency, IExportJob
public class JisHBPOSeEdiCompareExportService : SeEdiCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
@ -42,11 +33,9 @@ namespace SettleAccount.Job.Services.Report
public JisHBPOSeEdiCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
SettleAccountDbContext settleAccountDbContext)
SettleAccountDbContext settleAccountDbContext):base(settleAccountDbContext, hubContext)
{
_hubContext = hubContext;
_fileContainer = fileContainer;
_settleAccountDbContext = settleAccountDbContext;
}
/// <summary>
@ -60,137 +49,12 @@ namespace SettleAccount.Job.Services.Report
var strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var businessTypeDisplayName = EnumBusinessType.JisHBPO.GetAttributeOfType<DisplayAttribute>()?.Name ?? EnumBusinessType.JisHBPO.ToString();
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
// Sheet行数
var maxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var excelExporterAttribute = typeof(JisHBPOEidSeCompareExport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (excelExporterAttribute != null)
{
maxRowNumberOnASheet = excelExporterAttribute.MaxRowNumberOnASheet > 0 ? excelExporterAttribute.MaxRowNumberOnASheet : maxRowNumberOnASheet;
}
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new JisHBPOEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
PN = t.Key.PN,
MaterialNumber = t.Max(t => t.LU),
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new JisHBPOEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = t.Max(t => t.BillNum),
MESConfigCode = t.Max(t => t.MESConfigCode),
ShippingDate = t.Max(t => t.BillTime),
PN = t.Max(t => t.PN),
Seq = t.Max(t => t.Seq),
PjsNum = t.Max(t => t.PjsNum),
ToLoc = t.Max(t => t.ToLoc),
ErpToLoc = t.Max(t => t.ErpToLoc),
MaterialNumber = t.Max(t => t.CustPartCode),
MaterialDes = t.Max(t => t.PartDesc),
SEQty = t.Sum(t => t.Qty),
InjectionCode = t.Max(t => t.InjectionCode),
MateType = "否",
DiffDesc = "WMS有发货EDI无订单"
}).ToList();
//有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
};
var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
BillNum = groupItem.Max(t => t.BillNum),
MESConfigCode = groupItem.Max(t => t.MESConfigCode),
BillTime = groupItem.Max(t => t.BillTime),
Seq = groupItem.Max(t => t.Seq),
PjsNum = groupItem.Max(t => t.PjsNum),
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc),
CustPartCode = groupItem.Max(t => t.CustPartCode),
PartDesc = groupItem.Max(t => t.PartDesc),
InjectionCode = groupItem.Max(t => t.InjectionCode)
};
var haveEdiHaveSeList = (from edi in ediGroup
join se in seGroup
on new { edi.PN, edi.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
select new JisHBPOEidSeCompareExport()
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = default,
LineStationcode = default,
SequenceNumber = edi.SeqNumber,
ParType = "01",
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,
Seq = se.Seq,
PjsNum = se.PjsNum,
ToLoc = se.ToLoc,
ErpToLoc = se.ErpToLoc,
MaterialNumber = se.CustPartCode,
MaterialDes = se.PartDesc,
SEQty = se.Qty,
EdiQty = edi.Qty,
AssemblyDate = default,
MatchNumber = default,
InjectionCode = se.InjectionCode,
MateType = se.Qty == edi.Qty ? "是" : "否",
DiffDesc = "WMS有发货EDI有订单"
}).ToList();
haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList);
haveEdiNotHaveSeList.Reverse();
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.Reverse();
var excelExporter = new ExcelExporter();
// EDI数据和发货对比
excelExporter.Append(haveEdiNotHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"HBPOEDI数据和发货对比");
for (var i = 1; i < haveEdiNotHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveEdiNotHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"HBPOEDI数据和发货对比-{i}");
}
// 发货和EDI数据对比
excelExporter.Append(notHaveEdiHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"HBPO发货和EDI数据对比");
for (var i = 1; i < notHaveEdiHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = notHaveEdiHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"HBPO发货和EDI数据对比-{i}");
}
var excelExporter = GetSeEdiCompareData<HBPO_SE_DETAIL, HBPO_SE_EDI, JisHBPOSeEidCompareReport>(seStartDateTime, seEndDateTime, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
@ -198,12 +62,5 @@ namespace SettleAccount.Job.Services.Report
Notify();
return id.ToString();
}
#region 私有方法
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
#endregion
}
}

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

@ -91,7 +91,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
var businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
var businessTypeDisplayName = businessType.ToString();
DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)

200
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SeEdiCompareExportBaseService.cs

@ -0,0 +1,200 @@
using System;
using System.Linq;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// 发运、Edi对比服务
/// </summary>
public class SeEdiCompareExportBaseService
{
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
public SeEdiCompareExportBaseService(SettleAccountDbContext settleAccountDbContext, IHubContext<PageHub> hubContext)
{
_settleAccountDbContext = settleAccountDbContext;
_hubContext = hubContext;
}
#region 方法
/// <summary>
/// 获取发运、Eid比对数据
/// </summary>
public ExcelExporter GetSeEdiCompareData<TSe, TEdi, TCompareReport>(DateTime seStartDateTime, DateTime seEndDateTime, string businessTypeDisplayName)
where TSe : JisSeBase
where TEdi : SE_EDI
where TCompareReport : SeEidCompareReport, new()
{
// Sheet行数
var maxRowNumberOnASheet = AppConst.DefaultRowNumberOnASheet;
var excelExporterAttribute = typeof(TCompareReport).GetAttribute<ExcelExporterAttribute>(inherit: true);
if (excelExporterAttribute != null)
{
maxRowNumberOnASheet = excelExporterAttribute.MaxRowNumberOnASheet > 0 ? excelExporterAttribute.MaxRowNumberOnASheet : maxRowNumberOnASheet;
}
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<TEdi>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new TCompareReport()
{
Category = "JIS",
CarModeCode = t.Max(t => t.Extend4),
LineStationcode = t.Max(t => t.LineStationCode),
SequenceNumber = t.Max(t => t.Extend3),
ParType = t.Max(t => t.Extend2),
PN = t.Key.PN,
MaterialNumber = t.Max(t => t.LU),
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
haveEdiNotHaveSeList.ForEach(t =>
{
t.SequenceNumber = GetSequenceNumberDate(t.SequenceNumber);
t.Remark = string.IsNullOrEmpty(t.SequenceNumber) ? "PJIS出单,AJIS未上" : "";
});
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<TSe>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace })
.Select(t => new TCompareReport()
{
Category = "JIS",
WmsBillNum = t.Max(t => t.BillNum),
MESConfigCode = t.Max(t => t.MESConfigCode),
ShippingDate = t.Max(t => t.BillTime),
PN = t.Max(t => t.PN),
Seq = t.Max(t => t.Seq),
PjsNum = t.Max(t => t.PjsNum),
ToLoc = t.Max(t => t.ToLoc),
ErpToLoc = t.Max(t => t.ErpToLoc),
MaterialNumber = t.Max(t => t.CustPartCode),
MaterialDes = t.Max(t => t.PartDesc),
SEQty = t.Sum(t => t.Qty),
InjectionCode = t.Max(t => t.InjectionCode),
MateType = "否",
DiffDesc = "WMS有发货EDI无订单"
}).ToList();
//有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<TEdi>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
Extend2 = groupItem.Max(t => t.Extend2),
Extend3 = groupItem.Max(t => t.Extend3),
Extend4 = groupItem.Max(t => t.Extend4),
LineStationCode = groupItem.Max(t => t.LineStationCode)
};
var seGroup = from se in _settleAccountDbContext.Set<TSe>()
where se.IsHaveEdiData == true && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
BillNum = groupItem.Max(t => t.BillNum),
MESConfigCode = groupItem.Max(t => t.MESConfigCode),
BillTime = groupItem.Max(t => t.BillTime),
Seq = groupItem.Max(t => t.Seq),
PjsNum = groupItem.Max(t => t.PjsNum),
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc),
CustPartCode = groupItem.Max(t => t.CustPartCode),
PartDesc = groupItem.Max(t => t.PartDesc),
InjectionCode = groupItem.Max(t => t.InjectionCode)
};
var haveEdiHaveSeList = (from edi in ediGroup
join se in seGroup
on new { edi.PN, edi.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
select new TCompareReport()
{
Category = "JIS",
WmsBillNum = se.BillNum,
CarModeCode = edi.Extend4,
LineStationcode = edi.LineStationCode,
SequenceNumber = edi.Extend3,
ParType = edi.Extend2,
MESConfigCode = se.MESConfigCode,
ShippingDate = se.BillTime,
PN = se.PN,
Seq = se.Seq,
PjsNum = se.PjsNum,
ToLoc = se.ToLoc,
ErpToLoc = se.ErpToLoc,
MaterialNumber = se.CustPartCode,
MaterialDes = se.PartDesc,
SEQty = se.Qty,
EdiQty = edi.Qty,
AssemblyDate = default,
MatchNumber = default,
InjectionCode = se.InjectionCode,
MateType = se.Qty == edi.Qty ? "是" : "否",
DiffDesc = "WMS有发货EDI有订单"
}).ToList();
haveEdiHaveSeList.ForEach(t => t.SequenceNumber = GetSequenceNumberDate(t.SequenceNumber));
haveEdiNotHaveSeList.AddRange(haveEdiHaveSeList);
haveEdiNotHaveSeList.Reverse();
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
notHaveEdiHaveSeList.Reverse();
var excelExporter = new ExcelExporter();
// EDI数据和发货对比
excelExporter.Append(haveEdiNotHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}EDI数据和发货对比");
for (var i = 1; i < haveEdiNotHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = haveEdiNotHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}EDI数据和发货对比-{i}");
}
// 发货和EDI数据对比
excelExporter.Append(notHaveEdiHaveSeList.Take(maxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}发货和EDI数据对比");
for (var i = 1; i < notHaveEdiHaveSeList.Count / maxRowNumberOnASheet + ((haveEdiNotHaveSeList.Count % maxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = notHaveEdiHaveSeList.Skip(i * maxRowNumberOnASheet).Take(maxRowNumberOnASheet).ToList();
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}发货和EDI数据对比-{i}");
}
return excelExporter;
}
/// <summary>
/// 通知
/// </summary>
public void Notify()
{
_hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
/// <summary>
/// 获取生产码日期
/// </summary>
public string GetSequenceNumberDate(string sequenceNumber)
{
var sequenceNumberDate = sequenceNumber != null && sequenceNumber.Length >= 12 ? sequenceNumber[^12..^4] : sequenceNumber;
return sequenceNumberDate;
}
#endregion
}
}
Loading…
Cancel
Save