diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs index 56f1d471..d412d2a1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs +++ b/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; } - + /// + /// 业务类别 + /// + [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; } - + /// + /// 业务分类 + /// + [Display(Name = "业务分类")] + public EnumBusinessType BusinessType { get; set; } /// /// 实际出库厂内物料号 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs index 162af8a9..59464db8 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_CAN_SA.cs +++ b/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 /// //[Display(Name = "单价")] //public decimal Price { get; set; } - - /// - /// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - /// /// 对应字段MovementType,996正常,997为退货 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs index 49d8923a..265401a1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/BBAC_NOT_SA_DETAIL.cs +++ b/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 ///// //[Display(Name = "单价")] //public decimal Price { get; set; } - - /// - /// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - /// /// 对应字段MovementType,996正常,997为退货 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_ADJ_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_ADJ_DETAIL.cs index ec498fa5..0acace87 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_ADJ_DETAIL.cs +++ b/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!; - - /// - /// 业务类型 - /// - public EnumBusinessType BusinessType { get; set; } - - [Display(Name = "作废发票号")] public string OldInvBillNum { get; set; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs index 674b0dd9..91631388 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_CAN_SA.cs +++ b/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!; - /// - /// 业务类型 - /// - 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) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs index 82bef53b..e5e39869 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/HBPO_NOT_SA_DETAIL.cs +++ b/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!; - /// - /// 业务类型 - /// - 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; diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_ADJ_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_ADJ_DETAIL.cs index 80fe064b..1c9279d5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_ADJ_DETAIL.cs +++ b/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 /// //[Display(Name = "结算日期(收货日期)")] //public DateTime SettleDate { get; set; } - [Display(Name = "业务分类")] - public EnumBusinessType BusinessType { get; set; } //[Display(Name = "结算分组")] //public string GroupNum { get; set; } = null!; [Display(Name = "作废发票号")] diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs index 50f71ddc..1c3c7a7f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_CAN_SA.cs +++ b/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; } - /// - /// 1、JIT 2、买单件 3、备件 3、印度件 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - [Display(Name = "订单号")] public string PoBillNum { get; set; } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs index f3a9058b..e43f327b 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_NOT_SA_DETAIL.cs +++ b/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 /// //[Display(Name = "结算日期(收货日期)")] //public DateTime SettleDate { get; set; } - [Display(Name = "业务分类")] - public EnumBusinessType BusinessType { get; set; } //[Display(Name = "结算分组")] //public string GroupNum { get; set; } = null!; [Display(Name ="订单号")] diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs index 106c648b..078896e3 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/Temp/TempClass.cs +++ b/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 ///// //[Display(Name = "单价")] //public decimal Price { get; set; } - - /// - /// ExternalCallNumber包含(R0)为买单件 1为JIS 2.为买单件 - /// - [Display(Name = "业务类别")] - public EnumBusinessType BusinessType { get; set; } - /// /// 对应字段MovementType,996正常,997为退货 /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs index 23cb852d..eb246978 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs @@ -48,7 +48,7 @@ namespace SettleAccount.Job.Services.Report IHubContext hubContext, IBlobContainer 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 /// public string ExportFile(Guid id, List exportName, List 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(ediSeSaCompareDiffs, businessType, version); + #endregion + if (string.IsNullOrEmpty(lu) == false) { ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs index 7228d8c6..8cc69f84 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs @@ -47,7 +47,7 @@ namespace SettleAccount.Job.Services.Report IHubContext hubContext, IBlobContainer 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 /// public string ExportFile(Guid id, List exportName, List 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(ediSeSaCompareDiffs, businessType, version); + #endregion + if (string.IsNullOrEmpty(lu) == false) { ediSeSaCompareDiffs = ediSeSaCompareDiffs.FindAll(p => p.CustomerPartCode == lu); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs index 9e5134ee..eda291b1 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanBBACSaSeCompareExportService.cs @@ -61,7 +61,7 @@ namespace SettleAccount.Job.Services.Report /// public string ExportFile(Guid id, List exportName, List 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(pubSaSeCompareDiffs, businessType, version); + #endregion + if (string.IsNullOrEmpty(lu) == false) { pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs index 8b5180ed..3d4c3de2 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/MaiDanHBPOSaSeCompareExportService.cs @@ -61,7 +61,7 @@ namespace SettleAccount.Job.Services.Report /// public string ExportFile(Guid id, List exportName, List 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(pubSaSeCompareDiffs, businessType, version); + #endregion + if (string.IsNullOrEmpty(lu) == false) { pubSaSeCompareDiffs = pubSaSeCompareDiffs.FindAll(p => p.CustomerPartCode == lu); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs index 955faec2..590edfa4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs +++ b/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(pubSaSeCompareDiffs, businessType, version); #endregion if (string.IsNullOrEmpty(lu) == false) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs index 16078d6a..b74d9f69 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeCompareExportBaseService.cs +++ b/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 /// 结算数据处理 /// 写入库位、替换零件号 /// - public virtual void HandlSaDetails(List pubSaSeCompareDiffs, EnumBusinessType businessType, int version) + public virtual void HandleSaDetails(List 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() + //可结算单 + var canSaDetails = (from sa in _settleAccountDbContext.Set() 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() + + //不可结算单 + var notSaDetails = (from sa in _settleAccountDbContext.Set() where sa.BusinessType == businessType && sa.Version == version select sa).ToList(); if (notSaDetails.Any()) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs index 4f96fb4e..17f62eb4 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs +++ b/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 /// private readonly IHubContext _hubContext; + /// + /// DbContext + /// + private readonly SettleAccountDbContext _settleAccountDbContext; - public SaSeEdiCompareExportBaseService(IHubContext hubContext) + public SaSeEdiCompareExportBaseService(IHubContext hubContext, SettleAccountDbContext settleAccountDbContext) { _hubContext = hubContext; + _settleAccountDbContext = settleAccountDbContext; } public virtual void HandleSaSeEdiCompareDiffList(List ediSeSaCompareDiffs) @@ -61,6 +69,50 @@ namespace SettleAccount.Job.Services.Report }); } + /// + /// 结算数据处理 + /// 写入库位、替换零件号 + /// + public virtual void HandleSaDetails(List 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() + 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() + 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); + } + } + } + /// /// 创建导出文件结构 ///