Browse Source

Edi、发运对比任务

master
mahao 1 year ago
parent
commit
6d5833f260
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs
  2. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs
  3. 64
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  4. 59
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs
  5. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  6. 32
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs
  7. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  8. 1
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  9. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Reports/PubSaSeCompareDiff.cs
  10. 28
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  11. 26
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  12. 56
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  13. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs

@ -152,7 +152,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase<BBAC_SA>
var luAssemble = lus.Select(t => t.Replace(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
importBBACSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); importBBACSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
importBBACSaDetail.CustomerPartCodeNoSpace = importBBACSaDetail.LU.Replace(" ", "");
importBBACSaDetail.Version = Version; importBBACSaDetail.Version = Version;
importBBACSaDetail.Site = Site; importBBACSaDetail.Site = Site;
}); });

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs

@ -436,6 +436,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase<HBPO_SA>
var luAssemble = lus.Select(t => t.Replace(" ", "")); var luAssemble = lus.Select(t => t.Replace(" ", ""));
hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index); hbpoSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
} }
hbpoSaDetail.CustomerPartCodeNoSpace = hbpoSaDetail.LU.Replace(" ", "");
hbpoSaDetail.Version = Version; hbpoSaDetail.Version = Version;
}); });
} }

64
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -239,6 +239,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
@ -274,6 +276,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails); var checkList = await CheckAsync(importPubSaDetails);
if (checkList.Count > 0) if (checkList.Count > 0)
@ -302,6 +306,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
@ -331,6 +337,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
return new JsonResult(new { Code = 200, Message = "导入成功" }); return new JsonResult(new { Code = 200, Message = "导入成功" });
} }
HandleSaDetailLU(importPubSaDetails);
#region 数据校验 #region 数据校验
var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false); var checkList = await CheckAsync(importPubSaDetails).ConfigureAwait(false);
if (checkList.Count > 0) if (checkList.Count > 0)
@ -368,19 +376,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
//验证客户对应厂内零件号是否存在 //验证客户对应厂内零件号是否存在
//导入的零件号集合 //导入的零件号集合
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct();
importPubSaLUs.ForEach(importPubSaLU =>
{
List<string> lus = importPubSaLU.Split(" ").ToList();
importPubSaLU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
importPubSaLU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
});
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct(); var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
@ -396,6 +391,25 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#endregion #endregion
} }
/// <summary>
/// 处理结算数据LU
/// </summary>
/// <param name="pubSaDetails"></param>
private void HandleSaDetailLU(List<PUB_SA_DETAIL> pubSaDetails)
{
pubSaDetails.ForEach(pubSaDetail =>
{
var lus = pubSaDetail.LU.Split(" ").ToList();
pubSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
pubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
});
}
/// <summary> /// <summary>
/// 结算数据处理 /// 结算数据处理
/// </summary> /// </summary>
@ -408,15 +422,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetails.ForEach(importPubSaDetail => pubSaDetails.ForEach(importPubSaDetail =>
{ {
importPubSaDetail.SetId(GuidGenerator.Create()); importPubSaDetail.SetId(GuidGenerator.Create());
List<string> lus = importPubSaDetail.LU.Split(" ").ToList(); importPubSaDetail.CustomerPartCodeNoSpace = importPubSaDetail.LU.Replace(" ", "");
importPubSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
{
lus.RemoveAt(0);
var luAssemble = lus.Select(t => t.Replace(" ", ""));
importPubSaDetail.LU += luAssemble.Aggregate(" ", (current, index) => current + index);
}
importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU; importPubSaDetail.KeyCode = importPubSaDetail.PN + importPubSaDetail.LU;
importPubSaDetail.Version = _version; importPubSaDetail.Version = _version;
importPubSaDetail.BusinessType = businessType; importPubSaDetail.BusinessType = businessType;
@ -449,20 +455,6 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
//导入的零件号集合 //导入的零件号集合
var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct(); var importPubSaLUs = pubSaDetails.Select(t => t.LU).Distinct();
var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false); var materialRelationshipEntitys = await _materialRelationshipRepository.GetListAsync(t => importPubSaLUs.Contains(t.SettleMaterialCode)).ConfigureAwait(false);
//var materialRelationshipEntitySettleMaterialCodes = materialRelationshipEntitys.Select(t => t.SettleMaterialCode).Distinct();
///*
// * (不存在的客户零件号)差集
// * 转换为厂内零件号
// * 转换规则6个空格替换成“-”
// */
//var noExistSettleMaterialCodes = importPubSaLUs.Except(materialRelationshipEntitySettleMaterialCodes);
//noExistSettleMaterialCodes.ForEach(t =>
//{
// var materialRelationship = new MaterialRelationship(GuidGenerator.Create(), t.Replace(" ", "-"), "", t, businessType);
// materialRelationships.Add(materialRelationship);
//});
var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships); var seAllMaterialRelationships = materialRelationshipEntitys.Union(materialRelationships);
pubSaDetails.ForEach(pubSaDetail => pubSaDetails.ForEach(pubSaDetail =>

59
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeEdiCompareAppService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Coravel.Invocable; using Coravel.Invocable;
using EFCore.BulkExtensions;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -38,25 +39,61 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
await HandDelEdiDataAsync().ConfigureAwait(false); await HandDelEdiDataAsync().ConfigureAwait(false);
lock (_lockObj) lock (_lockObj)
{ {
var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); var seDetailGroup = db.Set<BBAC_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }).Select(t => new { t.Key.PN, LU = t.Key.CustomerPartCodeNoSpace });
var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); var ediDetailGroup = db.Set<BBAC_SE_EDI>().Where(t => t.IsDeleted == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }).Take(10000).ToList();
if (keyCodes.Any()) var keyCodes = from se in seDetailGroup
{ from edi in ediDetailGroup
var seDetails = db.Set<BBAC_SE_DETAIL>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); where se.PN == edi.PN && se.LU == edi.LU
var ediDetails = db.Set<BBAC_SE_EDI>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); select new { se.PN, se.LU };
var seDetailsQuery = from se in db.Set<BBAC_SE_DETAIL>()
from keyCode in keyCodes
where se.PN == keyCode.PN && se.CustomerPartCodeNoSpace == keyCode.LU && se.IsHaveEdiData == false
select se;
var ediDetailsQuery = from edi in db.Set<BBAC_SE_EDI>()
from keyCode in keyCodes
where edi.PN == keyCode.PN && edi.LU == keyCode.LU && edi.IsDeleted == false && edi.IsHaveSeData == false
select edi;
var seDetails = seDetailsQuery.Take(5000).ToList();
var ediDetails = ediDetailsQuery.Take(5000).ToList();
if (seDetails.Any()) if (seDetails.Any())
{ {
seDetails.ForEach(t => t.IsHaveEdiData = true); seDetails.ForEach(t => t.IsHaveEdiData = true);
db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails); db.BulkUpdate<BBAC_SE_DETAIL>(seDetails);
} }
if (ediDetails.Any()) if (ediDetails.Any())
{ {
ediDetails.ForEach(t => t.IsHaveSeData = true); ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails); db.BulkUpdate<BBAC_SE_EDI>(ediDetails);
} }
db.SaveChanges(); db.SaveChanges();
}
//var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }).Take(1000).ToList();
//if (keyCodes.Any())
//{
// var pnLus = keyCodes.GroupBy(t => t.PN).Select(t => new { t.Key, Lus = t.Where(p => p.PN == t.Key).Select(t => t.LU) });
// pnLus.ForEach(pnLu =>
// {
// var pn = pnLu.Key;
// var lus = pnLu.Lus;
// var seDetails = db.Set<BBAC_SE_DETAIL>().Where(t => t.PN == pn && lus.Contains(t.CustomerPartCodeNoSpace));
// var ediDetails = db.Set<BBAC_SE_EDI>().Where(t => t.PN == pn && lus.Contains(t.LU));
// if (seDetails.Any())
// {
// seDetails.ForEach(t => t.IsHaveEdiData = true);
// db.Set<BBAC_SE_DETAIL>().UpdateRange(seDetails);
// }
// if (ediDetails.Any())
// {
// ediDetails.ForEach(t => t.IsHaveSeData = true);
// db.Set<BBAC_SE_EDI>().UpdateRange(ediDetails);
// }
// });
// db.SaveChanges();
//}
} }
} }
catch (Exception) catch (Exception)
@ -83,7 +120,7 @@ public class JisBBACSeEdiCompareAppService : ApplicationService, IInvocable
if (ediDelKeyCodes.Any()) if (ediDelKeyCodes.Any())
{ {
var seDetails = db.Set<BBAC_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); var seDetails = db.Set<BBAC_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, LU = a.CustomerPartCodeNoSpace }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<BBAC_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); var ediDetails = db.Set<BBAC_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any()) if (seDetails.Any())
{ {

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -122,6 +122,7 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
{ {
t.SetId(GuidGenerator.Create()); t.SetId(GuidGenerator.Create());
t.BusinessType = businessType; t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
if (t.BillTime != null) if (t.BillTime != null)
{ {
@ -185,6 +186,7 @@ public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable
{ {
t.SetId(GuidGenerator.Create()); t.SetId(GuidGenerator.Create());
t.BusinessType = businessType; t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
if (t.BillTime != null) if (t.BillTime != null)
{ {

32
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeEdiCompareAppService.cs

@ -5,6 +5,7 @@ using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Threading.Tasks; using System.Threading.Tasks;
using Coravel.Invocable; using Coravel.Invocable;
using EFCore.BulkExtensions;
using LinqToDB; using LinqToDB;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -55,27 +56,38 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
await HandDelEdiDataAsync().ConfigureAwait(false); await HandDelEdiDataAsync().ConfigureAwait(false);
lock (_lockObj) lock (_lockObj)
{ {
var seDetailGroup = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); var seDetailGroup = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).GroupBy(t => new { t.PN, t.CustomerPartCodeNoSpace }).Select(t => new { t.Key.PN, LU = t.Key.CustomerPartCodeNoSpace });
var ediDetailGroup = db.Set<HBPO_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU }); var ediDetailGroup = db.Set<HBPO_SE_EDI>().Where(t => t.IsDeleted == false && t.IsHaveSeData == false).GroupBy(t => new { t.PN, t.LU }).Select(t => new { t.Key.PN, t.Key.LU });
var keyCodes = seDetailGroup.Join(ediDetailGroup, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (se, edi) => new { se.PN, se.LU }).Take(10000).ToList();
if (keyCodes.Any()) var keyCodes = from se in seDetailGroup
{ from edi in ediDetailGroup
var seDetails = db.Set<HBPO_SE_DETAIL>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); where se.PN == edi.PN && se.LU == edi.LU
var ediDetails = db.Set<HBPO_SE_EDI>().Join(keyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); select new { se.PN, se.LU };
var seDetailsQuery = from se in db.Set<HBPO_SE_DETAIL>()
from keyCode in keyCodes
where se.PN == keyCode.PN && se.CustomerPartCodeNoSpace == keyCode.LU && se.IsHaveEdiData == false
select se;
var ediDetailsQuery = from edi in db.Set<HBPO_SE_EDI>()
from keyCode in keyCodes
where edi.PN == keyCode.PN && edi.LU == keyCode.LU && edi.IsDeleted == false && edi.IsHaveSeData == false
select edi;
var seDetails = seDetailsQuery.Take(5000).ToList();
var ediDetails = ediDetailsQuery.Take(5000).ToList();
if (seDetails.Any()) if (seDetails.Any())
{ {
seDetails.ForEach(t => t.IsHaveEdiData = true); seDetails.ForEach(t => t.IsHaveEdiData = true);
db.Set<HBPO_SE_DETAIL>().UpdateRange(seDetails); db.BulkUpdate<HBPO_SE_DETAIL>(seDetails);
} }
if (ediDetails.Any()) if (ediDetails.Any())
{ {
ediDetails.ForEach(t => t.IsHaveSeData = true); ediDetails.ForEach(t => t.IsHaveSeData = true);
db.Set<HBPO_SE_EDI>().UpdateRange(ediDetails); db.BulkUpdate<HBPO_SE_EDI>(ediDetails);
} }
db.SaveChanges(); db.SaveChanges();
} }
} }
}
catch (Exception) catch (Exception)
{ {
throw; throw;
@ -94,7 +106,7 @@ public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable
if (ediDelKeyCodes.Any()) if (ediDelKeyCodes.Any())
{ {
var seDetails = db.Set<HBPO_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); var seDetails = db.Set<HBPO_SE_DETAIL>().Join(ediDelKeyCodes, a => new { a.PN, LU = a.CustomerPartCodeNoSpace }, b => new { b.PN, b.LU }, (a, b) => a);
var ediDetails = db.Set<HBPO_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a); var ediDetails = db.Set<HBPO_SE_EDI>().Join(ediDelKeyCodes, a => new { a.PN, a.LU }, b => new { b.PN, b.LU }, (a, b) => a);
if (seDetails.Any()) if (seDetails.Any())
{ {

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -122,6 +122,7 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
{ {
t.SetId(GuidGenerator.Create()); t.SetId(GuidGenerator.Create());
t.BusinessType = businessType; t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
if (t.BillTime != null) if (t.BillTime != null)
{ {
@ -185,6 +186,7 @@ public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable
{ {
t.SetId(GuidGenerator.Create()); t.SetId(GuidGenerator.Create());
t.BusinessType = businessType; t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
if (t.BillTime != null) if (t.BillTime != null)
{ {

1
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -119,6 +119,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
{ {
t.SetId(GuidGenerator.Create()); t.SetId(GuidGenerator.Create());
t.BusinessType = businessType; t.BusinessType = businessType;
t.CustomerPartCodeNoSpace = t.LU.Replace(" ", "");
t.KeyCode = t.PN + t.LU; t.KeyCode = t.PN + t.LU;
if (t.BillTime != null) if (t.BillTime != null)
{ {

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

@ -57,6 +57,11 @@ public class PubSaSeCompareDiff
[Display(Name = "生产号")] [Display(Name = "生产号")]
public string PN { set; get; } public string PN { set; get; }
/// <summary> /// <summary>
/// 客户物料号
/// </summary>
[Display(Name = "客户物料号")]
public string LU { set; get; }
/// <summary>
/// WMS目标库位 /// WMS目标库位
/// </summary> /// </summary>
[Display(Name = "WMS目标库位")] [Display(Name = "WMS目标库位")]
@ -111,10 +116,6 @@ public class PubSaSeCompareDiff
/// 是否已经移除 /// 是否已经移除
/// </summary> /// </summary>
public bool IsRemove { get; set; } public bool IsRemove { get; set; }
/// <summary>
/// 是否替换了厂内零件号
/// </summary>
public bool IsReplace { get; set; }
} }
/// <summary> /// <summary>

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

@ -121,12 +121,13 @@ namespace SettleAccount.Job.Services.Report
//结算 //结算
var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<BBAC_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.PN, sa.LU } into groupItem group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
Price = groupItem.Max(t => t.Price), Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate), SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode), PartCode = groupItem.Max(t => t.PartCode),
@ -134,12 +135,13 @@ namespace SettleAccount.Job.Services.Report
//发运 //发运
var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>() var seGroup = from se in _settleAccountDbContext.Set<BBAC_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
WmsBillNum = groupItem.Max(t => t.WmsBillNum), WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate), ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
@ -148,7 +150,7 @@ namespace SettleAccount.Job.Services.Report
}; };
var saSeCompareLeft = from sa in saGroup var saSeCompareLeft = from sa in saGroup
join se in seGroup join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
into temp into temp
from se in temp.DefaultIfEmpty() from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -162,14 +164,15 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLoc, ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc, ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU,
}; };
var saSeCompareRight = from se in seGroup var saSeCompareRight = from se in seGroup
join sa in saGroup join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU } on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace }
into temp into temp
from sa in temp.DefaultIfEmpty() from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -183,10 +186,11 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLoc, ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc, ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU ?? se.LU
}; };
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin; return saSeCompareFullJoin;

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

@ -121,12 +121,13 @@ namespace SettleAccount.Job.Services.Report
//结算 //结算
var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<HBPO_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.PN, sa.LU } into groupItem group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
Price = groupItem.Max(t => t.Price), Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate), SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode), PartCode = groupItem.Max(t => t.PartCode),
@ -134,12 +135,13 @@ namespace SettleAccount.Job.Services.Report
//发运 //发运
var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>() var seGroup = from se in _settleAccountDbContext.Set<HBPO_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
WmsBillNum = groupItem.Max(t => t.WmsBillNum), WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate), ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
@ -148,7 +150,7 @@ namespace SettleAccount.Job.Services.Report
}; };
var saSeCompareLeft = from sa in saGroup var saSeCompareLeft = from sa in saGroup
join se in seGroup join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
into temp into temp
from se in temp.DefaultIfEmpty() from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -162,10 +164,11 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLoc, ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc, ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU
}; };
var saSeCompareRight = from se in seGroup var saSeCompareRight = from se in seGroup
join sa in saGroup join sa in saGroup
@ -183,10 +186,11 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLoc, ToLocCode = se.ToLoc,
ToErpLocCode = se.ErpToLoc, ToErpLocCode = se.ErpToLoc,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU ?? se.LU
}; };
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin; return saSeCompareFullJoin;

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

@ -226,12 +226,13 @@ namespace SettleAccount.Job.Services.Report
//结算 //结算
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == businessType && sa.Version == version where sa.BusinessType == businessType && sa.Version == version
group sa by new { sa.PN, sa.LU } into groupItem group sa by new { sa.PN, sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
Price = groupItem.Max(t => t.Price), Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate), SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode), PartCode = groupItem.Max(t => t.PartCode),
@ -239,12 +240,13 @@ namespace SettleAccount.Job.Services.Report
//发运 //发运
var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>() var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime where se.BusinessType == businessType && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.PN, se.LU } into groupItem group se by new { se.PN, se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.PN, groupItem.Key.PN,
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
WmsBillNum = groupItem.Max(t => t.WmsBillNum), WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate), ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
@ -253,7 +255,7 @@ namespace SettleAccount.Job.Services.Report
}; };
var saSeCompareLeft = from sa in saGroup var saSeCompareLeft = from sa in saGroup
join se in seGroup join se in seGroup
on new { sa.PN, sa.LU } equals new { se.PN, se.LU } on new { sa.PN, sa.CustomerPartCodeNoSpace } equals new { se.PN, se.CustomerPartCodeNoSpace }
into temp into temp
from se in temp.DefaultIfEmpty() from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -267,14 +269,15 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLocCode, ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode, ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU
}; };
var saSeCompareRight = from se in seGroup var saSeCompareRight = from se in seGroup
join sa in saGroup join sa in saGroup
on new { se.PN, se.LU } equals new { sa.PN, sa.LU } on new { se.PN, se.CustomerPartCodeNoSpace } equals new { sa.PN, sa.CustomerPartCodeNoSpace }
into temp into temp
from sa in temp.DefaultIfEmpty() from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -288,10 +291,11 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLocCode, ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode, ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU ?? se.LU
}; };
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
@ -305,22 +309,24 @@ namespace SettleAccount.Job.Services.Report
{ {
var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>() var saGroup = from sa in _settleAccountDbContext.Set<PUB_SA_DETAIL>()
where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version where sa.BusinessType == EnumBusinessType.YinDuJian && sa.Version == version
group sa by new { sa.LU } into groupItem group sa by new { sa.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
Price = groupItem.Max(t => t.Price), Price = groupItem.Max(t => t.Price),
SettleDate = groupItem.Max(t => t.SettleDate), SettleDate = groupItem.Max(t => t.SettleDate),
PartCode = groupItem.Max(t => t.PartCode), PartCode = groupItem.Max(t => t.PartCode),
}; };
var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>() var seGroup = from se in _settleAccountDbContext.Set<PUB_SE_DETAIL>()
where se.BusinessType == EnumBusinessType.YinDuJian && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime where se.BusinessType == EnumBusinessType.YinDuJian && se.BillTime >= seStartDateTime && se.BillTime <= seEndDateTime
group se by new { se.LU } into groupItem group se by new { se.CustomerPartCodeNoSpace } into groupItem
select new select new
{ {
groupItem.Key.LU, groupItem.Key.CustomerPartCodeNoSpace,
Qty = groupItem.Sum(t => t.Qty), Qty = groupItem.Sum(t => t.Qty),
LU = groupItem.Max(t => t.LU),
WmsBillNum = groupItem.Max(t => t.WmsBillNum), WmsBillNum = groupItem.Max(t => t.WmsBillNum),
ShippingDate = groupItem.Max(t => t.ShippingDate), ShippingDate = groupItem.Max(t => t.ShippingDate),
FactoryPartCode = groupItem.Max(t => t.FactoryPartCode), FactoryPartCode = groupItem.Max(t => t.FactoryPartCode),
@ -330,7 +336,7 @@ namespace SettleAccount.Job.Services.Report
var saSeCompareLeft = from sa in saGroup var saSeCompareLeft = from sa in saGroup
join se in seGroup join se in seGroup
on sa.LU equals se.LU on sa.CustomerPartCodeNoSpace equals se.CustomerPartCodeNoSpace
into temp into temp
from se in temp.DefaultIfEmpty() from se in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -343,14 +349,15 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLocCode, ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode, ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU
}; };
var saSeCompareRight = from se in seGroup var saSeCompareRight = from se in seGroup
join sa in saGroup join sa in saGroup
on se.LU equals sa.LU on se.CustomerPartCodeNoSpace equals sa.CustomerPartCodeNoSpace
into temp into temp
from sa in temp.DefaultIfEmpty() from sa in temp.DefaultIfEmpty()
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
@ -363,10 +370,11 @@ namespace SettleAccount.Job.Services.Report
FixPrice = sa.Price, FixPrice = sa.Price,
ToLocCode = se.ToLocCode, ToLocCode = se.ToLocCode,
ToErpLocCode = se.ToErpLocCode, ToErpLocCode = se.ToErpLocCode,
SeCustomerPartCode = se.LU, SeCustomerPartCode = se.CustomerPartCodeNoSpace,
SeFactoryPartCode = se.FactoryPartCode, SeFactoryPartCode = se.FactoryPartCode,
SaCustomerPartCode = sa.LU, SaCustomerPartCode = sa.CustomerPartCodeNoSpace,
SaFactoryPartCode = sa.PartCode SaFactoryPartCode = sa.PartCode,
CustomerPartCode = sa.LU ?? se.LU
}; };
var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList(); var saSeCompareFullJoin = saSeCompareLeft.Union(saSeCompareRight).ToList();
return saSeCompareFullJoin; return saSeCompareFullJoin;

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

@ -47,21 +47,18 @@ namespace SettleAccount.Job.Services.Report
break; break;
case EnumPubSaSeCompareCategory.HaveSaHaveSe: case EnumPubSaSeCompareCategory.HaveSaHaveSe:
{ {
p.CustomerPartCode = p.SaCustomerPartCode;
p.FactoryPartCode = p.SaFactoryPartCode; p.FactoryPartCode = p.SaFactoryPartCode;
p.ReplaceFactoryPartCode = p.SaFactoryPartCode; p.ReplaceFactoryPartCode = p.SaFactoryPartCode;
} }
break; break;
case EnumPubSaSeCompareCategory.HaveSaNotHaveSe: case EnumPubSaSeCompareCategory.HaveSaNotHaveSe:
{ {
p.CustomerPartCode = p.SaCustomerPartCode;
p.FactoryPartCode = p.SaFactoryPartCode; p.FactoryPartCode = p.SaFactoryPartCode;
p.ReplaceFactoryPartCode = p.SaFactoryPartCode; p.ReplaceFactoryPartCode = p.SaFactoryPartCode;
} }
break; break;
case EnumPubSaSeCompareCategory.NotHaveSaHaveSe: case EnumPubSaSeCompareCategory.NotHaveSaHaveSe:
{ {
p.CustomerPartCode = p.SeCustomerPartCode;
p.FactoryPartCode = p.SeFactoryPartCode; p.FactoryPartCode = p.SeFactoryPartCode;
p.ReplaceFactoryPartCode = p.SeFactoryPartCode; p.ReplaceFactoryPartCode = p.SeFactoryPartCode;
} }
@ -79,8 +76,6 @@ namespace SettleAccount.Job.Services.Report
{ {
//二次匹配上的记录 //二次匹配上的记录
var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>(); var secondMatchHaveSaHaveSes = new List<PubSaSeCompareDiff>();
//有结算有发运
var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
//有结算无发运 //有结算无发运
var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe); var haveSaNotHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaNotHaveSe);
//无结算有发运 //无结算有发运
@ -95,7 +90,6 @@ namespace SettleAccount.Job.Services.Report
notHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t => notHaveSaHaveSes.FindAll(t => t.FactoryPartCode == tbRePartsRelationship.LU).ForEach(t =>
{ {
t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU; t.ReplaceFactoryPartCode = tbRePartsRelationship.RepLU;
t.IsReplace = true;
}); });
}); });
@ -103,7 +97,6 @@ namespace SettleAccount.Job.Services.Report
secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes secondMatchHaveSaHaveSes = (from notHaveSaHaveSe in notHaveSaHaveSes
join haveSaNotHaveSe in haveSaNotHaveSes join haveSaNotHaveSe in haveSaNotHaveSes
on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode } on new { notHaveSaHaveSe.PN, notHaveSaHaveSe.ReplaceFactoryPartCode } equals new { haveSaNotHaveSe.PN, haveSaNotHaveSe.ReplaceFactoryPartCode }
where notHaveSaHaveSe.IsReplace == true
select new PubSaSeCompareDiff() select new PubSaSeCompareDiff()
{ {
WmsBillNum = notHaveSaHaveSe.WmsBillNum, WmsBillNum = notHaveSaHaveSe.WmsBillNum,

Loading…
Cancel
Save