|
|
@ -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}"); |
|
|
|
} |
|
|
|
|
|
|
|