diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs
similarity index 71%
rename from code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs
rename to code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs
index 1cb05b5a..dd93d5f1 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisEdiSeCompareRequestDto.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/EdiSeCompareRequestDto.cs
@@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount.Entities.BQ.Dtos;
///
-/// Jis结算与发运对比请求Dto
+/// Edi与发运对比请求Dto
///
-public class JisEdiSeCompareRequestDto
+public class EdiSeCompareRequestDto
{
///
/// 期间
@@ -35,13 +35,7 @@ public class JisEdiSeCompareRequestDto
[Display(Name = "发运结束时间")]
public DateTime? SeEndDateTime { get; set; }
///
- /// 下线开始时间
+ /// 业务类型
///
- [Display(Name = "下线开始时间")]
- public DateTime? DownLineStartDateTime { get; set; }
- ///
- /// 下线结束时间
- ///
- [Display(Name = "下线结束时间")]
- public DateTime? DownLineEndDateTime { get; set; }
+ public EnumBusinessType BusinessType { get; set; }
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs
similarity index 86%
rename from code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs
rename to code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs
index a569d3f8..0636012c 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/JisSaSeCompareRequestDto.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/SaSeCompareRequestDto.cs
@@ -4,9 +4,9 @@ using System.ComponentModel.DataAnnotations;
namespace Win.Sfs.SettleAccount.Entities.BQ;
///
-/// Jis结算与发运对比请求Dto
+/// 结算与发运对比请求Dto
///
-public class JisSaSeCompareRequestDto
+public class SaSeCompareRequestDto
{
///
/// 期间
@@ -44,4 +44,8 @@ public class JisSaSeCompareRequestDto
///
[Display(Name = "下线结束时间")]
public DateTime? DownLineEndDateTime { get; set; }
+ ///
+ /// 业务类型
+ ///
+ public EnumBusinessType BusinessType { get; set; }
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs
index b6a0bb3e..af0c9647 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_DETAIL_SERVICE.cs
@@ -11,7 +11,6 @@ using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
-using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
@@ -30,16 +29,10 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase
private readonly INormalEfCoreRepository _bbacSaDetailRepository;
- ///
- /// 任务服务
- ///
- private readonly TaskJobService _taskJobService;
-
///
/// 构造
///
public BBAC_SA_DETAIL_SERVICE(INormalEfCoreRepository bbacSaDetailRepository,
- TaskJobService taskJobService,
IDistributedCache cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@@ -47,7 +40,6 @@ public class BBAC_SA_DETAIL_SERVICE : SettleAccountApplicationBase(totalCount, dtos);
}
#endregion
-
- #region 对比
- ///
- /// BBAC结算与发运比对
- ///
- [HttpPost]
- public async Task BBACSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto)
- {
- await Task.CompletedTask;
- throw new NotImplementedException();
- }
- #endregion
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
new file mode 100644
index 00000000..41098567
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
@@ -0,0 +1,111 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.OpenApi.Extensions;
+using SettleAccount.Job.Services.Report;
+using TaskJob.EventArgs;
+using Volo.Abp;
+using Volo.Abp.Application.Services;
+using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
+using Win.Sfs.SettleAccount.Entities.TaskJobs;
+
+namespace Win.Sfs.SettleAccount.Entities.BQ;
+
+///
+/// 对比服务
+///
+[AllowAnonymous]
+[Route("api/settleaccount/[controller]/[action]")]
+public class CompareService : ApplicationService
+{
+ ///
+ /// 任务服务
+ ///
+ private readonly TaskJobService _taskJobService;
+
+ public CompareService(TaskJobService taskJobService)
+ {
+ _taskJobService = taskJobService;
+ }
+
+ #region Edi与发运比对
+ ///
+ /// Edi与发运比对
+ ///
+ [HttpPost]
+ public async Task EdiSeCompare(EdiSeCompareRequestDto ediSeCompareRequestDto)
+ {
+ var businessTypeDisplayName = ediSeCompareRequestDto.BusinessType.ToString();
+ var attributeOfType = ediSeCompareRequestDto.BusinessType.GetAttributeOfType();
+ if (attributeOfType != null)
+ {
+ businessTypeDisplayName = attributeOfType.Name;
+ }
+ var projectName = $"{businessTypeDisplayName}EDI与发运数据对比";
+
+ var customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = ediSeCompareRequestDto.Version });
+ customConditionList.Add(new CustomCondition() { Name = "LU", Value = ediSeCompareRequestDto.LU });
+ customConditionList.Add(new CustomCondition() { Name = "PN", Value = ediSeCompareRequestDto.PN });
+ 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
+ {
+ EnumBusinessType.JisBBAC => typeof(JisBBACEdiSeCompareExportService),
+ EnumBusinessType.JisHBPO => typeof(JisHBPOEdiSeCompareExportService),
+ _ => throw new NotImplementedException()
+ };
+
+ var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, ediSeCompareRequestDto.Version, string.Empty, CurrentUser, jobMoudle, customConditionList, (rs) =>
+ {
+ }).ConfigureAwait(false);
+ return _taskid;
+ }
+ #endregion
+
+ #region 结算与发运比对
+ ///
+ /// 结算与发运比对
+ ///
+ [HttpPost]
+ public async Task SaSeCompare(SaSeCompareRequestDto saSeCompareRequestDto)
+ {
+ var businessTypeDisplayName = saSeCompareRequestDto.BusinessType.ToString();
+ var attributeOfType = saSeCompareRequestDto.BusinessType.GetAttributeOfType();
+ if (attributeOfType != null)
+ {
+ businessTypeDisplayName = attributeOfType.Name;
+ }
+ var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
+
+ var customConditionList = new List();
+ customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version });
+ customConditionList.Add(new CustomCondition() { Name = "LU", Value = saSeCompareRequestDto.LU });
+ customConditionList.Add(new CustomCondition() { Name = "PN", Value = saSeCompareRequestDto.PN });
+ 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
+ {
+ EnumBusinessType.ZhiGongJianBBAC => typeof(PubSaSeCompareExportService),
+ EnumBusinessType.ZhiGongJianHBPO => typeof(PubSaSeCompareExportService),
+ EnumBusinessType.MaiDanJianBBAC => typeof(MaiDanBBACSaSeCompareExportService),
+ EnumBusinessType.MaiDanJianHBPO => typeof(MaiDanHBPOSaSeCompareExportService),
+ EnumBusinessType.BeiJian => typeof(PubSaSeCompareExportService),
+ EnumBusinessType.YinDuJian => typeof(PubSaSeCompareExportService),
+ _ => throw new UserFriendlyException($"{nameof(saSeCompareRequestDto.BusinessType)}参数值无效", "403")
+ };
+
+ var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, saSeCompareRequestDto.Version, string.Empty, CurrentUser, jobMoudle, customConditionList, (rs) =>
+ {
+ }).ConfigureAwait(false);
+ return _taskid;
+ }
+ #endregion
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs
deleted file mode 100644
index 56bd21bb..00000000
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/EdiSeCompareService.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Threading.Tasks;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.OpenApi.Extensions;
-using SettleAccount.Job.Services.Report;
-using TaskJob.EventArgs;
-using Volo.Abp.Application.Services;
-using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
-using Win.Sfs.SettleAccount.Entities.TaskJobs;
-
-namespace Win.Sfs.SettleAccount.Entities.BQ;
-
-///
-/// Edi与发运对比服务
-///
-[AllowAnonymous]
-[Route("api/settleaccount/[controller]/[action]")]
-public class EdiSeCompareService : ApplicationService
-{
- ///
- /// 任务服务
- ///
- private readonly TaskJobService _taskJobService;
-
- public EdiSeCompareService(TaskJobService taskJobService)
- {
- _taskJobService = taskJobService;
- }
-
- #region 对比
- ///
- /// BBACEdi与发运比对
- ///
- [HttpPost]
- public async Task BBACEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
- {
- var projectName = $"JisBBACEDI与发运数据对比";
-
- List customConditionList = new List();
- customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version });
- customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU });
- customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN });
- customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
- customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
- customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
-
- var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisBBACEdiSeCompareExportService), customConditionList, (rs) =>
- {
- }).ConfigureAwait(false);
- return _taskid;
- }
-
- ///
- /// HBPOEdi与发运比对
- ///
- [HttpPost]
- public async Task HBPOEdiSeCompare(JisEdiSeCompareRequestDto jisEdiSeCompareRequestDto)
- {
- var projectName = $"JisHBPOEDI与发运数据对比结算与发运数据对比";
-
- List customConditionList = new List();
- customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisEdiSeCompareRequestDto.Version });
- customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisEdiSeCompareRequestDto.LU });
- customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisEdiSeCompareRequestDto.PN });
- customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
- customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisEdiSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
- customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisEdiSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
-
- var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisEdiSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisHBPOEdiSeCompareExportService), customConditionList, (rs) =>
- {
- }).ConfigureAwait(false);
- return _taskid;
- }
- #endregion
-
-}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs
index db0f01f7..4ae7f4d4 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_DETAIL_SERVICE.cs
@@ -1,20 +1,16 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
-using SettleAccount.Job.Services.Report;
using Shouldly;
-using TaskJob.EventArgs;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
using Win.Abp.Snowflakes;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount.CommonManagers;
using Win.Sfs.SettleAccount.Entities.BQ.Dtos;
-using Win.Sfs.SettleAccount.Entities.TaskJobs;
using Win.Sfs.SettleAccount.ExcelImporter;
using Win.Sfs.Shared.Filter;
using Win.Sfs.Shared.RepositoryBase;
@@ -33,16 +29,10 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase
private readonly INormalEfCoreRepository _hbpoSaDetailRepository;
- ///
- /// 任务服务
- ///
- private readonly TaskJobService _taskJobService;
-
///
/// 构造
///
public HBPO_SA_DETAIL_SERVICE(INormalEfCoreRepository hbpoSaDetailRepository,
- TaskJobService taskJobService,
IDistributedCache cache,
IExcelImportAppService excelImportService,
ISnowflakeIdGenerator snowflakeIdGenerator,
@@ -50,7 +40,6 @@ public class HBPO_SA_DETAIL_SERVICE : SettleAccountApplicationBase(totalCount, dtos);
}
#endregion
-
- #region 对比
- ///
- /// HBPO结算与发运比对
- ///
- [HttpPost]
- public async Task HBPOSaSeCompare(JisSaSeCompareRequestDto jisSaSeCompareRequestDto)
- {
- var projectName = $"JisHBPO结算与发运数据对比";
-
- List customConditionList = new List();
- customConditionList.Add(new CustomCondition() { Name = "Version", Value = jisSaSeCompareRequestDto.Version });
- customConditionList.Add(new CustomCondition() { Name = "LU", Value = jisSaSeCompareRequestDto.LU });
- customConditionList.Add(new CustomCondition() { Name = "PN", Value = jisSaSeCompareRequestDto.PN });
- customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
- customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = jisSaSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
- customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = jisSaSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
-
- var _taskid = "";
- //var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, jisSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(JisHBPOSaSeCompareExportService), customConditionList, (rs) =>
- //{
- //}).ConfigureAwait(false);
- return _taskid;
- }
- #endregion
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
index ede465f8..59ba3ea9 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
@@ -74,11 +74,6 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
///
private readonly INormalEfCoreRepository _tbRePartsRelationshipRepository;
- ///
- /// 业务类型
- ///
- private readonly EnumBusinessType _businessType = EnumBusinessType.JisHBPO;
-
///
/// 构造
///
@@ -106,6 +101,10 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
_tbRePartsRelationshipRepository = tbRePartsRelationshipRepository;
}
+ ///
+ /// 业务类型
+ ///
+ public EnumBusinessType BusinessType { get; set; }
///
/// 期间
///
@@ -123,9 +122,11 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
switch (hbpoSaImportRequestDto.BusinessType)
{
case EnumBusinessType.JisHBPO:
+ BusinessType = EnumBusinessType.JisHBPO;
result = await ImportJisHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false);
break;
case EnumBusinessType.MaiDanJianHBPO:
+ BusinessType = EnumBusinessType.MaiDanJianHBPO;
result = await ImportMaiDanJianHBPOAsync(hbpoSaImportRequestDto.Files).ConfigureAwait(false);
break;
default:
@@ -142,8 +143,9 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
[HttpPost]
public async Task> GetListAsync(RequestDto input)
{
- var entities = await _hbpoSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
- var totalCount = await _hbpoSaRepository.GetCountByFilterAsync(input.Filters);
+ input.Filters.RemoveAll(t => t.Column.ToLower() == "site");
+ var entities = await _hbpoSaRepository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
+ var totalCount = await _hbpoSaRepository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map, List>(entities);
return new PagedResultDto(totalCount, dtos);
}
@@ -288,7 +290,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
{
BillNum = hbpoSaBillNum,
State = "0",
- BusinessType = _businessType,
+ BusinessType = BusinessType,
Site = site,
Version = Version
};
@@ -301,7 +303,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
InvGroupNum = hbpoCanSaBillNum,
SettleBillNum = hbpoSaBillNum,
State = SettleBillState.未结状态,
- BusinessType = _businessType,
+ BusinessType = BusinessType,
Site = site,
Version = Version
};
@@ -327,7 +329,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase
hbpoSaDetail.BillNum = hbpoSaBillNum;
hbpoSaDetail.KeyCode = hbpoSaDetail.PN + hbpoSaDetail.LU;
- hbpoSaDetail.BusinessType = _businessType;
+ hbpoSaDetail.BusinessType = BusinessType;
});
//导入的零件号集合
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
index e73fa369..665a8644 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_DETAIL_SERVICE.cs
@@ -7,9 +7,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
-using SettleAccount.Job.Services.Report;
using Shouldly;
-using TaskJob.EventArgs;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Caching;
@@ -113,36 +111,4 @@ public class PUB_SA_DETAIL_SERVICE : SettleAccountApplicationBase
return new PagedResultDto(totalCount, dtos);
}
#endregion
-
- #region 对比
- ///
- /// Pub结算与发运比对
- ///
- [HttpPost]
- public async Task PubSaSeCompare(PubSaSeCompareRequestDto pubSaSeCompareRequestDto)
- {
- var businessTypeDisplayName = pubSaSeCompareRequestDto.BusinessType.ToString();
- DisplayAttribute attributeOfType = pubSaSeCompareRequestDto.BusinessType.GetAttributeOfType();
- if (attributeOfType != null)
- {
- businessTypeDisplayName = attributeOfType.Name;
- }
- var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
-
- List customConditionList = new List();
- customConditionList.Add(new CustomCondition() { Name = "Version", Value = pubSaSeCompareRequestDto.Version });
- customConditionList.Add(new CustomCondition() { Name = "BusinessType", Value = ((int)pubSaSeCompareRequestDto.BusinessType).ToString() });
- customConditionList.Add(new CustomCondition() { Name = "LU", Value = pubSaSeCompareRequestDto.LU });
- customConditionList.Add(new CustomCondition() { Name = "PN", Value = pubSaSeCompareRequestDto.PN });
- customConditionList.Add(new CustomCondition() { Name = "ProjectName", Value = projectName });
- customConditionList.Add(new CustomCondition() { Name = "SeStartDateTime", Value = pubSaSeCompareRequestDto.SeStartDateTime?.ToString("yyyy-MM-dd 00:00:00") });
- customConditionList.Add(new CustomCondition() { Name = "SeEndDateTime", Value = pubSaSeCompareRequestDto.SeEndDateTime?.ToString("yyyy-MM-dd 23:59:59") });
-
- var _taskid = await _taskJobService.ExportEnqueueAsync(projectName, ExportExtentsion.Excel, pubSaSeCompareRequestDto.Version, string.Empty, CurrentUser, typeof(PubSaSeCompareExportService), customConditionList, (rs) =>
- {
- Console.WriteLine("TaskJob 回调了");
- });
- return _taskid;
- }
- #endregion
}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
index 5097acda..33eea91f 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
@@ -153,8 +153,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase
[HttpPost]
public async Task> GetListAsync(PUB_SARequestDto input)
{
- var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true);
- var totalCount = await _repository.GetCountByFilterAsync(input.Filters);
+ input.Filters.RemoveAll(t => t.Column.ToLower() == "site");
+ var entities = await _repository.GetListByFilterAsync(input.Filters, input.Sorting, input.MaxResultCount, input.SkipCount, true).ConfigureAwait(false);
+ var totalCount = await _repository.GetCountByFilterAsync(input.Filters).ConfigureAwait(false);
var dtos = ObjectMapper.Map, List>(entities);
return new PagedResultDto(totalCount, dtos);
}
@@ -419,7 +420,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType;
- importPubSaDetail.Site = "XX工厂";
+ importPubSaDetail.Site = "工厂";
});
var lus = pubSaDetails.Select(t => t.LU).Distinct().ToList();
if (businessType == EnumBusinessType.BeiJian)
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
index d2d7e08b..4ef82f85 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
@@ -20,7 +20,7 @@ public class PubSaSeCompareDiff
/// 发货日期
///
[Display(Name = "发货日期")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 日顺序号
///
@@ -35,22 +35,22 @@ public class PubSaSeCompareDiff
/// 结算数据中的过账日期
///
[Display(Name = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
///
[Display(Name = "结算数量")]
- public decimal SAQty { get; set; }
+ public decimal? SAQty { get; set; }
///
/// 发货数量
///
[Display(Name = "发货数量")]
- public decimal SEQty { get; set; }
+ public decimal? SEQty { get; set; }
///
/// 定价
///
[Display(Name = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// 生产号
///
@@ -368,7 +368,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
///
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 生产码
@@ -405,7 +405,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
///
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
@@ -438,7 +438,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
///
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// WMS目标库位
///
@@ -482,7 +482,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
///
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 生产码
@@ -519,7 +519,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
///
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
///
@@ -550,7 +550,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
///
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// WMS目标库位
///
@@ -596,7 +596,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
///
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 生产码
@@ -633,7 +633,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
///
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
@@ -666,7 +666,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
///
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// WMS目标库位
///
@@ -712,7 +712,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
///
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 生产码
@@ -749,7 +749,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
///
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
@@ -781,7 +781,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
///
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// WMS目标库位
///
@@ -827,7 +827,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
///
[Display(Name = "发货日期")]
[ExporterHeader(DisplayName = "发货日期", Format = "yyyy-MM-dd")]
- public DateTime ShippingDate { get; set; }
+ public DateTime? ShippingDate { get; set; }
///
/// 生产码
@@ -864,7 +864,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
///
[Display(Name = "客户下线时间")]
[ExporterHeader(DisplayName = "客户下线时间")]
- public DateTime CustomerOfflineTime { get; set; }
+ public DateTime? CustomerOfflineTime { get; set; }
///
/// 结算数量
///
@@ -895,7 +895,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
///
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
- public decimal FixPrice { get; set; }
+ public decimal? FixPrice { get; set; }
///
/// WMS目标库位
///
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
index 245c375a..c9bcaf50 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Repository/SettleAccountJob/Report/PubSaSeCompareDapperRepository.cs
@@ -42,7 +42,6 @@ public class PubSaSeCompareDapperRepository : DapperRepository
+ /// BBAC结算、Edi、发运对比导出服务
+ ///
+ public class JisBBACSaEdiSeCompareExportService : ITransientDependency, IExportJob
+ {
+ ///
+ /// HubContext
+ ///
+ private readonly IHubContext _hubContext;
+ ///
+ /// 文件容器
+ ///
+ private readonly IBlobContainer _fileContainer;
+ ///
+ /// DbContext
+ ///
+ private readonly SettleAccountDbContext _settleAccountDbContext;
+
+ ///
+ /// 构造
+ ///
+ public JisBBACSaEdiSeCompareExportService(
+ IHubContext hubContext,
+ IBlobContainer fileContainer,
+ IObjectMapper objectMapper,
+ SettleAccountDbContext settleAccountDbContext)
+ {
+ _hubContext = hubContext;
+ _fileContainer = fileContainer;
+ _settleAccountDbContext = settleAccountDbContext;
+ }
+
+ ///
+ /// 导出
+ ///
+ public string ExportFile(Guid id, List exportName, List 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().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().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()
+ 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()
+ 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
+ }
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs
new file mode 100644
index 00000000..7c04c042
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaEdiSeCompareExportService.cs
@@ -0,0 +1,183 @@
+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
+{
+ ///
+ /// HBPO结算、Edi、发运对比导出服务
+ ///
+ public class JisHBPOSaEdiSeCompareExportService : ITransientDependency, IExportJob
+ {
+ ///
+ /// HubContext
+ ///
+ private readonly IHubContext _hubContext;
+ ///
+ /// 文件容器
+ ///
+ private readonly IBlobContainer _fileContainer;
+ ///
+ /// DbContext
+ ///
+ private readonly SettleAccountDbContext _settleAccountDbContext;
+
+ ///
+ /// 构造
+ ///
+ public JisHBPOSaEdiSeCompareExportService(
+ IBlobContainer fileContainer,
+ SettleAccountDbContext settleAccountDbContext)
+ {
+ _fileContainer = fileContainer;
+ _settleAccountDbContext = settleAccountDbContext;
+ }
+
+ ///
+ /// 导出
+ ///
+ public string ExportFile(Guid id, List exportName, List 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().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().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()
+ 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()
+ 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
+ }
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
new file mode 100644
index 00000000..12864760
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
@@ -0,0 +1,183 @@
+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
+{
+ ///
+ /// 买单件BBAC结算、发运对比导出服务
+ ///
+ public class MaiDanBBACSaSeCompareExportService : ITransientDependency, IExportJob
+ {
+ ///
+ /// HubContext
+ ///
+ private readonly IHubContext _hubContext;
+ ///
+ /// 文件容器
+ ///
+ private readonly IBlobContainer _fileContainer;
+ ///
+ /// DbContext
+ ///
+ private readonly SettleAccountDbContext _settleAccountDbContext;
+
+ ///
+ /// 构造
+ ///
+ public MaiDanBBACSaSeCompareExportService(
+ IHubContext hubContext,
+ IBlobContainer fileContainer,
+ IObjectMapper objectMapper,
+ SettleAccountDbContext settleAccountDbContext)
+ {
+ _hubContext = hubContext;
+ _fileContainer = fileContainer;
+ _settleAccountDbContext = settleAccountDbContext;
+ }
+
+ ///
+ /// 导出
+ ///
+ public string ExportFile(Guid id, List exportName, List 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().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().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()
+ 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()
+ 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
+ }
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
new file mode 100644
index 00000000..c193de5e
--- /dev/null
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
@@ -0,0 +1,183 @@
+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
+{
+ ///
+ /// 买单件HBPO结算、发运对比导出服务
+ ///
+ public class MaiDanHBPOSaSeCompareExportService : ITransientDependency, IExportJob
+ {
+ ///
+ /// HubContext
+ ///
+ private readonly IHubContext _hubContext;
+ ///
+ /// 文件容器
+ ///
+ private readonly IBlobContainer _fileContainer;
+ ///
+ /// DbContext
+ ///
+ private readonly SettleAccountDbContext _settleAccountDbContext;
+
+ ///
+ /// 构造
+ ///
+ public MaiDanHBPOSaSeCompareExportService(
+ IHubContext hubContext,
+ IBlobContainer fileContainer,
+ IObjectMapper objectMapper,
+ SettleAccountDbContext settleAccountDbContext)
+ {
+ _hubContext = hubContext;
+ _fileContainer = fileContainer;
+ _settleAccountDbContext = settleAccountDbContext;
+ }
+
+ ///
+ /// 导出
+ ///
+ public string ExportFile(Guid id, List exportName, List 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().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().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()
+ 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()
+ 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
+ }
+}
diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
index bbc9ac09..eab8b716 100644
--- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
+++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
@@ -381,9 +381,29 @@ namespace SettleAccount.Job.Services.Report
};
}
- var saSeCompareList = (from sa in saGroup
+ //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
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 PubSaSeCompareDiff()
{
WmsBillNum = se.WmsBillNum,
@@ -398,9 +418,29 @@ namespace SettleAccount.Job.Services.Report
SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU,
SaFactoryPartCode = sa.PartCode
- }).ToList();
-
- return saSeCompareList;
+ });
+ 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 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 saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
+ return saSeCompareFullJoin;
}
///
/// 创建导出文件结构
@@ -429,7 +469,7 @@ namespace SettleAccount.Job.Services.Report
//有结算无发运
var haveSaNotHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
//有结算无发运
- var haveSaNotHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
+ var haveSaNotHaveSeSumExports = haveSaNotHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,
@@ -439,7 +479,7 @@ namespace SettleAccount.Job.Services.Report
//无结算有发运
var notHaveSaHaveSeExports = pubSaSeCompareDetailExports.FindAll(t => t.Category == EnumPubSaSeCompareCategory.NotHaveSaHaveSe);
//无结算有发运
- var notHaveSaHaveSeSumExports = haveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
+ var notHaveSaHaveSeSumExports = notHaveSaHaveSeExports.GroupBy(p => p.ReplaceFactoryPartCode).Select(p => new PubSaSeCompareSumExport()
{
FactoryPartCode = p.Key,
PartCodeDesc = p.FirstOrDefault().PartCodeDesc,