Browse Source

Jis对比

master
mahao 1 year ago
parent
commit
48b52014eb
  1. 17
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
  2. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs
  3. 45
      code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumSaSeEdiCompareCategory.cs
  4. 327
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  5. 183
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaEdiSeCompareExportService.cs
  6. 180
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  7. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs
  8. 183
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs
  9. 179
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  10. 16
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs
  11. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  12. 191
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  13. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  14. 141
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs
  15. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobModule.cs

17
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -48,16 +47,17 @@ public class CompareService : ApplicationService
var customConditionList = new List<CustomCondition>(); var customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = ediSeCompareRequestDto.Version }); customConditionList.Add(new CustomCondition() { Name = "Version", Value = ediSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)ediSeCompareRequestDto.BusinessType).ToString() });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = ediSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = ediSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = ediSeCompareRequestDto.LU }); customConditionList.Add(new CustomCondition() { Name = "LU", Value = ediSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = ediSeCompareRequestDto.PN }); customConditionList.Add(new CustomCondition() { Name = "PN", Value = ediSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = ediSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = ediSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
var jobMoudle = ediSeCompareRequestDto.BusinessType switch var jobMoudle = ediSeCompareRequestDto.BusinessType switch
{ {
EnumBusinessType.JisBBAC => typeof(JisBBACEdiSeCompareExportService), EnumBusinessType.JisBBAC => typeof(JisBBACSeEdiCompareExportService),
EnumBusinessType.JisHBPO => typeof(JisHBPOEdiSeCompareExportService), EnumBusinessType.JisHBPO => typeof(JisHBPOSeEdiCompareExportService),
_ => throw new UserFriendlyException($"{nameof(ediSeCompareRequestDto.BusinessType)}参数值无效", "403") _ => throw new UserFriendlyException($"{nameof(ediSeCompareRequestDto.BusinessType)}参数值无效", "403")
}; };
@ -85,14 +85,17 @@ public class CompareService : ApplicationService
var customConditionList = new List<CustomCondition>(); var customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version }); customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version });
customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)saSeCompareRequestDto.BusinessType).ToString() });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = saSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = saSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
customConditionList.Add(new CustomCondition() { Name = "LU", Value = saSeCompareRequestDto.LU }); customConditionList.Add(new CustomCondition() { Name = "LU", Value = saSeCompareRequestDto.LU });
customConditionList.Add(new CustomCondition() { Name = "PN", Value = saSeCompareRequestDto.PN }); customConditionList.Add(new CustomCondition() { Name = "PN", Value = saSeCompareRequestDto.PN });
customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName }); customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = saSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = saSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
var jobMoudle = saSeCompareRequestDto.BusinessType switch var jobMoudle = saSeCompareRequestDto.BusinessType switch
{ {
EnumBusinessType.JisBBAC => typeof(JisBBACSaSeEdiCompareExportService),
EnumBusinessType.JisHBPO => typeof(JisHBPOSaSeEdiCompareExportService),
EnumBusinessType.ZhiGongJianBBAC => typeof(PubSaSeCompareExportService), EnumBusinessType.ZhiGongJianBBAC => typeof(PubSaSeCompareExportService),
EnumBusinessType.ZhiGongJianHBPO => typeof(PubSaSeCompareExportService), EnumBusinessType.ZhiGongJianHBPO => typeof(PubSaSeCompareExportService),
EnumBusinessType.MaiDanJianBBAC => typeof(MaiDanBBACSaSeCompareExportService), EnumBusinessType.MaiDanJianBBAC => typeof(MaiDanBBACSaSeCompareExportService),

16
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationModule.cs

@ -63,13 +63,21 @@ namespace Win.Sfs.SettleAccount
{ {
Func<string, IExportJob> accesor = key => Func<string, IExportJob> accesor = key =>
{ {
if (key.Equals(typeof(JisBBACEdiSeCompareExportService).FullName)) if (key.Equals(typeof(JisBBACSeEdiCompareExportService).FullName))
{ {
return implementationFactory.GetService<JisBBACEdiSeCompareExportService>(); return implementationFactory.GetService<JisBBACSeEdiCompareExportService>();
} }
if (key.Equals(typeof(JisHBPOEdiSeCompareExportService).FullName)) if (key.Equals(typeof(JisHBPOSeEdiCompareExportService).FullName))
{ {
return implementationFactory.GetService<JisHBPOEdiSeCompareExportService>(); return implementationFactory.GetService<JisHBPOSeEdiCompareExportService>();
}
if (key.Equals(typeof(JisBBACSaSeEdiCompareExportService).FullName))
{
return implementationFactory.GetService<JisBBACSaSeEdiCompareExportService>();
}
if (key.Equals(typeof(JisHBPOSaSeEdiCompareExportService).FullName))
{
return implementationFactory.GetService<JisHBPOSaSeEdiCompareExportService>();
} }
if (key.Equals(typeof(MaiDanBBACSaSeCompareExportService).FullName)) if (key.Equals(typeof(MaiDanBBACSaSeCompareExportService).FullName))
{ {

45
code/src/Modules/SettleAccount/src/SettleAccount.Domain.Shared/Enums/EnumSaSeEdiCompareCategory.cs

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount.Enums;
/// <summary>
/// 结算、发运、Edi比对类型
/// </summary>
public enum EnumSaSeEdiCompareCategory
{
/// <summary>
/// 未定义
/// </summary>
[Display(Name = "未定义")]
None = 0,
/// <summary>
/// 有结算有发运(有EDI数据)
/// </summary>
[Display(Name = "有结算有发运(有EDI数据")]
HaveSaHaveSeHaveEdi = 1,
/// <summary>
/// 有结算有发运(无EDI数据)
/// </summary>
[Display(Name = "有结算有发运(无EDI数据)")]
HaveSaHaveSeNotHaveEdi = 2,
/// <summary>
/// 有结算无发运(有EDI数据)
/// </summary>
[Display(Name = "有结算无发运(有EDI数据)")]
HaveSaNotHaveSeHaveEdi = 3,
/// <summary>
/// 有结算无发运(无EDI数据)
/// </summary>
[Display(Name = "有结算无发运(无EDI数据)")]
HaveSaNotHaveSeNotHaveEdi = 4,
/// <summary>
/// 无结算有发运(有EDI数据)
/// </summary>
[Display(Name = "无结算有发运(有EDI数据)")]
NotHaveSaHaveSeHaveEdi = 5,
/// <summary>
/// 无结算有发运(无EDI数据)
/// </summary>
[Display(Name = "无结算有发运(无EDI数据)")]
NotHaveSaHaveSeNotHaveEdi = 6
}

327
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs

@ -0,0 +1,327 @@
using System;
using System.ComponentModel.DataAnnotations;
using Magicodes.ExporterAndImporter.Core;
using Magicodes.ExporterAndImporter.Excel;
using Win.Sfs.SettleAccount.Enums;
namespace Win.Sfs.SettleAccount.Reports;
/// <summary>
/// 结算、EDI、发运对比
/// </summary>
public class SaSeEdiCompareDiff
{
/// <summary>
/// 类型
/// </summary>
[Display(Name = "类型")]
public EnumSaSeEdiCompareCategory Category { get; set; }
/// <summary>
/// Wms发货单号
/// </summary>
[Display(Name = "Wms发货单号")]
public string WmsBillNum { get; set; }
/// <summary>
/// 发货日期
/// </summary>
[Display(Name = "发货日期")]
public DateTime? ShippingDate { get; set; }
/// <summary>
/// 日顺序号
/// </summary>
[Display(Name = "日顺序号")]
public string SeqNumber { get; set; }
/// <summary>
/// PJIS日顺序号
/// </summary>
[Display(Name = "PJIS日顺序号")]
public string PJISSeqNumber { get; set; }
/// <summary>
/// 结算数据中的过账日期
/// </summary>
[Display(Name = "客户下线时间")]
public DateTime? CustomerOfflineTime { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
public decimal? SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
public decimal? SEQty { get; set; }
/// <summary>
/// Eid数量
/// </summary>
[Display(Name = "Eid数量")]
public decimal? EdiQty { get; set; }
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
public decimal? FixPrice { get; set; }
/// <summary>
/// 生产号
/// </summary>
[Display(Name = "生产号")]
public string PN { set; get; }
/// <summary>
/// WMS目标库位
/// </summary>
[Display(Name = "WMS目标库位")]
public string ToLocCode { get; set; }
/// <summary>
/// ERP目标库位
/// </summary>
[Display(Name = "ERP目标库位")]
public string ToErpLocCode { get; set; }
/// <summary>
/// Edi客户物料号
/// </summary>
public string EdiCustomerPartCode { get; set; }
/// <summary>
/// 发运客户物料号
/// </summary>
public string SeCustomerPartCode { get; set; }
/// <summary>
/// 发运厂内物料号
/// </summary>
public string SeFactoryPartCode { get; set; }
/// <summary>
/// 结算客户物料号
/// </summary>
public string SaCustomerPartCode { get; set; }
/// <summary>
/// 结算厂内物料号
/// </summary>
public string SaFactoryPartCode { get; set; }
/// <summary>
/// 客户物料号
/// </summary>
[Display(Name = "客户物料号")]
public string CustomerPartCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 厂内物料号
/// </summary>
[Display(Name = "厂内物料号")]
public string FactoryPartCode { get; set; }
/// <summary>
/// 替换厂内物料号
/// </summary>
[Display(Name = "替换厂内物料号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 是否替换了厂内零件号
/// </summary>
public bool IsReplace { get; set; }
}
/// <summary>
/// 结算、发运、Eid对比明细
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class SaSeEdiCompareDetailExport
{
}
/// <summary>
/// 结算、发运、Eid对比明细
/// </summary>
public interface ISaSeEdiCompareDetailExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
[ValueMapping("有结算有发运(有EDI数据)", 1)]
[ValueMapping("有结算有发运(无EDI数据)", 2)]
[ValueMapping("有结算无发运(有EDI数据)", 3)]
[ValueMapping("有结算无发运(无EDI数据)", 4)]
[ValueMapping("无结算有发运(有EDI数据)", 5)]
[ValueMapping("无结算有发运(无EDI数据)", 6)]
public EnumSaSeEdiCompareCategory Category { get; set; }
/// <summary>
/// 零件描述
/// </summary>
[Display(Name = "零件描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 替换厂内零件号
/// </summary>
[Display(Name = "替换厂内零件号")]
[ExporterHeader(DisplayName = "替换厂内零件号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// Edi数量
/// </summary>
[Display(Name = "Edi数量")]
[ExporterHeader(DisplayName = "Edi数量")]
public decimal EdiQty { get; set; }
}
/// <summary>
/// JisBBAC结算、发运、Eid对比明细
/// </summary>
public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
[ValueMapping("有结算有发运(有EDI数据)", 1)]
[ValueMapping("有结算有发运(无EDI数据)", 2)]
[ValueMapping("有结算无发运(有EDI数据)", 3)]
[ValueMapping("有结算无发运(无EDI数据)", 4)]
[ValueMapping("无结算有发运(有EDI数据)", 5)]
[ValueMapping("无结算有发运(无EDI数据)", 6)]
public EnumSaSeEdiCompareCategory Category { get; set; }
/// <summary>
/// 零件描述
/// </summary>
[Display(Name = "零件描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 替换厂内零件号
/// </summary>
[Display(Name = "替换厂内零件号")]
[ExporterHeader(DisplayName = "替换厂内零件号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// Edi数量
/// </summary>
[Display(Name = "Edi数量")]
[ExporterHeader(DisplayName = "Edi数量")]
public decimal EdiQty { get; set; }
}
/// <summary>
/// JisHBPO结算、发运、Eid对比明细
/// </summary>
public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport
{
/// <summary>
/// 类别
/// </summary>
[Display(Name = "类别")]
[ExporterHeader(DisplayName = "类别")]
[ValueMapping("有结算有发运(有EDI数据)", 1)]
[ValueMapping("有结算有发运(无EDI数据)", 2)]
[ValueMapping("有结算无发运(有EDI数据)", 3)]
[ValueMapping("有结算无发运(无EDI数据)", 4)]
[ValueMapping("无结算有发运(有EDI数据)", 5)]
[ValueMapping("无结算有发运(无EDI数据)", 6)]
public EnumSaSeEdiCompareCategory Category { get; set; }
/// <summary>
/// 零件描述
/// </summary>
[Display(Name = "零件描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 替换厂内零件号
/// </summary>
[Display(Name = "替换厂内零件号")]
[ExporterHeader(DisplayName = "替换厂内零件号")]
public string ReplaceFactoryPartCode { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// Edi数量
/// </summary>
[Display(Name = "Edi数量")]
[ExporterHeader(DisplayName = "Edi数量")]
public decimal EdiQty { get; set; }
}
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>
[ExcelExporter(MaxRowNumberOnASheet = 900000)]
public class SaSeEdiCompareSumExport
{
/// <summary>
/// 厂内物料号
/// </summary>
[Display(Name = "厂内物料号")]
[ExporterHeader(DisplayName = "LU")]
public string FactoryPartCode { get; set; }
/// <summary>
/// 物料描述
/// </summary>
[Display(Name = "物料描述")]
[ExporterHeader(DisplayName = "物料描述")]
public string PartCodeDesc { get; set; }
/// <summary>
/// 结算数量
/// </summary>
[Display(Name = "结算数量")]
[ExporterHeader(DisplayName = "结算数量")]
public decimal SAQty { get; set; }
/// <summary>
/// 发货数量
/// </summary>
[Display(Name = "发货数量")]
[ExporterHeader(DisplayName = "WMS发货数量")]
public decimal SEQty { get; set; }
/// <summary>
/// Edi数量
/// </summary>
[Display(Name = "Edi数量")]
[ExporterHeader(DisplayName = "Edi数量")]
public decimal EdiQty { get; set; }
/// <summary>
/// 结算与EDI量差
/// </summary>
[ExporterHeader(DisplayName = "结算与EDI量差")]
public decimal SaEdiQty => SAQty - EdiQty;
/// <summary>
/// WMS发货与EDI数量差
/// </summary>
[ExporterHeader(DisplayName = "WMS发货与EDI数量差")]
public decimal SeEdiQty => SEQty - EdiQty;
}

183
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaEdiSeCompareExportService.cs

@ -1,183 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
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.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// BBAC结算、Edi、发运对比导出服务
/// </summary>
public class JisBBACSaEdiSeCompareExportService : 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>
/// 构造
/// </summary>
public JisBBACSaEdiSeCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext)
{
_hubContext = hubContext;
_fileContainer = fileContainer;
_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 strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisBBACEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.LU, t.PN })
.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.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
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),
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.LU } equals new { se.PN, se.LU }
//where edi.IsDeleted == false && edi.IsHaveSeData == true && se.IsHaveEdiData == true
select new JisBBACEidSeCompareExport()
{
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,
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);
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
ExcelExporter excelExporter = new ExcelExporter();
excelExporter
.Append(haveEdiNotHaveSeList, $"BBACEDI数据和发货对比")
.SeparateBySheet()
.Append(notHaveEdiHaveSeList, $"BBAC发货和EDI数据对比");
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
}
}

180
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs

@ -0,0 +1,180 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
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.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// BBAC结算、发运、Edi对比导出服务
/// </summary>
public class JisBBACSaSeEdiCompareExportService : SaSeEdiCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// 业务类型
/// </summary>
private readonly EnumBusinessType businessType = EnumBusinessType.JisBBAC;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public JisBBACSaSeEdiCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(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 strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var businessTypeDisplayName = businessType.GetAttributeOfType<DisplayAttribute>()?.Name ?? businessType.ToString();
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
}
if (string.IsNullOrEmpty(pn) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.PN == pn);
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBAC>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
/// <summary>
/// 获取结算与发运比对数据
/// </summary>
public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.PN, sa.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode),
};
//发运
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion
}
}

6
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACEdiSeCompareExportService.cs → code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSeEdiCompareExportService.cs

@ -19,9 +19,9 @@ using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
/// <summary> /// <summary>
/// BBACEdi与发运对比导出服务 /// BBAC发运、Edi对比导出服务
/// </summary> /// </summary>
public class JisBBACEdiSeCompareExportService : ITransientDependency, IExportJob public class JisBBACSeEdiCompareExportService : ITransientDependency, IExportJob
{ {
/// <summary> /// <summary>
/// HubContext /// HubContext
@ -39,7 +39,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public JisBBACEdiSeCompareExportService( public JisBBACSeEdiCompareExportService(
IHubContext<PageHub> hubContext, IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper, IObjectMapper objectMapper,

183
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs

@ -1,183 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
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 Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// HBPO结算、Edi、发运对比导出服务
/// </summary>
public class JisHBPOSaEdiSeCompareExportService : 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>
/// 构造
/// </summary>
public JisHBPOSaEdiSeCompareExportService(
IBlobContainer<MyFileContainer> fileContainer,
SettleAccountDbContext settleAccountDbContext)
{
_fileContainer = fileContainer;
_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 strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
//有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisHBPOEidSeCompareExport()
{
Category = "JIS",
CarModeCode = default,
LineStationcode = default,
SequenceNumber = t.Max(t => t.SeqNumber),
ParType = "01",
EdiQty = t.Sum(t => t.Qty),
AssemblyDate = default,
MatchNumber = default,
MateType = "否",
DiffDesc = "WMS漏发货EDI有订单"
}).ToList();
//无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.LU, t.PN })
.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<BBAC_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber)
};
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
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.LU } equals new { se.PN, se.LU }
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);
notHaveEdiHaveSeList.AddRange(haveEdiHaveSeList);
ExcelExporter excelExporter = new ExcelExporter();
excelExporter
.Append(haveEdiNotHaveSeList, $"HBPOEDI数据和发货对比")
.SeparateBySheet()
.Append(notHaveEdiHaveSeList, $"HBPO发货和EDI数据对比");
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
}
}

179
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs

@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
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.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// HBPO结算、发运、Edi对比导出服务
/// </summary>
public class JisHBPOSaSeEdiCompareExportService : SaSeEdiCompareExportBaseService, ITransientDependency, IExportJob
{
/// <summary>
/// 业务类型
/// </summary>
private readonly EnumBusinessType businessType = EnumBusinessType.JisHBPO;
/// <summary>
/// 文件容器
/// </summary>
private readonly IBlobContainer<MyFileContainer> _fileContainer;
/// <summary>
/// AutoMapper
/// </summary>
private readonly IObjectMapper _objectMapper;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
/// <summary>
/// 构造
/// </summary>
public JisHBPOSaSeEdiCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(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 strSeStartDateTime = property.Where(p => p.Name == "SeStartDateTime").FirstOrDefault().Value;
var strSeEndDateTime = property.Where(p => p.Name == "SeEndDateTime").FirstOrDefault().Value;
var businessTypeDisplayName = businessType.GetAttributeOfType<DisplayAttribute>()?.Name ?? businessType.ToString();
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
}
if (string.IsNullOrEmpty(pn) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.PN == pn);
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBAC>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
_fileContainer.SaveAsync(filename, result.Result, true);
Notify();
return id.ToString();
}
#region 私有方法
/// <summary>
/// 获取结算与发运比对数据
/// </summary>
public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.PN, sa.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode),
};
//发运
var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem
select new
{
groupItem.Key.PN,
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ToLoc = groupItem.Max(t => t.ToLoc),
ErpToLoc = groupItem.Max(t => t.ErpToLoc)
};
var saSeCompareLeft = (from sa in saGroup
join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
into temp
from se in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = sa.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareRight = (from se in seGroup
join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU }
into temp
from sa in temp.DefaultIfEmpty()
select new SaSeEdiCompareDiff()
{
WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate,
PN = se.PN,
SAQty = sa.Qty,
SEQty = se.Qty,
FixPrice = sa.Price,
ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU,
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
});
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
return saSeCompareFullJoin;
}
#endregion
}
}

16
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOEdiSeCompareExportService.cs → code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSeEdiCompareExportService.cs

@ -17,9 +17,9 @@ using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
/// <summary> /// <summary>
/// HBPOEdi与发运对比导出服务 /// HBPO发运、Edi对比导出服务
/// </summary> /// </summary>
public class JisHBPOEdiSeCompareExportService : ITransientDependency, IExportJob public class JisHBPOSeEdiCompareExportService : ITransientDependency, IExportJob
{ {
/// <summary> /// <summary>
/// HubContext /// HubContext
@ -37,10 +37,12 @@ namespace SettleAccount.Job.Services.Report
/// <summary> /// <summary>
/// 构造 /// 构造
/// </summary> /// </summary>
public JisHBPOEdiSeCompareExportService( public JisHBPOSeEdiCompareExportService(
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
SettleAccountDbContext settleAccountDbContext) SettleAccountDbContext settleAccountDbContext)
{ {
_hubContext = hubContext;
_fileContainer = fileContainer; _fileContainer = fileContainer;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
} }
@ -61,7 +63,7 @@ namespace SettleAccount.Job.Services.Report
var filename = exportName.FirstOrDefault(); var filename = exportName.FirstOrDefault();
//有EDI无发运 //有EDI无发运
var haveEdiNotHaveSeList = _settleAccountDbContext.Set<BBAC_SE_EDI>().Where(t => t.IsHaveSeData == false) var haveEdiNotHaveSeList = _settleAccountDbContext.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisHBPOEidSeCompareExport() .Select(t => new JisHBPOEidSeCompareExport()
{ {
@ -77,7 +79,7 @@ namespace SettleAccount.Job.Services.Report
DiffDesc = "WMS漏发货EDI有订单" DiffDesc = "WMS漏发货EDI有订单"
}).ToList(); }).ToList();
//无EDI有发运 //无EDI有发运
var notHaveEdiHaveSeList = _settleAccountDbContext.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false) var notHaveEdiHaveSeList = _settleAccountDbContext.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false)
.GroupBy(t => new { t.LU, t.PN }) .GroupBy(t => new { t.LU, t.PN })
.Select(t => new JisHBPOEidSeCompareExport() .Select(t => new JisHBPOEidSeCompareExport()
{ {
@ -98,7 +100,7 @@ namespace SettleAccount.Job.Services.Report
DiffDesc = "WMS有发货EDI无订单" DiffDesc = "WMS有发货EDI无订单"
}).ToList(); }).ToList();
//有EDI有发运 //有EDI有发运
var ediGroup = from edi in _settleAccountDbContext.Set<BBAC_SE_EDI>() var ediGroup = from edi in _settleAccountDbContext.Set<HBPO_SE_EDI>()
where edi.IsDeleted == false && edi.IsHaveSeData == true where edi.IsDeleted == false && edi.IsHaveSeData == true
group edi by new { edi.PN, edi.LU } into groupItem group edi by new { edi.PN, edi.LU } into groupItem
select new select new
@ -108,7 +110,7 @@ namespace SettleAccount.Job.Services.Report
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
SeqNumber = groupItem.Max(t => t.SeqNumber) SeqNumber = groupItem.Max(t => t.SeqNumber)
}; };
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>() var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime where se.IsHaveEdiData == true && se.AssembleData >= seStartDateTime && se.AssembleData <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem group se by new { se.PN, se.LU } into groupItem
select new select new

1
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs

@ -16,7 +16,6 @@ using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon; using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount; using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Reports; using Win.Sfs.SettleAccount.Reports;
using static NPOI.HSSF.Util.HSSFColor;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {

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

@ -26,7 +26,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary> /// <summary>
/// Pub结算发运对比导出服务 /// Pub结算发运对比导出服务
/// </summary> /// </summary>
public class PubSaSeCompareExportService : ITransientDependency, IExportJob public class PubSaSeCompareExportService : SaSeCompareExportBaseService, ITransientDependency, IExportJob
{ {
/// <summary> /// <summary>
/// HubContext /// HubContext
@ -71,7 +71,7 @@ namespace SettleAccount.Job.Services.Report
INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSeCDetailRepository, INormalEfCoreRepository<PUB_SEC_DETAIL, Guid> pubSeCDetailRepository,
PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository, PubSaSeCompareDapperRepository pubSaSeCompareDapperRepository,
IBlobContainer<MyFileContainer> fileContainer, IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper) IObjectMapper objectMapper) : base(hubContext)
{ {
_hubContext = hubContext; _hubContext = hubContext;
_settleAccountDbContext = settleAccountDbContext; _settleAccountDbContext = settleAccountDbContext;
@ -112,44 +112,7 @@ namespace SettleAccount.Job.Services.Report
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime); //var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
var pubSaSeCompareDiffs = GetSaSeCompareData(businessType, int.Parse(version), DateTime.Parse(seStartDateTime), DateTime.Parse(seEndDateTime)); var pubSaSeCompareDiffs = GetSaSeCompareData(businessType, int.Parse(version), DateTime.Parse(seStartDateTime), DateTime.Parse(seEndDateTime));
pubSaSeCompareDiffs.ForEach(p => HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
{
p.Category = (string.IsNullOrEmpty(p.SaCustomerPartCode), string.IsNullOrEmpty(p.SeCustomerPartCode)) switch
{
(false, false) => EnumPubSaSeCompareCategory.HaveSaHaveSe,
(false, true) => EnumPubSaSeCompareCategory.HaveSaNotHaveSe,
(true, false) => EnumPubSaSeCompareCategory.NotHaveSaHaveSe,
_ => EnumPubSaSeCompareCategory.None,
};
switch (p.Category)
{
case EnumPubSaSeCompareCategory.None:
break;
case EnumPubSaSeCompareCategory.HaveSaHaveSe:
{
p.CustomerPartCode = p.SaCustomerPartCode;
p.FactoryPartCode = p.SaFactoryPartCode;
p.ReplaceFactoryPartCode = p.SaFactoryPartCode;
}
break;
case EnumPubSaSeCompareCategory.HaveSaNotHaveSe:
{
p.CustomerPartCode = p.SaCustomerPartCode;
p.FactoryPartCode = p.SaFactoryPartCode;
p.ReplaceFactoryPartCode = p.SaFactoryPartCode;
}
break;
case EnumPubSaSeCompareCategory.NotHaveSaHaveSe:
{
p.CustomerPartCode = p.SeCustomerPartCode;
p.FactoryPartCode = p.SeFactoryPartCode;
p.ReplaceFactoryPartCode = p.SeFactoryPartCode;
}
break;
default:
break;
}
});
//有结算有发运 //有结算有发运
var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe); var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
@ -342,55 +305,6 @@ namespace SettleAccount.Job.Services.Report
ToLocCode = groupItem.Max(t => t.ToLocCode), ToLocCode = groupItem.Max(t => t.ToLocCode),
ToErpLocCode = groupItem.Max(t => t.ToErpLocCode) ToErpLocCode = groupItem.Max(t => t.ToErpLocCode)
}; };
//印度件LU对比
if (businessType == EnumBusinessType.YinDuJian)
{
saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.LU } into groupItem
select new
{
PN = "",
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode),
};
seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.LU } into groupItem
select new
{
PN = "",
groupItem.Key.LU,
Qty = groupItem.Sum(t => t.Qty),
WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ToLocCode = groupItem.Max(t => t.ToLocCode),
ToErpLocCode = groupItem.Max(t => t.ToErpLocCode)
};
}
//var saSeCompareList = (from sa in saGroup
// join se in seGroup
// on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
// select new PubSaSeCompareDiff()
// {
// WmsBillNum = se.WmsBillNum,
// ShippingDate = se.ShippingDate,
// CustomerOfflineTime = sa.SettleDate,
// SAQty = sa.Qty,
// SEQty = se.Qty,
// FixPrice = sa.Price,
// ToLocCode = se.ToLocCode,
// ToErpLocCode = se.ToErpLocCode,
// SeCustomerPartCode = se.LU,
// SeFactoryPartCode = se.FactoryPartCode,
// SaCustomerPartCode = sa.LU,
// SaFactoryPartCode = sa.PartCode
// });
var saSeCompareLeft = (from sa in saGroup var saSeCompareLeft = (from sa in saGroup
join se in seGroup join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } on new { sa.PN, sa.LU } equals new { se.PN, se.LU }
@ -401,7 +315,7 @@ namespace SettleAccount.Job.Services.Report
WmsBillNum = se.WmsBillNum, WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate, ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate, CustomerOfflineTime = sa.SettleDate,
PN = sa.PN, PN = sa.LU,
SAQty = sa.Qty, SAQty = sa.Qty,
SEQty = se.Qty, SEQty = se.Qty,
FixPrice = sa.Price, FixPrice = sa.Price,
@ -422,7 +336,7 @@ namespace SettleAccount.Job.Services.Report
WmsBillNum = se.WmsBillNum, WmsBillNum = se.WmsBillNum,
ShippingDate = se.ShippingDate, ShippingDate = se.ShippingDate,
CustomerOfflineTime = sa.SettleDate, CustomerOfflineTime = sa.SettleDate,
PN = se.PN, PN = se.LU,
SAQty = sa.Qty, SAQty = sa.Qty,
SEQty = se.Qty, SEQty = se.Qty,
FixPrice = sa.Price, FixPrice = sa.Price,
@ -433,76 +347,39 @@ namespace SettleAccount.Job.Services.Report
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode
}); });
var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList(); //印度件LU对比
return saSeCompareFullJoin; if (businessType == EnumBusinessType.YinDuJian && (1 + 1) == 3)
}
/// <summary>
/// 创建导出文件结构
/// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : PubSaSeCompareDetailExport, IPubSaSeCompareDetailExport, new()
{
//结算核对汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
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.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
FactoryPartCode = p.Key, saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, where sa.BusinessType == businessType && sa.Version == version
SAQty = p.Sum(t => t.SAQty), group sa by new { sa.LU } into groupItem
SEQty = p.Sum(t => t.SEQty) select new
}).ToList();
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
//有结算无发运
var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{ {
FactoryPartCode = p.Key, PN = "",
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, groupItem.Key.LU,
SAQty = p.Sum(t => t.SAQty), Qty = groupItem.Sum(t => t.Qty),
SEQty = p.Sum(t => t.SEQty) Price = groupItem.Max(t => t.Price),
}).ToList(); SettleDate = groupItem.Max(t => t.SettleDate),
//无结算有发运 PartCode = groupItem.Max(t => t.PartCode),
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe); };
//无结算有发运 seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport() where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.LU } into groupItem
select new
{ {
FactoryPartCode = p.Key, PN = "",
PartCodeDesc = p.FirstOrDefault().PartCodeDesc, groupItem.Key.LU,
SAQty = p.Sum(t => t.SAQty), Qty = groupItem.Sum(t => t.Qty),
SEQty = p.Sum(t => t.SEQty) WmsBillNum = groupItem.Max(t => t.WmsBillNum),
}).ToList(); ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
ExcelExporter excelExporter = new ExcelExporter(); ToLocCode = groupItem.Max(t => t.ToLocCode),
return excelExporter ToErpLocCode = groupItem.Max(t => t.ToErpLocCode)
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出") };
.SeparateBySheet()
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
.SeparateBySheet()
.Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
.SeparateBySheet()
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出");
} }
/// <summary>
/// 通知 var saSeCompareFullJoin = saSeCompareLeft.Concat(saSeCompareRight).ToList();
/// </summary> return saSeCompareFullJoin;
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
} }
#endregion #endregion
} }

3
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

@ -8,6 +8,9 @@ using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report namespace SettleAccount.Job.Services.Report
{ {
/// <summary>
/// 结算、发运比对导出基础服务
/// </summary>
public class SaSeCompareExportBaseService public class SaSeCompareExportBaseService
{ {
/// <summary> /// <summary>

141
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

@ -0,0 +1,141 @@
using System.Collections.Generic;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
{
/// <summary>
/// 结算、发运、Eid比对导出基础服务
/// </summary>
public class SaSeEdiCompareExportBaseService
{
/// <summary>
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
public SaSeEdiCompareExportBaseService(IHubContext<PageHub> hubContext)
{
_hubContext = hubContext;
}
public virtual void HandleSaSeEdiCompareDiffList(List<SaSeEdiCompareDiff> ediSeSaCompareDiffs)
{
ediSeSaCompareDiffs.ForEach(p =>
{
p.Category = (string.IsNullOrEmpty(p.SaCustomerPartCode), string.IsNullOrEmpty(p.SeCustomerPartCode), string.IsNullOrEmpty(p.EdiCustomerPartCode)) switch
{
(false, false, false) => EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi,
(false, false, true) => EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi,
(false, true, false) => EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi,
(false, true, true) => EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi,
(true, false, false) => EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi,
(true, false, true) => EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi,
_ => EnumSaSeEdiCompareCategory.None,
};
switch (p.Category)
{
case EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi:
case EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi:
case EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi:
case EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi:
{
p.CustomerPartCode = p.SaCustomerPartCode;
p.FactoryPartCode = p.SaFactoryPartCode;
p.ReplaceFactoryPartCode = p.SaFactoryPartCode;
}
break;
case EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi:
case EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi:
{
p.CustomerPartCode = p.SeCustomerPartCode;
p.FactoryPartCode = p.SeFactoryPartCode;
p.ReplaceFactoryPartCode = p.SeFactoryPartCode;
}
break;
default:
break;
}
});
}
/// <summary>
/// 创建导出文件结构
/// </summary>
public ExcelExporter BindExcelExporter<T>(List<T> pubSaSeCompareDetailExports, string businessTypeDisplayName) where T : SaSeEdiCompareDetailExport, ISaSeEdiCompareDetailExport, new()
{
//汇总
var pubSaSeCompareSumExports = pubSaSeCompareDetailExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty),
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//有结算有发运
var haveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi }.Contains(t.Category));
//有结算有发运汇总
var haveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty),
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi, EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi }.Contains(t.Category));
//有结算无发运
var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty),
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
//无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => new EnumSaSeEdiCompareCategory[] { EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi, EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi }.Contains(t.Category));
//无结算有发运
var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new SaSeEdiCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
SAQty = p.Sum(t => t.SAQty),
SEQty = p.Sum(t => t.SEQty),
EdiQty = p.Sum(t => t.EdiQty)
}).ToList();
ExcelExporter excelExporter = new ExcelExporter();
return excelExporter
.Append(pubSaSeCompareDetailExports, $"{businessTypeDisplayName}结算核对明细输出")
.SeparateBySheet()
.Append(pubSaSeCompareSumExports, $"{businessTypeDisplayName}结算核对汇总输出")
.SeparateBySheet()
.Append(haveSaHaveSeExports, $"{businessTypeDisplayName}有结算有发货明细输出")
.SeparateBySheet()
.Append(haveSaHaveSeSumExports, $"{businessTypeDisplayName}有结算有发货汇总输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeExports, $"{businessTypeDisplayName}有结算无发货明细输出")
.SeparateBySheet()
.Append(haveSaNotHaveSeSumExports, $"{businessTypeDisplayName}有结算无发货汇总输出");
}
/// <summary>
/// 通知
/// </summary>
public virtual void Notify()
{
_hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
}
}

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

@ -39,8 +39,10 @@ namespace Win.Sfs.SettleAccount
ConfigureAutoMapper(); ConfigureAutoMapper();
GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0}); GlobalJobFilters.Filters.Add(new AutomaticRetryAttribute{ Attempts = 0});
context.Services.AddTransient<JisBBACEdiSeCompareExportService>(); context.Services.AddTransient<JisBBACSeEdiCompareExportService>();
context.Services.AddTransient<JisHBPOEdiSeCompareExportService>();; context.Services.AddTransient<JisHBPOSeEdiCompareExportService>();
context.Services.AddTransient<JisBBACSaSeEdiCompareExportService>();
context.Services.AddTransient<JisHBPOSaSeEdiCompareExportService>();
context.Services.AddTransient<MaiDanBBACSaSeCompareExportService>(); context.Services.AddTransient<MaiDanBBACSaSeCompareExportService>();
context.Services.AddTransient<MaiDanHBPOSaSeCompareExportService>(); context.Services.AddTransient<MaiDanHBPOSaSeCompareExportService>();
context.Services.AddTransient<PubSaSeCompareExportService>(); context.Services.AddTransient<PubSaSeCompareExportService>();

Loading…
Cancel
Save