|
@ -1,5 +1,6 @@ |
|
|
using System; |
|
|
using System; |
|
|
using System.Collections.Generic; |
|
|
using System.Collections.Generic; |
|
|
|
|
|
using System.Data.SqlClient; |
|
|
using System.Diagnostics; |
|
|
using System.Diagnostics; |
|
|
using System.Linq; |
|
|
using System.Linq; |
|
|
using System.Linq.Dynamic.Core; |
|
|
using System.Linq.Dynamic.Core; |
|
@ -10,11 +11,13 @@ using EFCore.BulkExtensions; |
|
|
using LinqToDB.EntityFrameworkCore; |
|
|
using LinqToDB.EntityFrameworkCore; |
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
using Microsoft.AspNetCore.Mvc; |
|
|
|
|
|
using Microsoft.AspNetCore.SignalR; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.EntityFrameworkCore; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Omu.ValueInjecter; |
|
|
using Omu.ValueInjecter; |
|
|
|
|
|
using SettleAccount.Job.SignalR; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp; |
|
|
using Volo.Abp.Application.Services; |
|
|
using Volo.Abp.Application.Services; |
|
|
using Volo.Abp.DependencyInjection; |
|
|
using Volo.Abp.DependencyInjection; |
|
@ -234,14 +237,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
foreach (var item in tables) |
|
|
foreach (var item in tables) |
|
|
{ |
|
|
{ |
|
|
var logs = list.Where(o => o.Table == item).Select(o => o.Log).ToList(); |
|
|
var logs = list.Where(o => o.Table == item).Select(o => o.Log).ToList(); |
|
|
//await context.BulkInsertAsync(logs, new BulkConfig { CustomDestinationTableName = item, }).ConfigureAwait(false);
|
|
|
|
|
|
await context.BulkCopyAsync(new LinqToDB.Data.BulkCopyOptions { TableName = item }, logs).ConfigureAwait(false); |
|
|
await context.BulkCopyAsync(new LinqToDB.Data.BulkCopyOptions { TableName = item }, logs).ConfigureAwait(false); |
|
|
} |
|
|
} |
|
|
//批量更新消息
|
|
|
|
|
|
await context.BulkUpdateAsync(messages, new BulkConfig |
|
|
|
|
|
{ |
|
|
|
|
|
PropertiesToExclude = new List<string> { nameof(VmiMessage.Number) } |
|
|
|
|
|
}).ConfigureAwait(false); |
|
|
|
|
|
//批量插入负库存补货记录
|
|
|
//批量插入负库存补货记录
|
|
|
await context.BulkInsertAsync(vmiReplenishedList).ConfigureAwait(false); |
|
|
await context.BulkInsertAsync(vmiReplenishedList).ConfigureAwait(false); |
|
|
//批量插入库存余额
|
|
|
//批量插入库存余额
|
|
@ -250,6 +247,8 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
await context.BulkUpdateAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); |
|
|
await context.BulkUpdateAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); |
|
|
//批量删除库存余额
|
|
|
//批量删除库存余额
|
|
|
await context.BulkDeleteAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty == decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); |
|
|
await context.BulkDeleteAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty == decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); |
|
|
|
|
|
//批量删除消息
|
|
|
|
|
|
await context.BulkDeleteAsync(messages).ConfigureAwait(false); |
|
|
transaction.Commit(); |
|
|
transaction.Commit(); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
@ -262,6 +261,20 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
sw.Stop(); |
|
|
sw.Stop(); |
|
|
this._logger.LogInformation($"处理{fetchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒"); |
|
|
this._logger.LogInformation($"处理{fetchSize}条,耗时 {sw.ElapsedMilliseconds / 1000 / 60}分钟,{sw.ElapsedMilliseconds / 1000}秒"); |
|
|
} |
|
|
} |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
using var scope = serviceProvider.CreateScope(); |
|
|
|
|
|
using var connection2 = new SqlConnection(connectionString); |
|
|
|
|
|
connection2.Open(); |
|
|
|
|
|
var command = connection2.CreateCommand(); |
|
|
|
|
|
command.CommandText = "SELECT count(*) FROM Set_VmiMessage WITH(NOLOCK)"; |
|
|
|
|
|
var count = Convert.ToInt64(command.ExecuteScalar().ToString()); |
|
|
|
|
|
scope.ServiceProvider.GetService<IHubContext<PageHub>>().Clients.All.ServerToClient("VmiBalance", count.ToString(), ""); |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception) |
|
|
|
|
|
{ |
|
|
|
|
|
throw; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|