diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs index 9fe7d292..165fd14f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs @@ -39,7 +39,7 @@ public class JisHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobService EnumDeliverSubBillType.保险杠HBPO, EnumDeliverSubBillType.小件HBPO }, - BusinessType = EnumBusinessType.MaiDanJianHBPO + BusinessType = EnumBusinessType.JisHBPO }; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs index cd12dd2f..17d15e2e 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs @@ -8,7 +8,6 @@ using EFCore.BulkExtensions; using Microsoft.AspNetCore.Mvc; using SettleAccount.Domain.BQ; using Volo.Abp.Application.Services; -using Volo.Abp.Uow; using Win.Sfs.SettleAccount.Entities.BQ.Managers; using Win.Sfs.SettleAccount.EntityFrameworkCore; using Win.Sfs.SettleAccount.MaterialRelationships; @@ -88,11 +87,10 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable /// /// 同步JitRecord /// - [UnitOfWork] private async Task SyncJitRecordAsync() { //同步表名称 - var syncTableName = "JisBBACSeSync_Jit"; + var syncTableName = $"{SeSyncConfigInfo.SyncTableName}_Jit"; //同步发运主类型 var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; //同步发运子类型 @@ -152,11 +150,10 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable /// /// 同步JisRecord /// - [UnitOfWork] private async Task SyncJisRecordAsync() { //同步表名称 - var syncTableName = "JisBBACSeSync_Jit"; + var syncTableName = $"{SeSyncConfigInfo.SyncTableName}_Jis"; //同步发运主类型 var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; //同步发运子类型 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs index b371bd05..fc4aa8a7 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/JisBBACEidSeCompareReport.cs @@ -65,7 +65,7 @@ public class JisBBACEidSeCompareExport /// [Display(Name = "发货日期")] [ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")] - public DateTime ShippingDate { get; set; } + public DateTime? ShippingDate { get; set; } /// /// 生产码 /// @@ -119,13 +119,13 @@ public class JisBBACEidSeCompareExport /// [Display(Name = "客户下线时间")] [ExporterHeader(DisplayName = "客户下线时间")] - public DateTime AssemblyDate { get; set; } + public DateTime? AssemblyDate { get; set; } /// /// 小总成号 /// [Display(Name = "小总成号")] [ExporterHeader(DisplayName = "小总成号")] - public DateTime MatchNumber { get; set; } + public string MatchNumber { get; set; } /// /// 注塑码 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs index 2c158994..ed16e5fa 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs @@ -68,67 +68,123 @@ namespace SettleAccount.Job.Services.Report 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 haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => - //t.First().SetQty(t.Sum(q => q.Qty))).ToList(); - var seDetailGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }).ToList(); - - // var haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => - //t.FirstOrDefault()).ToList(); - - var dddd = new JisBBACEidSeCompareExport() - { - Category = default, - WmsBillNum = default, - CarModeCode = default, - LineStationcode = default, - SequenceNumber = default, - ParType = default, - MESConfigCode = default, - ShippingDate = default, - PN = default, - 序列号 = default, - PJIS日顺序号 = default, - MaterialNumber = default, - MaterialDes = default, - SEQty = default, - EdiQty = default, - DiffQty = default, - AssemblyDate = default, - MatchNumber = default, - InjectionCode = default, - MateType = default, - DiffDesc = default - }; - - var haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new JisBBACEidSeCompareExport() - { - Category = default, - WmsBillNum = default, - CarModeCode = default, - LineStationcode = default, - SequenceNumber = default, - ParType = default, - MESConfigCode = default, - ShippingDate = default, - PN = default, - 序列号 = default, - PJIS日顺序号 = default, - MaterialNumber = default, - MaterialDes = default, - SEQty = default, - EdiQty = default, - DiffQty = default, - AssemblyDate = default, - MatchNumber = default, - InjectionCode = default, - MateType = default, - DiffDesc = default - }).ToList(); - - var haveEidSesGroup22 = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true)?.GroupBy(t => new { t.PN, t.LU }).Select(t => -t.FirstOrDefault()).ToList(); + var filename = exportName.FirstOrDefault(); + //有EDI无发运 + var haveEdiNotHaveSe = _settleAccountDbContext.Set().Where(t => t.IsHaveSeData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisBBACEidSeCompareExport() + { + Category = "JIS", + WmsBillNum = default, + CarModeCode = default, + LineStationcode = default, + SequenceNumber = default, + ParType = default, + MESConfigCode = default, + ShippingDate = null, + PN = default, + 序列号 = default, + PJIS日顺序号 = default, + MaterialNumber = default, + MaterialDes = default, + SEQty = default, + EdiQty = default, + DiffQty = default, + AssemblyDate = null, + MatchNumber = default, + InjectionCode = default, + MateType = default, + DiffDesc = default + }).ToList(); + //无EDI有发运 + var notHaveEdiHaveSe = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == false) + .GroupBy(t => new { t.LU, t.PN }) + .Select(t => new JisBBACEidSeCompareExport() + { + Category = default, + WmsBillNum = default, + CarModeCode = default, + LineStationcode = default, + SequenceNumber = default, + ParType = default, + MESConfigCode = default, + ShippingDate = null, + PN = default, + 序列号 = default, + PJIS日顺序号 = default, + MaterialNumber = default, + MaterialDes = default, + SEQty = default, + EdiQty = default, + DiffQty = default, + AssemblyDate = null, + MatchNumber = default, + InjectionCode = default, + MateType = default, + DiffDesc = default + }).ToList(); + + +// //有EDI的发运数据 +// //var haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => +// //t.First().SetQty(t.Sum(q => q.Qty))).ToList(); +// var seDetailGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }).ToList(); + +// // var haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => +// //t.FirstOrDefault()).ToList(); + +// var dddd = new JisBBACEidSeCompareExport() +// { +// Category = default, +// WmsBillNum = default, +// CarModeCode = default, +// LineStationcode = default, +// SequenceNumber = default, +// ParType = default, +// MESConfigCode = default, +// ShippingDate = default, +// PN = default, +// 序列号 = default, +// PJIS日顺序号 = default, +// MaterialNumber = default, +// MaterialDes = default, +// SEQty = default, +// EdiQty = default, +// DiffQty = default, +// AssemblyDate = default, +// MatchNumber = default, +// InjectionCode = default, +// MateType = default, +// DiffDesc = default +// }; + +// var haveEidSesGroup = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => new JisBBACEidSeCompareExport() +// { +// Category = default, +// WmsBillNum = default, +// CarModeCode = default, +// LineStationcode = default, +// SequenceNumber = default, +// ParType = default, +// MESConfigCode = default, +// ShippingDate = default, +// PN = default, +// 序列号 = default, +// PJIS日顺序号 = default, +// MaterialNumber = default, +// MaterialDes = default, +// SEQty = default, +// EdiQty = default, +// DiffQty = default, +// AssemblyDate = default, +// MatchNumber = default, +// InjectionCode = default, +// MateType = default, +// DiffDesc = default +// }).ToList(); + +// var haveEidSesGroup22 = _settleAccountDbContext.Set().Where(t => t.IsHaveEdiData == true)?.GroupBy(t => new { t.PN, t.LU }).Select(t => +//t.FirstOrDefault()).ToList(); //有发运的EDI数据 //var haveSeEidsGroup = _settleAccountDbContext.Set().Where(t => t.IsDeleted == false && t.IsHaveSeData == true).GroupBy(t => new { t.PN, t.LU }).Select(t => t.First().SetQty(t.Sum(q => q.Qty))).ToList(); @@ -173,16 +229,16 @@ t.FirstOrDefault()).ToList(); ////无EDI有发运 //var notHaveEdiHaveSeCompareExports = haveEidHaveSes.ToList(); - //ExcelExporter excelExporter = new ExcelExporter(); - //excelExporter - // .Append(haveEdiNotHaveSeCompareExports, $"BBACEDI数据和发货对比") - // .SeparateBySheet() - // .Append(notHaveEdiHaveSeCompareExports, $"BBAC发货和EDI数据对比") - // .SeparateBySheet(); + ExcelExporter excelExporter = new ExcelExporter(); + excelExporter + .Append(haveEdiNotHaveSe.ToList(), $"BBACEDI数据和发货对比") + .SeparateBySheet() + .Append(notHaveEdiHaveSe.ToList(), $"BBAC发货和EDI数据对比") + .SeparateBySheet(); - //var result = excelExporter.ExportAppendDataAsByteArray(); - //result.ShouldNotBeNull(); - ////_fileContainer.SaveAsync(filename, result.Result, true); + var result = excelExporter.ExportAppendDataAsByteArray(); + result.ShouldNotBeNull(); + _fileContainer.SaveAsync(filename, result.Result, true); //Notify(); return id.ToString();