Browse Source

更改寄售库导入类型判断方式

master
zhouhongjun 11 months ago
parent
commit
44ad4095c7
  1. 18
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

18
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAppService.cs

@ -638,17 +638,31 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
{
log.ChangedTime = log.Id.ToDateTime().Value.ToLocalTime();
if (log.ChangedQty >= decimal.Zero)
{
if(log.LogType != VmiLogType.Type100)
{
log.Qty = log.ChangedQty;
log.LogType = VmiLogType.Type500;
log.ChangedType = VmiType.In;
}
else
{
log.Qty = log.ChangedQty;
log.ChangedType = VmiType.In;
}
}
else
{
if(log.LogType != VmiLogType.Type100)
{
log.Qty = -log.Qty;
log.LogType = VmiLogType.Type600;
log.ChangedType = VmiType.Out;
}
}
log.ChangedBy = this._currentUser.UserName;
}
@ -796,7 +810,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
}
var logList = tupleList.Select(o => o.Item1).ToList();
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 options = new DbContextOptionsBuilder<SettleAccountDbContext>().UseSqlServer(connectionString).Options;
using var context = new SettleAccountDbContext(options);
@ -816,7 +830,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
await context.BulkInsertAsync(logList).ConfigureAwait(false);
await context.BulkInsertAsync(messageList).ConfigureAwait(false);
//await context.BulkInsertAsync(messageList).ConfigureAwait(false);
transaction.Commit();
}
catch (Exception ex)

Loading…
Cancel
Save