mahao
1 year ago
19 changed files with 6189 additions and 189 deletions
@ -0,0 +1,47 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Jis结算与发运对比请求Dto
|
||||
|
/// </summary>
|
||||
|
public class JisEdiSeCompareRequestDto |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 期间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "期间")] |
||||
|
[Required(ErrorMessage = "{0}不能为空")] |
||||
|
public string Version { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 零件号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "零件号")] |
||||
|
public string LU { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 通用码
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "通用码")] |
||||
|
public string PN { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 发运开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "发运开始时间")] |
||||
|
public DateTime? SeStartDateTime { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 发运结束时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "发运结束时间")] |
||||
|
public DateTime? SeEndDateTime { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 下线开始时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "下线开始时间")] |
||||
|
public DateTime? DownLineStartDateTime { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 下线结束时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "下线结束时间")] |
||||
|
public DateTime? DownLineEndDateTime { get; set; } |
||||
|
} |
@ -0,0 +1,147 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Magicodes.ExporterAndImporter.Core; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Reports; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// JisBBAC Edi与发运对比
|
||||
|
/// </summary>
|
||||
|
public class JisBBACEidSeCompareReport |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// JisBBAC Edi与发运对比导出
|
||||
|
/// </summary>
|
||||
|
[ExcelExporter(MaxRowNumberOnASheet = 900000)] |
||||
|
public class JisBBACEidSeCompareExport |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 类别
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "类别")] |
||||
|
[ExporterHeader(DisplayName = "类别")] |
||||
|
public string Category { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 交货单号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "交货单号")] |
||||
|
[ExporterHeader(DisplayName = "交货单号")] |
||||
|
public string WmsBillNum { get; set; } |
||||
|
/// <summary>
|
||||
|
/// CarModeCode
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "CarModeCode")] |
||||
|
[ExporterHeader(DisplayName = "CarModeCode")] |
||||
|
public string CarModeCode { get; set; } |
||||
|
/// <summary>
|
||||
|
/// LineStationcode
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "LineStationcode")] |
||||
|
[ExporterHeader(DisplayName = "LineStationcode")] |
||||
|
public string LineStationcode { get; set; } |
||||
|
/// <summary>
|
||||
|
/// SequenceNumber
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "SequenceNumber")] |
||||
|
[ExporterHeader(DisplayName = "SequenceNumber")] |
||||
|
public string SequenceNumber { 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 PN { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 序列号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "序列号")] |
||||
|
[ExporterHeader(DisplayName = "序列号")] |
||||
|
public string 序列号 { get; set; } |
||||
|
/// <summary>
|
||||
|
/// PJIS日顺序号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "PJIS日顺序号")] |
||||
|
[ExporterHeader(DisplayName = "PJIS日顺序号")] |
||||
|
public string PJIS日顺序号 { 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 { set; get; } |
||||
|
/// <summary>
|
||||
|
/// 客户下线时间
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "客户下线时间")] |
||||
|
[ExporterHeader(DisplayName = "客户下线时间")] |
||||
|
public DateTime AssemblyDate { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 小总成号
|
||||
|
/// </summary>
|
||||
|
[Display(Name = "小总成号")] |
||||
|
[ExporterHeader(DisplayName = "小总成号")] |
||||
|
public DateTime 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; } |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,87 @@ |
|||||
|
using System; |
||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace Win.Sfs.SettleAccount.Migrations |
||||
|
{ |
||||
|
public partial class _202308151 : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("27b08950-27f6-42ae-aeff-c7d19315b467")); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_PUB_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "BillNum", |
||||
|
table: "Set_PUB_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<DateTime>( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_PUB_SE_DETAIL", |
||||
|
type: "datetime2", |
||||
|
nullable: false, |
||||
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_PUB_SE_DETAIL", |
||||
|
type: "nvarchar(max)", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<int>( |
||||
|
name: "State", |
||||
|
table: "Set_PUB_SE_DETAIL", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
defaultValue: 0); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiBalance", |
||||
|
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
||||
|
values: new object[] { new Guid("f4806a25-4884-41e5-a8d1-6039726b418a"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "56d140554b1f4a679568b60866a9750a", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DeleteData( |
||||
|
table: "Set_VmiBalance", |
||||
|
keyColumn: "Id", |
||||
|
keyValue: new Guid("f4806a25-4884-41e5-a8d1-6039726b418a")); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "AssembleData", |
||||
|
table: "Set_PUB_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "BillNum", |
||||
|
table: "Set_PUB_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CreateTime", |
||||
|
table: "Set_PUB_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "CustPartCode", |
||||
|
table: "Set_PUB_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "State", |
||||
|
table: "Set_PUB_SE_DETAIL"); |
||||
|
|
||||
|
migrationBuilder.InsertData( |
||||
|
table: "Set_VmiBalance", |
||||
|
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
||||
|
values: new object[] { new Guid("27b08950-27f6-42ae-aeff-c7d19315b467"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "86c4ebf001bf4993a0cca2af4216ba92", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -1,46 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using TaskJob.EventArgs; |
|
||||
using TaskJob.Interfaces; |
|
||||
using Volo.Abp.BlobStoring; |
|
||||
using Volo.Abp.DependencyInjection; |
|
||||
using Volo.Abp.ObjectMapping; |
|
||||
using Win.Sfs.BaseData.ImportExcelCommon; |
|
||||
|
|
||||
namespace SettleAccount.Job.Services.Report |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// BBACEdi与发运对比导出服务
|
|
||||
/// </summary>
|
|
||||
public class BBACEdiSeCompareExportService : ITransientDependency, IExportJob |
|
||||
{ |
|
||||
/// <summary>
|
|
||||
/// 文件容器
|
|
||||
/// </summary>
|
|
||||
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// AutoMapper
|
|
||||
/// </summary>
|
|
||||
private readonly IObjectMapper _objectMapper; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 构造
|
|
||||
/// </summary>
|
|
||||
public BBACEdiSeCompareExportService( |
|
||||
IBlobContainer<MyFileContainer> fileContainer, |
|
||||
IObjectMapper objectMapper) |
|
||||
{ |
|
||||
_fileContainer = fileContainer; |
|
||||
_objectMapper = objectMapper; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 导出
|
|
||||
/// </summary>
|
|
||||
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
|
||||
{ |
|
||||
return ""; |
|
||||
} |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,294 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Linq.Dynamic.Core; |
||||
|
using Magicodes.ExporterAndImporter.Excel; |
||||
|
using Microsoft.AspNetCore.SignalR; |
||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using SettleAccount.Domain.BQ; |
||||
|
using SettleAccount.Job.SignalR; |
||||
|
using Shouldly; |
||||
|
using TaskJob.EventArgs; |
||||
|
using TaskJob.Interfaces; |
||||
|
using Volo.Abp.BlobStoring; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
using Volo.Abp.ObjectMapping; |
||||
|
using Win.Sfs.BaseData.ImportExcelCommon; |
||||
|
using Win.Sfs.SettleAccount; |
||||
|
using Win.Sfs.SettleAccount.Entities.BQ; |
||||
|
using Win.Sfs.SettleAccount.Enums; |
||||
|
using Win.Sfs.SettleAccount.Reports; |
||||
|
|
||||
|
namespace SettleAccount.Job.Services.Report |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// BBACEdi与发运对比导出服务
|
||||
|
/// </summary>
|
||||
|
public class JisBBACEdiSeCompareExportService : ITransientDependency, IExportJob |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// HubContext
|
||||
|
/// </summary>
|
||||
|
private readonly IHubContext<PageHub> _hubContext; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 文件容器
|
||||
|
/// </summary>
|
||||
|
private readonly IBlobContainer<MyFileContainer> _fileContainer; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// AutoMapper
|
||||
|
/// </summary>
|
||||
|
private readonly IObjectMapper _objectMapper; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// AutoMapper
|
||||
|
/// </summary>
|
||||
|
private readonly SettleAccountDbContext _settleAccountDbContext; |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 构造
|
||||
|
/// </summary>
|
||||
|
public JisBBACEdiSeCompareExportService( |
||||
|
IHubContext<PageHub> hubContext, |
||||
|
IBlobContainer<MyFileContainer> fileContainer, |
||||
|
IObjectMapper objectMapper, |
||||
|
SettleAccountDbContext settleAccountDbContext) |
||||
|
{ |
||||
|
_hubContext = hubContext; |
||||
|
_fileContainer = fileContainer; |
||||
|
_objectMapper = objectMapper; |
||||
|
_settleAccountDbContext = settleAccountDbContext; |
||||
|
} |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 导出
|
||||
|
/// </summary>
|
||||
|
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property) |
||||
|
{ |
||||
|
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value; |
||||
|
var lu = property.Where(p => p.Name == "LU").FirstOrDefault().Value; |
||||
|
var pn = property.Where(p => p.Name == "PN").FirstOrDefault().Value; |
||||
|
var seStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value; |
||||
|
var seEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value; |
||||
|
|
||||
|
//有EDI的发运数据
|
||||
|
var haveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true); |
||||
|
//有发运的EDI数据
|
||||
|
//var haveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true && haveEidSes.Select(t => new { t.PN, t.LU }).Contains(new { t.PN, t.LU }));
|
||||
|
var haveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).Join(haveEidSes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (edi, se) => edi); |
||||
|
//无EDI的发运数据
|
||||
|
var notHaveEidSes = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false); |
||||
|
//无发运的EDI数据
|
||||
|
var notHaveSeEids = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false); |
||||
|
|
||||
|
//有EDI有发运
|
||||
|
var haveEdiHaveSes = haveEidSes.ToList(); |
||||
|
var dsdddd = haveSeEids.ToList(); |
||||
|
//有EDI无发运
|
||||
|
var haveEdiNotHaveSes = notHaveEidSes.ToList(); |
||||
|
//无EDI有发运
|
||||
|
var notHaveEdiHaveSes = notHaveSeEids.ToList(); |
||||
|
|
||||
|
var ids = id.ToString(); |
||||
|
|
||||
|
|
||||
|
//var seDetailGroup = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
|
||||
|
//var ediDetailGroup = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU, Qty = t.Sum(t => t.Qty) });
|
||||
|
//var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU, a.Qty }, b => new { b.PN, b.LU, b.Qty }, (se, edi) => new { se.PN, se.LU });
|
||||
|
//var seDetails = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
|
||||
|
//var ediDetails = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => keyCodes.Contains(new { t.PN, t.LU }));
|
||||
|
|
||||
|
|
||||
|
////有EDI有发运
|
||||
|
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
||||
|
////有EDI无发运
|
||||
|
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
||||
|
////无EDI有发运
|
||||
|
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
||||
|
|
||||
|
|
||||
|
//seDetails.ForEach(t => t.IsHaveEdiData = true);
|
||||
|
//ediDetails.ForEach(t => t.IsHaveSeData = true);
|
||||
|
//db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
|
||||
|
//db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
|
||||
|
//await db.SaveChangesAsync().ConfigureAwait(false);
|
||||
|
|
||||
|
//EnumBusinessType businessType = (EnumBusinessType)Enum.Parse(typeof(EnumBusinessType), strBusinessType);
|
||||
|
//var businessTypeDisplayName = businessType.ToString();
|
||||
|
//DisplayAttribute attributeOfType = businessType.GetAttributeOfType<DisplayAttribute>();
|
||||
|
//if (attributeOfType != null)
|
||||
|
//{
|
||||
|
// businessTypeDisplayName = attributeOfType.Name;
|
||||
|
//}
|
||||
|
//var filename = exportName.FirstOrDefault();
|
||||
|
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
|
||||
|
|
||||
|
//pubSaSeCompareDiffs.ForEach(p =>
|
||||
|
//{
|
||||
|
// p.Category = (string.IsNullOrEmpty(p.SaLU), string.IsNullOrEmpty(p.SeLU)) switch
|
||||
|
// {
|
||||
|
// (false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe,
|
||||
|
// (false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe,
|
||||
|
// (true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe,
|
||||
|
// _ => EnumPubSaSeCompareCategory.None,
|
||||
|
// };
|
||||
|
//});
|
||||
|
|
||||
|
////有结算有发运
|
||||
|
//var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
||||
|
////有结算无发运
|
||||
|
//var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
||||
|
////无结算有发运
|
||||
|
//var notHaveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
||||
|
////二次匹配上的记录
|
||||
|
//var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
|
||||
|
|
||||
|
//haveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
|
||||
|
//haveSaNotHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SaLU);
|
||||
|
//notHaveSaHaveSes.ForEach(t => t.PrimitiveLU = t.ReplaceLU = t.SeLU);
|
||||
|
|
||||
|
//#region 二次对比
|
||||
|
////二次对比(替换零件号)
|
||||
|
//var repLUs = notHaveSaHaveSes.Select(t => t.SeLU).Distinct().ToList();
|
||||
|
//var tbRePartsRelationships = _tbRePartsRelationshipRepository.GetListAsync(t => repLUs.Contains(t.RepLU) && t.BusinessType == businessType).Result;
|
||||
|
|
||||
|
//tbRePartsRelationships.ForEach(tbRePartsRelationship =>
|
||||
|
//{
|
||||
|
// notHaveSaHaveSes.FindAll(t => t.SeLU == tbRePartsRelationship.RepLU).ForEach(t =>
|
||||
|
// {
|
||||
|
// t.ReplaceLU = tbRePartsRelationship.LU;
|
||||
|
// });
|
||||
|
//});
|
||||
|
|
||||
|
//var haveSaNotHaveSeLUPNs = haveSaNotHaveSes.Select(t => new { t.ReplaceLU, t.PN });
|
||||
|
//var notHaveSaHaveSeLUPNs = notHaveSaHaveSes.Select(t => new { t.ReplaceLU, t.PN });
|
||||
|
////二次匹配 匹配上的零件号
|
||||
|
//var secondMatchLUPNs = haveSaNotHaveSeLUPNs.Intersect(notHaveSaHaveSeLUPNs);
|
||||
|
//if (secondMatchLUPNs.Any() == true)
|
||||
|
//{
|
||||
|
// pubSaSeCompareDiffs.RemoveAll<PubSaSeCompareDiff>(t => secondMatchLUPNs.Contains(new { t.ReplaceLU, t.PN }));
|
||||
|
|
||||
|
// foreach (var secondMatchLUPN in secondMatchLUPNs)
|
||||
|
// {
|
||||
|
// var haveSaNotHaveSe = haveSaNotHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
|
||||
|
// var notHaveSaHaveSe = notHaveSaHaveSes.FirstOrDefault(t => t.ReplaceLU == secondMatchLUPN.ReplaceLU && t.PN == secondMatchLUPN.PN);
|
||||
|
// secondMatchHaveSaHaveSes.Add(new PubSaSeCompareDiff()
|
||||
|
// {
|
||||
|
// WmsBillNum = notHaveSaHaveSe.WmsBillNum,
|
||||
|
// ShippingDate = notHaveSaHaveSe.ShippingDate,
|
||||
|
// SeqNumber = notHaveSaHaveSe.SeqNumber,
|
||||
|
// PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
|
||||
|
// MaterialNumber = haveSaNotHaveSe.MaterialNumber,
|
||||
|
// MaterialDes = haveSaNotHaveSe.MaterialDes,
|
||||
|
// CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
|
||||
|
// SAQty = haveSaNotHaveSe.SAQty,
|
||||
|
// SEQty = notHaveSaHaveSe.SEQty,
|
||||
|
// MateType = haveSaNotHaveSe.MateType,
|
||||
|
// FixPrice = haveSaNotHaveSe.FixPrice,
|
||||
|
// PrimitiveLU = haveSaNotHaveSe.PrimitiveLU,
|
||||
|
// ReplaceLU = haveSaNotHaveSe.ReplaceLU,
|
||||
|
// SeLU = notHaveSaHaveSe.SeLU,
|
||||
|
// SaLU = haveSaNotHaveSe.SaLU,
|
||||
|
// PN = haveSaNotHaveSe.PN,
|
||||
|
// Category = EnumPubSaSeCompareCategory.HaveSaHaveSe,
|
||||
|
// IsRemove = false
|
||||
|
// });
|
||||
|
// }
|
||||
|
//}
|
||||
|
|
||||
|
////二次对比比对上的数据入库
|
||||
|
//if (secondMatchHaveSaHaveSes.Count > 0)
|
||||
|
//{
|
||||
|
// pubSaSeCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
|
||||
|
|
||||
|
// var pubSeCDetailEntitys = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PUB_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
|
||||
|
// _pubSeCDetailRepository.InsertManyAsync(pubSeCDetailEntitys);
|
||||
|
//}
|
||||
|
//#endregion
|
||||
|
|
||||
|
//if (string.IsNullOrEmpty(lu) == false)
|
||||
|
//{
|
||||
|
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.SaLU == lu || p.SeLU == lu);
|
||||
|
//}
|
||||
|
//if (string.IsNullOrEmpty(pn) == false)
|
||||
|
//{
|
||||
|
// pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
|
||||
|
//}
|
||||
|
|
||||
|
//var pubSaSeCompareDetailExports = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExport>>(pubSaSeCompareDiffs);
|
||||
|
|
||||
|
////结算核对汇总
|
||||
|
//var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
||||
|
//{
|
||||
|
// LU = p.Key,
|
||||
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
||||
|
// SAQty = p.Sum(t => t.SAQty),
|
||||
|
// SEQty = p.Sum(t => t.SEQty)
|
||||
|
//}).ToList();
|
||||
|
|
||||
|
////有结算有发运
|
||||
|
//var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
|
||||
|
////有结算有发运汇总
|
||||
|
//var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
||||
|
//{
|
||||
|
// LU = p.Key,
|
||||
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
||||
|
// SAQty = p.Sum(t => t.SAQty),
|
||||
|
// SEQty = p.Sum(t => t.SEQty)
|
||||
|
//}).ToList();
|
||||
|
////有结算无发运
|
||||
|
//var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
|
||||
|
////有结算无发运
|
||||
|
//var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
||||
|
//{
|
||||
|
// LU = p.Key,
|
||||
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
||||
|
// SAQty = p.Sum(t => t.SAQty),
|
||||
|
// SEQty = p.Sum(t => t.SEQty)
|
||||
|
//}).ToList();
|
||||
|
////无结算有发运
|
||||
|
//var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
|
||||
|
////无结算有发运
|
||||
|
//var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceLU).Select(p => new PubSaSeCompareSumExport()
|
||||
|
//{
|
||||
|
// LU = p.Key,
|
||||
|
// MaterialDes = p.FirstOrDefault().MaterialDes,
|
||||
|
// SAQty = p.Sum(t => t.SAQty),
|
||||
|
// SEQty = p.Sum(t => t.SEQty)
|
||||
|
//}).ToList();
|
||||
|
|
||||
|
//ExcelExporter excelExporter = new ExcelExporter();
|
||||
|
//excelExporter
|
||||
|
// .Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
|
||||
|
// .SeparateBySheet()
|
||||
|
// .Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
|
||||
|
// .SeparateBySheet()
|
||||
|
|
||||
|
// .Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
|
||||
|
// .SeparateBySheet()
|
||||
|
// .Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
|
||||
|
// .SeparateBySheet()
|
||||
|
|
||||
|
// .Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
|
||||
|
// .SeparateBySheet()
|
||||
|
// .Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出")
|
||||
|
// .SeparateBySheet();
|
||||
|
|
||||
|
//var result = excelExporter.ExportAppendDataAsByteArray();
|
||||
|
//result.ShouldNotBeNull();
|
||||
|
//_fileContainer.SaveAsync(filename, result.Result, true);
|
||||
|
|
||||
|
//Notify();
|
||||
|
return id.ToString(); |
||||
|
} |
||||
|
|
||||
|
#region 私有方法
|
||||
|
private void Notify() |
||||
|
{ |
||||
|
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", ""); |
||||
|
} |
||||
|
#endregion
|
||||
|
} |
||||
|
} |
Loading…
Reference in new issue