|
@ -208,26 +208,46 @@ public class PendingDeductionService : ApplicationService, ITransientDependency, |
|
|
// 执行批量数据操作
|
|
|
// 执行批量数据操作
|
|
|
if (ls != null && ls.Count > 0) |
|
|
if (ls != null && ls.Count > 0) |
|
|
{ |
|
|
{ |
|
|
var count = CalculatePageCount(ls.Count, 2000); |
|
|
|
|
|
for (int pagenumber = 0; pagenumber < count; pagenumber++) |
|
|
|
|
|
|
|
|
var messagelist = new List<VmiMessage>(); |
|
|
|
|
|
|
|
|
|
|
|
_dbcontext.BulkInsert(ls); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in ls) |
|
|
{ |
|
|
{ |
|
|
var lst = GetPagedData(ls, pagenumber++, 2000); |
|
|
var message = new VmiMessage |
|
|
var messagelist= new List<VmiMessage>(); |
|
|
|
|
|
foreach (var item in lst) |
|
|
|
|
|
{ |
|
|
{ |
|
|
var message = new VmiMessage |
|
|
Message = System.Text.Json.JsonSerializer.Serialize(item), |
|
|
{ |
|
|
}; |
|
|
Message = System.Text.Json.JsonSerializer.Serialize(item), |
|
|
messagelist.Add(message); |
|
|
}; |
|
|
|
|
|
messagelist.Add(message); |
|
|
|
|
|
} |
|
|
|
|
|
_dbcontext.BulkInsert(messagelist); |
|
|
|
|
|
_dbcontext.BulkInsert(lst,new BulkConfig() { }); |
|
|
|
|
|
Task.Delay(500); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_dbcontext.BulkInsert(messagelist); |
|
|
|
|
|
_dbcontext.BulkInsert(ls,new BulkConfig() { }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var count = CalculatePageCount(ls.Count, 2000);
|
|
|
|
|
|
//for (int pagenumber = 0; pagenumber < count; pagenumber++)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// var lst = GetPagedData(ls, pagenumber++, 2000);
|
|
|
|
|
|
// var messagelist= new List<VmiMessage>();
|
|
|
|
|
|
// foreach (var item in lst)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var message = new VmiMessage
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Message = System.Text.Json.JsonSerializer.Serialize(item),
|
|
|
|
|
|
// };
|
|
|
|
|
|
// messagelist.Add(message);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// _dbcontext.BulkInsert(messagelist);
|
|
|
|
|
|
// _dbcontext.BulkInsert(lst,new BulkConfig() { });
|
|
|
|
|
|
// Task.Delay(500);
|
|
|
|
|
|
//}
|
|
|
} |
|
|
} |
|
|
// 提交事务
|
|
|
// 提交事务
|
|
|
transaction.Commit(); |
|
|
transaction.Commit(); |
|
|
} |
|
|
} |
|
|
catch (Exception) |
|
|
catch (Exception) |
|
|
{ |
|
|
{ |
|
|