|
@ -626,17 +626,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
{ |
|
|
{ |
|
|
log.ChangedTime = log.Id.ToDateTime().Value.ToLocalTime(); |
|
|
log.ChangedTime = log.Id.ToDateTime().Value.ToLocalTime(); |
|
|
if (log.ChangedQty >= decimal.Zero) |
|
|
if (log.ChangedQty >= decimal.Zero) |
|
|
|
|
|
{ |
|
|
|
|
|
if(log.LogType != VmiLogType.Type100) |
|
|
{ |
|
|
{ |
|
|
log.Qty = log.ChangedQty; |
|
|
log.Qty = log.ChangedQty; |
|
|
log.LogType = VmiLogType.Type500; |
|
|
log.LogType = VmiLogType.Type500; |
|
|
log.ChangedType = VmiType.In; |
|
|
log.ChangedType = VmiType.In; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
log.Qty = log.ChangedQty; |
|
|
|
|
|
log.ChangedType = VmiType.In; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
if(log.LogType != VmiLogType.Type100) |
|
|
{ |
|
|
{ |
|
|
log.Qty = -log.Qty; |
|
|
log.Qty = -log.Qty; |
|
|
log.LogType = VmiLogType.Type600; |
|
|
log.LogType = VmiLogType.Type600; |
|
|
log.ChangedType = VmiType.Out; |
|
|
log.ChangedType = VmiType.Out; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
log.ChangedBy = this._currentUser.UserName; |
|
|
log.ChangedBy = this._currentUser.UserName; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -763,6 +777,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); |
|
|
await file.OpenReadStream().CopyToAsync(ms).ConfigureAwait(false); |
|
|
var data = ms.ToArray(); |
|
|
var data = ms.ToArray(); |
|
|
var tupleList = this.ImportInternal<VmiLog>(data); |
|
|
var tupleList = this.ImportInternal<VmiLog>(data); |
|
|
|
|
|
|
|
|
if (tupleList.Any(o => o.Item2.Count > 0)) |
|
|
if (tupleList.Any(o => o.Item2.Count > 0)) |
|
|
{ |
|
|
{ |
|
|
using var workbook = new XLWorkbook(new MemoryStream(data)); |
|
|
using var workbook = new XLWorkbook(new MemoryStream(data)); |
|
@ -784,7 +799,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
} |
|
|
} |
|
|
var logList = tupleList.Select(o => o.Item1).ToList(); |
|
|
var logList = tupleList.Select(o => o.Item1).ToList(); |
|
|
logList.AsParallel().ForEach(Update); |
|
|
logList.AsParallel().ForEach(Update); |
|
|
var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList(); |
|
|
//var messageList = logList.Select(log => new VmiMessage { Message = JsonSerializer.Serialize(log) }).ToList();
|
|
|
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); |
|
|
var connectionString = this._serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); |
|
|
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; |
|
|
var options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options; |
|
|
using var context = new SettleAccountDbContext(options); |
|
|
using var context = new SettleAccountDbContext(options); |
|
@ -804,7 +819,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await context.BulkInsertAsync(logList).ConfigureAwait(false); |
|
|
await context.BulkInsertAsync(logList).ConfigureAwait(false); |
|
|
await context.BulkInsertAsync(messageList).ConfigureAwait(false); |
|
|
//await context.BulkInsertAsync(messageList).ConfigureAwait(false);
|
|
|
transaction.Commit(); |
|
|
transaction.Commit(); |
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|