|
@ -2,6 +2,7 @@ using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.ComponentModel.DataAnnotations; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
|
|
|
using Magicodes.ExporterAndImporter.Excel; |
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
using Microsoft.OpenApi.Extensions; |
|
|
using Microsoft.OpenApi.Extensions; |
|
|
using SettleAccount.Domain.BQ; |
|
|
using SettleAccount.Domain.BQ; |
|
@ -14,6 +15,7 @@ using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
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.Entities.BQ; |
|
|
using Win.Sfs.SettleAccount.Reports; |
|
|
using Win.Sfs.SettleAccount.Reports; |
|
|
|
|
|
|
|
|
namespace SettleAccount.Job.Services.Report |
|
|
namespace SettleAccount.Job.Services.Report |
|
@ -69,27 +71,51 @@ namespace SettleAccount.Job.Services.Report |
|
|
var seStartDateTime = DateTime.Parse(strSeStartDateTime); |
|
|
var seStartDateTime = DateTime.Parse(strSeStartDateTime); |
|
|
var seEndDateTime = DateTime.Parse(strSeEndDateTime); |
|
|
var seEndDateTime = DateTime.Parse(strSeEndDateTime); |
|
|
var filename = exportName.FirstOrDefault(); |
|
|
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 结算数据处理
|
|
|
#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
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(lu) == false) |
|
|
if (string.IsNullOrEmpty(lu) == false) |
|
|
{ |
|
|
{ |
|
|
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu); |
|
|
saSeEdiCompareDiffs = saSeEdiCompareDiffs.FindAll(p => p.CustomerPartCode == lu); |
|
|
} |
|
|
} |
|
|
if (string.IsNullOrEmpty(pn) == false) |
|
|
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 = new ExcelExporter(); |
|
|
var excelExporter = BindExcelExporter<SaSeEdiCompareDetailExportJisHBPO>(items, businessTypeDisplayName); |
|
|
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(); |
|
|
var result = excelExporter.ExportAppendDataAsByteArray(); |
|
|
result.ShouldNotBeNull(); |
|
|
result.ShouldNotBeNull(); |
|
@ -103,7 +129,7 @@ namespace SettleAccount.Job.Services.Report |
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取比对数据
|
|
|
/// 获取比对数据
|
|
|
/// </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>() |
|
|
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>() |
|
|