zhaoxinyu 2 months ago
parent
commit
b7fbc9c3d5
  1. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisBBACSaSeEdiCompareExportService.cs
  2. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/JisHBPOSaSeEdiCompareExportService.cs
  3. 73
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/SaSeEdiCompareExportBaseService.cs

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

@ -103,7 +103,7 @@ namespace SettleAccount.Job.Services.Report
#endregion
#region 结算数据处理
HandleSaDetails<BBAC_CAN_SA_DETAIL, BBAC_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
HandleSQLSaDetails<BBAC_CAN_SA_DETAIL, BBAC_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
HandleSaDetailsMain<BBAC_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
#endregion

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

@ -99,7 +99,7 @@ namespace SettleAccount.Job.Services.Report
#endregion
#region 结算数据处理
HandleSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
HandleSQLSaDetails<HBPO_CAN_SA_DETAIL, HBPO_NOT_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
HandleSaDetailsMain<HBPO_SA_DETAIL>(saSeEdiCompareDiffs, businessType, version);
#endregion

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

@ -1,17 +1,23 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Extension;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.SignalR;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NPOI.HPSF;
using SettleAccount.Bases;
using SettleAccount.Domain.BQ;
using SettleAccount.Job.SignalR;
using Volo.Abp;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Consts;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.Enums;
using Win.Sfs.SettleAccount.Reports;
@ -209,6 +215,73 @@ namespace SettleAccount.Job.Services.Report
}
}
/// <summary>
/// 结算数据处理-直接执行sql
/// </summary>
/// <remarks>
/// 比对上发有发运的结算数据写入库位、替换零件号
/// </remarks>
public virtual void HandleSQLSaDetails<TCanSa, TNotSa>(List<SaSeEdiCompareDiff> saSeEdiCompareDiff, EnumBusinessType businessType, int version)
where TCanSa : SA_CAN_BASE
where TNotSa : SA_NOT_BASE
{
//通过SQL直接更新库位、替换零件号
try
{
if(businessType== EnumBusinessType.JisBBAC)
{
var sql_CAN_SA = @"UPDATE a
SET a.ErpLoc=b.ErpToLoc,a.PartCode=b.RealPartCode,a.RealPartCode=b.RealPartCode
FROM [BQ_SA].[dbo].[Set_BBAC_CAN_SA_DETAIL] a
INNER JOIN [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] b ON a.LU=b.lu and a.PN=b.PN and a.BusinessType=b.BusinessType
WHERE a.version='" + version + "'";
_settleAccountDbContext.Database.ExecuteSqlRaw(sql_CAN_SA);
_settleAccountDbContext.SaveChanges();
var sql_NOTCAN_SA = @"UPDATE a
SET a.ErpLoc=b.ErpToLoc,a.PartCode=b.RealPartCode,a.RealPartCode=b.RealPartCode
FROM [BQ_SA].[dbo].[Set_BBAC_NOT_SA_DETAIL] a
INNER JOIN [BQ_SA].[dbo].[Set_BBAC_SE_DETAIL] b ON a.LU=b.lu and a.PN=b.PN and a.BusinessType=b.BusinessType
WHERE a.version='" + version + "'";
_settleAccountDbContext.Database.ExecuteSqlRaw(sql_NOTCAN_SA);
_settleAccountDbContext.SaveChanges();
}
else
{
var sql_CAN_SA = @"UPDATE a
SET a.ErpLoc=b.ErpToLoc,a.PartCode=b.RealPartCode,a.RealPartCode=b.RealPartCode
FROM [BQ_SA].[dbo].[Set_HBPO_CAN_SA_DETAIL] a
INNER JOIN [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] b ON a.LU=b.lu and a.PN=b.PN and a.BusinessType=b.BusinessType
WHERE a.version='" + version + "'";
_settleAccountDbContext.Database.ExecuteSqlRaw(sql_CAN_SA);
_settleAccountDbContext.SaveChanges();
var sql_NOTCAN_SA = @"UPDATE a
SET a.ErpLoc=b.ErpToLoc,a.PartCode=b.RealPartCode,a.RealPartCode=b.RealPartCode
FROM [BQ_SA].[dbo].[Set_HBPO_NOT_SA_DETAIL] a
INNER JOIN [BQ_SA].[dbo].[Set_HBPO_SE_DETAIL] b ON a.LU=b.lu and a.PN=b.PN and a.BusinessType=b.BusinessType
WHERE a.version='" + version + "'";
_settleAccountDbContext.Database.ExecuteSqlRaw(sql_NOTCAN_SA);
_settleAccountDbContext.SaveChanges();
}
}
catch (Exception ex)
{
throw new UserFriendlyException(ex.ToString(), "500");
}
}
/// <summary>
/// 处理结算数据
/// </summary>

Loading…
Cancel
Save