学 赵 1 year ago
parent
commit
25b6c882f2
  1. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  2. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs
  3. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs
  4. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_ADJ_DETAIL.cs
  5. 4
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs
  6. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs
  7. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_ADJ_DETAIL.cs
  8. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs
  9. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs
  10. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs
  11. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  12. 10
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  13. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs
  14. 8
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs
  15. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs
  16. 12
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs
  17. 54
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

12
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -453,7 +453,11 @@ namespace SettleAccount.Bases
public string SettleBillNum { get; set; }
public string InvbillNum { get; set; }
/// <summary>
/// 业务类别
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
public string ErpLoc { get; set; } = string.Empty;
public string PartCode { get; set; }
public string RealPartCode { get; set; }
@ -527,7 +531,11 @@ namespace SettleAccount.Bases
public string PartCode { get; set; }
/// <summary>
/// 业务分类
/// </summary>
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 实际出库厂内物料号
/// </summary>

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs

@ -102,13 +102,6 @@ public class BBAC_CAN_SA_DETAIL: SA_CAN_BASE
/// </summary>
//[Display(Name = "单价")]
//public decimal Price { get; set; }
/// <summary>
/// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 对应字段MovementType,996正常,997为退货
/// </summary>

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs

@ -56,13 +56,6 @@ public class BBAC_NOT_SA_DETAIL:SA_NOT_BASE
///// </summary>
//[Display(Name = "单价")]
//public decimal Price { get; set; }
/// <summary>
/// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 对应字段MovementType,996正常,997为退货
/// </summary>

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_ADJ_DETAIL.cs

@ -92,13 +92,6 @@ public class HBPO_ADJ_DETAIL : SA_NOT_BASE
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "作废发票号")]
public string OldInvBillNum { get; set; }

4
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs

@ -119,10 +119,6 @@ public class HBPO_CAN_SA_DETAIL:SA_CAN_BASE
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
public HBPO_CAN_SA_DETAIL(Guid guid ,string keyCode, int version, string billNum, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType, string invbillnum,string partcode)
{

9
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs

@ -93,15 +93,6 @@ public class HBPO_NOT_SA_DETAIL :SA_NOT_BASE
//[Display(Name = "发票分组号")]
//public string InvGroupNum { get; set; } = null!;
/// <summary>
/// 业务类型
/// </summary>
public EnumBusinessType BusinessType { get; set; }
public HBPO_NOT_SA_DETAIL(Guid guid ,string keyCode, int version, string settleBillNum, string lU, string pN, string site, decimal qty, decimal price, DateTime settleDate, string groupNum, string invGroupNum, EnumBusinessType businessType,string partcode)
{
Id = guid;

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_ADJ_DETAIL.cs

@ -60,8 +60,6 @@ public class PUB_ADJ_DETAIL : SA_NOT_BASE
/// </summary>
//[Display(Name = "结算日期(收货日期)")]
//public DateTime SettleDate { get; set; }
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
[Display(Name = "作废发票号")]

6
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs

@ -106,12 +106,6 @@ public class PUB_CAN_SA_DETAIL : SA_CAN_BASE
//[Display(Name = "结算日期(收货日期)")]
//public DateTime SettleDate { get; set; }
/// <summary>
/// 1、JIT 2、买单件 3、备件 3、印度件
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
[Display(Name = "订单号")]
public string PoBillNum { get; set; }

2
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs

@ -65,8 +65,6 @@ public class PUB_NOT_SA_DETAIL : SA_NOT_BASE
/// </summary>
//[Display(Name = "结算日期(收货日期)")]
//public DateTime SettleDate { get; set; }
[Display(Name = "业务分类")]
public EnumBusinessType BusinessType { get; set; }
//[Display(Name = "结算分组")]
//public string GroupNum { get; set; } = null!;
[Display(Name ="订单号")]

7
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs

@ -189,13 +189,6 @@ public class TEMP_NOT_SA_DETAIL : SA_NOT_BASE
///// </summary>
//[Display(Name = "单价")]
//public decimal Price { get; set; }
/// <summary>
/// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件
/// </summary>
[Display(Name = "业务类别")]
public EnumBusinessType BusinessType { get; set; }
/// <summary>
/// 对应字段MovementType,996正常,997为退货
/// </summary>

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

@ -48,7 +48,7 @@ namespace SettleAccount.Job.Services.Report
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
SettleAccountDbContext settleAccountDbContext) : base(hubContext, settleAccountDbContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
@ -60,7 +60,7 @@ namespace SettleAccount.Job.Services.Report
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var version = int.Parse(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;
@ -71,10 +71,14 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
#region 结算数据处理
HandleSaDetails<BBAC_CAN_SA_DETAIL, BBAC_NOT_SA_DETAIL>(ediSeSaCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);

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

@ -47,7 +47,7 @@ namespace SettleAccount.Job.Services.Report
IHubContext<PageHub> hubContext,
IBlobContainer<MyFileContainer> fileContainer,
IObjectMapper objectMapper,
SettleAccountDbContext settleAccountDbContext) : base(hubContext)
SettleAccountDbContext settleAccountDbContext) : base(hubContext, settleAccountDbContext)
{
_fileContainer = fileContainer;
_objectMapper = objectMapper;
@ -59,7 +59,7 @@ namespace SettleAccount.Job.Services.Report
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var version = int.Parse(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;
@ -70,10 +70,14 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
var ediSeSaCompareDiffs = GetEdiSeSaCompareData(version, seStartDateTime, seEndDateTime);
HandleSaSeEdiCompareDiffList(ediSeSaCompareDiffs);
#region 结算数据处理
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(ediSeSaCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu);

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

@ -61,7 +61,7 @@ namespace SettleAccount.Job.Services.Report
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var version = int.Parse(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;
@ -72,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var pubSaSeCompareDiffs = GetSaSeCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -91,6 +91,10 @@ namespace SettleAccount.Job.Services.Report
}
#endregion
#region 结算数据处理
HandleSaDetails<BBAC_CAN_SA_DETAIL, BBAC_NOT_SA_DETAIL>(pubSaSeCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu);

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

@ -61,7 +61,7 @@ namespace SettleAccount.Job.Services.Report
/// </summary>
public string ExportFile(Guid id, List<string> exportName, List<CustomCondition> property)
{
var version = property.Where(p => p.Name == "Version").FirstOrDefault().Value;
var version = int.Parse(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;
@ -72,7 +72,7 @@ namespace SettleAccount.Job.Services.Report
var seEndDateTime = DateTime.Parse(strSeEndDateTime);
var filename = exportName.FirstOrDefault();
var pubSaSeCompareDiffs = GetSaSeCompareData(int.Parse(version), seStartDateTime, seEndDateTime);
var pubSaSeCompareDiffs = GetSaSeCompareData(version, seStartDateTime, seEndDateTime);
HandlePubSaSeCompareDiffList(pubSaSeCompareDiffs);
@ -91,6 +91,10 @@ namespace SettleAccount.Job.Services.Report
}
#endregion
#region 结算数据处理
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(pubSaSeCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)
{
pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu);

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

@ -122,7 +122,7 @@ namespace SettleAccount.Job.Services.Report
#endregion
#region 结算数据处理
HandlSaDetails(pubSaSeCompareDiffs, businessType, version);
HandleSaDetails<PUB_CAN_SA_DETAIL, PUB_NOT_SA_DETAIL>(pubSaSeCompareDiffs, businessType, version);
#endregion
if (string.IsNullOrEmpty(lu) == false)

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

@ -3,6 +3,7 @@ using System.Linq;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
@ -130,13 +131,16 @@ namespace SettleAccount.Job.Services.Report
/// 结算数据处理
/// 写入库位、替换零件号
/// </summary>
public virtual void HandlSaDetails(List<PubSaSeCompareDiff> pubSaSeCompareDiffs, EnumBusinessType businessType, int version)
public virtual void HandleSaDetails<TCanSa, TNotSa>(List<PubSaSeCompareDiff> pubSaSeCompareDiffs, EnumBusinessType businessType, int version)
where TCanSa : SA_CAN_BASE
where TNotSa : SA_NOT_BASE
{
//写入库位、替换零件号
var haveSaHaveSes = pubSaSeCompareDiffs.FindAll(t => t.Category == EnumPubSaSeCompareCategory.HaveSaHaveSe);
if (haveSaHaveSes.Any())
{
var canSaDetails = (from sa in _settleAccountDbContext.Set<PUB_CAN_SA_DETAIL>()
//可结算单
var canSaDetails = (from sa in _settleAccountDbContext.Set<TCanSa>()
where sa.BusinessType == businessType && sa.Version == version
select sa).ToList();
if (canSaDetails.Any())
@ -149,7 +153,9 @@ namespace SettleAccount.Job.Services.Report
}).ToList();
_settleAccountDbContext.BulkUpdate(canSaDetailsUpdate);
}
var notSaDetails = (from sa in _settleAccountDbContext.Set<PUB_NOT_SA_DETAIL>()
//不可结算单
var notSaDetails = (from sa in _settleAccountDbContext.Set<TNotSa>()
where sa.BusinessType == businessType && sa.Version == version
select sa).ToList();
if (notSaDetails.Any())

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

@ -1,8 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using SettleAccount.Bases;
using SettleAccount.Job.SignalR;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -17,10 +20,15 @@ namespace SettleAccount.Job.Services.Report
/// HubContext
/// </summary>
private readonly IHubContext<PageHub> _hubContext;
/// <summary>
/// DbContext
/// </summary>
private readonly SettleAccountDbContext _settleAccountDbContext;
public SaSeEdiCompareExportBaseService(IHubContext<PageHub> hubContext)
public SaSeEdiCompareExportBaseService(IHubContext<PageHub> hubContext, SettleAccountDbContext settleAccountDbContext)
{
_hubContext = hubContext;
_settleAccountDbContext = settleAccountDbContext;
}
public virtual void HandleSaSeEdiCompareDiffList(List<SaSeEdiCompareDiff> ediSeSaCompareDiffs)
@ -61,6 +69,50 @@ namespace SettleAccount.Job.Services.Report
});
}
/// <summary>
/// 结算数据处理
/// 写入库位、替换零件号
/// </summary>
public virtual void HandleSaDetails<TCanSa, TNotSa>(List<SaSeEdiCompareDiff> saSeEdiCompareDiff, EnumBusinessType businessType, int version)
where TCanSa : SA_CAN_BASE
where TNotSa : SA_NOT_BASE
{
//写入库位、替换零件号
var haveSaHaveSes = saSeEdiCompareDiff.FindAll(t => t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeHaveEdi || t.Category == EnumSaSeEdiCompareCategory.HaveSaHaveSeNotHaveEdi);
if (haveSaHaveSes.Any())
{
//可结算单
var canSaDetails = (from sa in _settleAccountDbContext.Set<TCanSa>()
where sa.BusinessType == businessType && sa.Version == version
select sa).ToList();
if (canSaDetails.Any())
{
var canSaDetailsUpdate = canSaDetails.Join(haveSaHaveSes, o => new { o.PN, o.LU }, i => new { i.PN, LU = i.CustomerPartCode }, (o, i) =>
{
o.ErpLoc = i.ToErpLocCode;
o.RealPartCode = i.ReplaceFactoryPartCode;
return o;
}).ToList();
_settleAccountDbContext.BulkUpdate(canSaDetailsUpdate);
}
//不可结算单
var notSaDetails = (from sa in _settleAccountDbContext.Set<TNotSa>()
where sa.BusinessType == businessType && sa.Version == version
select sa).ToList();
if (notSaDetails.Any())
{
var notSaDetailsUpdate = notSaDetails.Join(haveSaHaveSes, o => new { o.PN, o.LU }, i => new { i.PN, LU = i.CustomerPartCode }, (o, i) =>
{
o.ErpLoc = i.ToErpLocCode;
o.RealPartCode = i.ReplaceFactoryPartCode;
return o;
}).ToList();
_settleAccountDbContext.BulkUpdate(notSaDetailsUpdate);
}
}
}
/// <summary>
/// 创建导出文件结构
/// </summary>

Loading…
Cancel
Save