Browse Source

对比根据权限导入文件列不同

master
mahao 1 year ago
parent
commit
160e428138
  1. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/CompareService.cs
  2. 19
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  3. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs
  4. 90
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  5. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/SaSeEdiCompareDiff.cs
  6. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  7. 44
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  8. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  9. 15
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  10. 33
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  11. 64
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs
  12. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Job/SettleAccountJobAutoMapperProfile.cs

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

@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -75,13 +76,15 @@ public class CompareService : ApplicationService
[HttpPost]
public async Task<string> SaSeCompare(SaSeCompareRequestDto saSeCompareRequestDto)
{
var isWuLiuRole = CurrentUser.IsInRole("物流") == true ? "物流" : "";
var businessTypeDisplayName = saSeCompareRequestDto.BusinessType.ToString();
var attributeOfType = saSeCompareRequestDto.BusinessType.GetAttributeOfType<DisplayAttribute>();
if (attributeOfType != null)
{
businessTypeDisplayName = attributeOfType.Name;
}
var projectName = $"{businessTypeDisplayName}结算与发运数据对比";
var projectName = $"{isWuLiuRole}{businessTypeDisplayName}结算与发运数据对比";
var customConditionList = new List<CustomCondition>();
customConditionList.Add(new CustomCondition() { Name = "Version", Value = saSeCompareRequestDto.Version });

19
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs

@ -30,21 +30,22 @@ public class HandSeSyncAppService : ApplicationService
/// </summary>
[HttpPost]
[UnitOfWork(IsDisabled = true)]
public virtual async Task SyncAsync([FromBody] EnumBusinessType businessType)
public virtual async Task<IActionResult> SyncAsync([FromBody] EnumBusinessType businessType)
{
using var scope = this._applicationServices.CreateScope();
IInvocable seSyncAppService = businessType switch
{
//EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(),
//EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(),
//EnumBusinessType.MaiDanJianBBAC => scope.ServiceProvider.GetRequiredService<MaiDanBBACSeSyncAppService>(),
//EnumBusinessType.MaiDanJianHBPO => scope.ServiceProvider.GetRequiredService<MaiDanHBPOSeSyncAppService>(),
//EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(),
//EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongHBPOSeSyncAppService>(),
//EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(),
//EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(),
EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(),
EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(),
EnumBusinessType.MaiDanJianBBAC => scope.ServiceProvider.GetRequiredService<MaiDanBBACSeSyncAppService>(),
EnumBusinessType.MaiDanJianHBPO => scope.ServiceProvider.GetRequiredService<MaiDanHBPOSeSyncAppService>(),
EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(),
EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongHBPOSeSyncAppService>(),
EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(),
EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(),
_ => throw new UserFriendlyException($"{nameof(businessType)}参数值无效", "403")
};
await seSyncAppService.Invoke().ConfigureAwait(false);
return new JsonResult(new { code = 200, message = "同步成功" });
}
}

8
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/TaskJobs/JobAppService.cs

@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.MaterialRelationships;
namespace Win.Sfs.SettleAccount.Entities.TaskJobs;
@ -41,7 +43,11 @@ public class JobAppService: ApplicationService
[UnitOfWork(false)]
public virtual async Task<PagedResultDto<JobDto>> GetListAsync(JobRequestDto input)
{
var lists = await _service.GetListAsync(input);
if (CurrentUser.IsInRole("物流") && input.Name.Contains("对比"))
{
input.Name = "物流" + input.Name;
}
var lists = await _service.GetListAsync(input).ConfigureAwait(false);
return new PagedResultDto<JobDto>(lists.Count, lists);
}

90
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs

@ -303,7 +303,7 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -318,6 +318,19 @@ public class PubSaSeCompareDetailExportZhiGongJianBBAC : PubSaSeCompareDetailExp
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 直供件BBAC结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportZhiGongJianBBACWuLiu : PubSaSeCompareDetailExportZhiGongJianBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 直供件HBPO结算与发运对比明细
/// </summary>
@ -411,7 +424,7 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -426,6 +439,19 @@ public class PubSaSeCompareDetailExportZhiGongJianHBPO : PubSaSeCompareDetailExp
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 直供件HBPO结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu : PubSaSeCompareDetailExportZhiGongJianHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 买单件BBAC结算与发运对比明细
/// </summary>
@ -521,7 +547,7 @@ public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -536,6 +562,19 @@ public class PubSaSeCompareDetailExportMaiDanJianBBAC : PubSaSeCompareDetailExpo
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 买单件BBAC结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportMaiDanJianBBACWuLiu : PubSaSeCompareDetailExportMaiDanJianBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 买单件HBPO结算与发运对比明细
/// </summary>
@ -631,7 +670,7 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -646,6 +685,19 @@ public class PubSaSeCompareDetailExportMaiDanJianHBPO : PubSaSeCompareDetailExpo
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 买单件HBPO结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu : PubSaSeCompareDetailExportMaiDanJianHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 备件结算与发运对比明细
/// </summary>
@ -740,7 +792,7 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -755,6 +807,19 @@ public class PubSaSeCompareDetailExportBeiJian : PubSaSeCompareDetailExport, IPu
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 备件结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportBeiJianWuLiu : PubSaSeCompareDetailExportBeiJian
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// 印度件结算与发运对比明细
/// </summary>
@ -848,7 +913,7 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// WMS目标库位
/// </summary>
@ -862,3 +927,16 @@ public class PubSaSeCompareDetailExportYinDuJian : PubSaSeCompareDetailExport, I
[ExporterHeader(DisplayName = "ERP目标库位")]
public string ToErpLocCode { get; set; }
}
/// <summary>
/// 印度件结算与发运对比明细物流
/// </summary>
public class PubSaSeCompareDetailExportYinDuJianWuLiu : PubSaSeCompareDetailExportYinDuJian
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}

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

@ -321,7 +321,7 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// ERP销售库位
/// </summary>
@ -336,6 +336,19 @@ public class SaSeEdiCompareDetailExportJisBBAC : SaSeEdiCompareDetailExport, ISa
public string ToLocCode { get; set; }
}
/// <summary>
/// JisBBAC结算、发运、Eid对比明细物流
/// </summary>
public class SaSeEdiCompareDetailExportJisBBACWuLiu : SaSeEdiCompareDetailExportJisBBAC
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// JisHBPO结算、发运、Eid对比明细
/// </summary>
@ -468,7 +481,7 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(DisplayName = "定价")]
public decimal? FixPrice { get; set; }
public virtual decimal? FixPrice { get; set; }
/// <summary>
/// ERP销售库位
/// </summary>
@ -483,6 +496,19 @@ public class SaSeEdiCompareDetailExportJisHBPO : SaSeEdiCompareDetailExport, ISa
public string ToLocCode { get; set; }
}
/// <summary>
/// JisHBPO结算、发运、Eid对比明细物流
/// </summary>
public class SaSeEdiCompareDetailExportJisHBPOWuLiu : SaSeEdiCompareDetailExportJisHBPO
{
/// <summary>
/// 定价
/// </summary>
[Display(Name = "定价")]
[ExporterHeader(IsIgnore = true)]
public override decimal? FixPrice { get; set; }
}
/// <summary>
/// PUB结算与发运对比汇总
/// </summary>

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -70,7 +71,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
@ -89,8 +90,17 @@ namespace SettleAccount.Job.Services.Report
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBACWuLiu>>(ediSeSaCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisBBAC>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisBBAC>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

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

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -14,6 +15,7 @@ using Volo.Abp.DependencyInjection;
using Volo.Abp.ObjectMapping;
using Win.Sfs.BaseData.ImportExcelCommon;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ;
using Win.Sfs.SettleAccount.Reports;
namespace SettleAccount.Job.Services.Report
@ -69,27 +71,51 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var saSeEdiCompareDiffs = GetSaSeEdiCompareData(version, seStartDateTime, seEndDateTime);
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(saSeEdiCompareDiffs);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
#region 二次对比
//二次匹配上的记录
var secondMatchHaveSaHaveSes = HandleSecondCompare(saSeEdiCompareDiffs, businessType);
if (secondMatchHaveSaHaveSes.Any())
{
//二次匹配 匹配上的厂内零件号、PN
var secondMatchFPartCodePNs = secondMatchHaveSaHaveSes.Select(t => new { t.ReplaceFactoryPartCode, t.PN });
saSeEdiCompareDiffs.RemoveAll<SaSeEdiCompareDiff>(t => secondMatchFPartCodePNs.Contains(new { t.ReplaceFactoryPartCode, t.PN }));
saSeEdiCompareDiffs.AddRange(secondMatchHaveSaHaveSes);
//二次对比比对上的数据入库
var seCDetailEntitys = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<HBPO_SEC_DETAIL>>(secondMatchHaveSaHaveSes);
_settleAccountDbContext.Set<HBPO_SEC_DETAIL>().AddRange(seCDetailEntitys);
}
#endregion
#region 结算数据处理
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(ediSeSaCompareDiffs, businessType, version);
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(p => p.CustomerPartCode == lu);
}
if (string.IsNullOrEmpty(pn) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.PN == pn);
saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(p => p.PN == pn);
}
ediSeSaCompareDiffs = ediSeSaCompareDiffs.OrderBy(t => t.Category).ToList();
saSeEdiCompareDiffs = saSeEdiCompareDiffs.OrderBy(t => t.Category).ToList();
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPO>>(ediSeSaCompareDiffs);
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName);
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPOWuLiu>>(saSeEdiCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<SaSeEdiCompareDiff>, List<SaSeEdiCompareDetailExportJisHBPO>>(saSeEdiCompareDiffs);
excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();
@ -103,7 +129,7 @@ namespace SettleAccount.Job.Services.Report
/// <summary>
/// 获取比对数据
/// </summary>
public List<SaSeEdiCompareDiff> GetEdiSeSaCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
public List<SaSeEdiCompareDiff> GetSaSeEdiCompareData(int version, DateTime seStartDateTime, DateTime seEndDateTime)
{
//结算
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()

15
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -71,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -104,9 +105,17 @@ namespace SettleAccount.Job.Services.Report
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
}
pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianBBAC>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBAC>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianBBAC>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

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

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Dynamic.Core;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.OpenApi.Extensions;
using SettleAccount.Domain.BQ;
@ -71,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seStartDateTime = DateTime.Parse(strSeStartDateTime);
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -104,9 +105,17 @@ namespace SettleAccount.Job.Services.Report
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.PN == pn);
}
pubSaSeCompareDiffs = pubSaSeCompareDiffs.OrderBy(t => t.Category).ToList();
var excelExporter = new ExcelExporter();
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportMaiDanJianHBPO>>(pubSaSeCompareDiffs);
var excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportMaiDanJianHBPO>(items, businessTypeDisplayName);
}
var result = excelExporter.ExportAppendDataAsByteArray();
result.ShouldNotBeNull();

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

@ -101,6 +101,7 @@ namespace SettleAccount.Job.Services.Report
businessTypeDisplayName = attributeOfType.Name;
}
var filename = exportName.FirstOrDefault();
var isWuLiu = filename.StartsWith("物流");
//var pubSaSeCompareDiffs = _pubSaSeCompareDapperRepository.GetDetailDiffReportList(strBusinessType, version, seStartDateTime, seEndDateTime);
var pubSaSeCompareDiffs = GetSaSeCompareData(businessType, version, DateTime.Parse(seStartDateTime), DateTime.Parse(seEndDateTime));
@ -140,28 +141,60 @@ namespace SettleAccount.Job.Services.Report
switch (businessType)
{
case EnumBusinessType.ZhiGongJianBBAC:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianBBAC>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianBBAC>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.ZhiGongJianHBPO:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportZhiGongJianHBPO>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportZhiGongJianHBPO>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.BeiJian:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportBeiJianWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportBeiJianWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportBeiJian>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportBeiJian>(items, businessTypeDisplayName);
}
}
break;
case EnumBusinessType.YinDuJian:
{
if (isWuLiu)
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportYinDuJianWuLiu>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportYinDuJianWuLiu>(items, businessTypeDisplayName);
}
else
{
var items = _objectMapper.Map<List<PubSaSeCompareDiff>, List<PubSaSeCompareDetailExportYinDuJian>>(pubSaSeCompareDiffs);
excelExporter = BindExcelExporter<PubSaSeCompareDetailExportYinDuJian>(items, businessTypeDisplayName);
}
}
break;
default:
break;

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

@ -5,9 +5,11 @@ using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Entities.SettleAccountDomain;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -71,6 +73,66 @@ namespace SettleAccount.Job.Services.Report
});
}
/// <summary>
/// 二次比对
/// </summary>
public virtual List<SaSeEdiCompareDiff> HandleSecondCompare(List<SaSeEdiCompareDiff> saSeEdiCompareDiffs, EnumBusinessType businessType)
{
//二次匹配上的记录
var secondMatchHaveSaHaveSes = new List<SaSeEdiCompareDiff>();
//有结算无发运 和 无结算有发运
var haveSaNotHaveSeUnionNotHaveSaHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi);
//有结算无发运
var haveSaNotHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaNotHaveSeNotHaveEdi);
//无结算有发运
var notHaveSaHaveSes = saSeEdiCompareDiffs.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.NotHaveSaHaveSeNotHaveEdi);
//二次对比(替换发运数据的厂内零件号)
var repFactoryPartCodes = haveSaNotHaveSeUnionNotHaveSaHaveSes.Select(t => t.FactoryPartCode).Distinct().ToList();
var tbRePartsRelationships = _settleAccountDbContext.Set<TB_RePartsRelationship>().Where(t => repFactoryPartCodes.Contains(t.LU)).ToList();
tbRePartsRelationships.ForEach(tbRePartsRelationship =>
{
haveSaNotHaveSeUnionNotHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t =>
{
t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU;
});
});
//获取二次比对上的数据
secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes
join haveSaNotHaveSe in haveSaNotHaveSes
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
select new SaSeEdiCompareDiff()
{
Category = EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi,
WmsBillNum = notHaveSaHaveSe.WmsBillNum,
ShippingDate = notHaveSaHaveSe.ShippingDate,
SeqNumber = notHaveSaHaveSe.SeqNumber,
PJISSeqNumber = notHaveSaHaveSe.PJISSeqNumber,
CustomerOfflineTime = haveSaNotHaveSe.CustomerOfflineTime,
AssemblyCode = notHaveSaHaveSe.AssemblyCode,
InjectionCode = notHaveSaHaveSe.InjectionCode,
SAQty = haveSaNotHaveSe.SAQty,
SEQty = notHaveSaHaveSe.SEQty,
EdiQty = notHaveSaHaveSe.EdiQty,
FixPrice = haveSaNotHaveSe.FixPrice,
PN = haveSaNotHaveSe.PN,
ToLocCode = notHaveSaHaveSe.ToLocCode,
ToErpLocCode = notHaveSaHaveSe.ToErpLocCode,
EdiCustomerPartCode = notHaveSaHaveSe.EdiCustomerPartCode,
SeCustomerPartCode = notHaveSaHaveSe.SeCustomerPartCode,
SeFactoryPartCode = notHaveSaHaveSe.SeFactoryPartCode,
SaCustomerPartCode = haveSaNotHaveSe.SaCustomerPartCode,
SaFactoryPartCode = haveSaNotHaveSe.SaFactoryPartCode,
CustomerPartCode = haveSaNotHaveSe.CustomerPartCode,
PartCodeDesc = haveSaNotHaveSe.PartCodeDesc,
FactoryPartCode = haveSaNotHaveSe.FactoryPartCode,
ReplaceFactoryPartCode = haveSaNotHaveSe.ReplaceFactoryPartCode
}).ToList();
return secondMatchHaveSaHaveSes;
}
/// <summary>
/// 结算数据处理
/// 写入库位、替换零件号
@ -192,7 +254,7 @@ namespace SettleAccount.Job.Services.Report
excelExporter.Append(saSeEdiCompareSumExports.Take(sumMaxRowNumberOnASheet).ToList(), $"{businessTypeDisplayName}结算核对汇总输出");
for (var i = 1; i < saSeEdiCompareSumExports.Count / sumMaxRowNumberOnASheet + ((saSeEdiCompareSumExports.Count % sumMaxRowNumberOnASheet) > 0 ? 1 : 0); i++)
{
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList();;
var sheetDataItems = saSeEdiCompareSumExports.Skip(i * sumMaxRowNumberOnASheet).Take(sumMaxRowNumberOnASheet).ToList(); ;
excelExporter.Append(sheetDataItems, $"{businessTypeDisplayName}结算核对汇总输出-{i}");
}

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

@ -38,11 +38,17 @@ namespace SettleAccount.Job
private void CreateMapSaSeCompare()
{
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianBBACWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportZhiGongJianHBPOWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianBBAC>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianBBACWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianHBPO>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportMaiDanJianHBPOWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportBeiJian>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportBeiJianWuLiu>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportYinDuJian>();
CreateMap<PubSaSeCompareDiff, PubSaSeCompareDetailExportYinDuJianWuLiu>();
CreateMap<PubSaSeCompareDiff, PUB_SEC_DETAIL>();
}
}

Loading…
Cancel
Save