Browse Source

添加发票生成中状态

master
wanggang 1 year ago
parent
commit
b925396322
  1. 1
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js
  2. 33
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

1
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/wwwroot/models/_options.js

@ -172,6 +172,7 @@ const invState = {
{ value: 7, label: "撤销扣减进行中" }, { value: 7, label: "撤销扣减进行中" },
{ value: 8, label: "已提交QAD" }, { value: 8, label: "已提交QAD" },
{ value: 9, label: "红冲" }, { value: 9, label: "红冲" },
{ value: 10, label: "生成发票中" },
], ],
}; };

33
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/VmiAsyncBalanceService.cs

@ -76,6 +76,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
var batchSize = 10000; var batchSize = 10000;
var fetchSize = 0; var fetchSize = 0;
var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService"); var connectionString = serviceProvider.GetRequiredService<IConfiguration>().GetConnectionString("SettleAccountService");
Dictionary<string, VmiBalance> balanceCachedList = null;
for (var i = 0; i < 1000; i++) for (var i = 0; i < 1000; i++)
{ {
//1:新建 2:更新 //1:新建 2:更新
@ -105,13 +106,15 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
break; break;
} }
//缓存余额表 //缓存余额表
sw.Stop(); var sw2 = new Stopwatch();
sw.Restart(); sw2.Start();
var balanceCachedList = vmiBalanceRepo.AsNoTracking() Func<VmiBalance, string> keySelector = o => $"{o.DeliverBillType}.{o.CodeType}.{o.RealPartCode}.{o.VinCode}.{o.ErpToLoc}.{o.OrderNum}.{o.factory}.{o.Configcode}";
.ToDictionary(o => $"{o.DeliverBillType}.{o.CodeType}.{o.RealPartCode}.{o.VinCode}.{o.ErpToLoc}.{o.OrderNum}.{o.factory}.{o.Configcode}"); //if (balanceCachedList == null)
sw.Stop(); //{
this._logger.LogInformation($"缓存结束:{balanceCachedList.Count}条,耗时 {sw.ElapsedMilliseconds / 1000} 秒,{sw.ElapsedMilliseconds} 豪秒"); balanceCachedList = vmiBalanceRepo.AsNoTracking().ToDictionary(keySelector);
sw.Restart(); //}
sw2.Stop();
this._logger.LogInformation($"缓存结束:{balanceCachedList.Count}条,耗时 {sw2.ElapsedMilliseconds / 1000} 秒,{sw2.ElapsedMilliseconds} 豪秒");
//设置数量为实际返回数量 //设置数量为实际返回数量
fetchSize = messages.Count; fetchSize = messages.Count;
//反序列化获取库存事务 //反序列化获取库存事务
@ -250,14 +253,24 @@ namespace Win.Sfs.SettleAccount.Entities.BQ
//批量插入负库存补货记录 //批量插入负库存补货记录
await context.BulkInsertAsync(vmiReplenishedList).ConfigureAwait(false); await context.BulkInsertAsync(vmiReplenishedList).ConfigureAwait(false);
//批量插入库存余额 //批量插入库存余额
await context.BulkInsertAsync(balanceList.Where(o => o.Item2 == 1 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); var addList = balanceList.Where(o => o.Item2 == 1 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList();
await context.BulkInsertAsync(addList).ConfigureAwait(false);
//批量更新库存余额 //批量更新库存余额
await context.BulkUpdateAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); var editList = balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty != decimal.Zero).Select(o => o.Item1).ToList();
await context.BulkUpdateAsync(editList).ConfigureAwait(false);
//批量删除库存余额 //批量删除库存余额
await context.BulkDeleteAsync(balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty == decimal.Zero).Select(o => o.Item1).ToList()).ConfigureAwait(false); var removeList = balanceList.Where(o => o.Item2 == 2 && o.Item1.Qty == decimal.Zero).Select(o => o.Item1).ToList();
await context.BulkDeleteAsync(removeList).ConfigureAwait(false);
//批量删除消息 //批量删除消息
await context.BulkDeleteAsync(messages).ConfigureAwait(false); await context.BulkDeleteAsync(messages).ConfigureAwait(false);
transaction.Commit(); transaction.Commit();
////更新余额缓存
//var sw3 = new Stopwatch();
//sw3.Start();
//addList.ForEach(o => balanceCachedList.Add(keySelector(o), o));
//removeList.ForEach(o => balanceCachedList.Remove(keySelector(o)));
//sw3.Stop();
//this._logger.LogInformation($"更新缓存:{balanceList.Count}条,耗时 {sw3.ElapsedMilliseconds / 1000} 秒,{sw3.ElapsedMilliseconds} 豪秒");
} }
catch (Exception ex) catch (Exception ex)
{ {

Loading…
Cancel
Save