This commit is contained in:
alex
2023-09-08 09:17:07 +08:00
3 changed files with 49 additions and 6 deletions

View File

@@ -19,6 +19,7 @@ using System.Reflection.Emit;
using JNPF.VisualDev.Entitys.Dto.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDev;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using Spire.Pdf.Lists; using Spire.Pdf.Lists;
using Aop.Api.Domain;
namespace Tnb.WarehouseMgr namespace Tnb.WarehouseMgr
{ {
@@ -58,7 +59,7 @@ namespace Tnb.WarehouseMgr
if (LCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位编号不可为空", 500); if (LCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位编号不可为空", 500);
var isType = d["is_type"]?.ToString() ?? string.Empty; var isType = d["is_type"]?.ToString() ?? string.Empty;
if (isType == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位类型不可为空", 500); if (isType == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位类型不可为空", 500);
var floor = d["floor"]? .ToString() ?? string.Empty; var floor = d["floor"]?.ToString() ?? string.Empty;
if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500); if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500);
var layers = d["layers"]?.ToString() ?? string.Empty; var layers = d["layers"]?.ToString() ?? string.Empty;
var locLine = d["loc_line"]?.ToString() ?? string.Empty; var locLine = d["loc_line"]?.ToString() ?? string.Empty;
@@ -100,7 +101,21 @@ namespace Tnb.WarehouseMgr
x.is_mix = 1; x.is_mix = 1;
x.is_use = "0"; x.is_use = "0";
}); });
row = await _db.Insertable(locs).ExecuteCommandAsync(); if (locs.Count > 1000)
{
await _db.Fastest<BasLocation>().BulkCopyAsync(locs);
}
else if (locs.Count > 400)
{
_db.Utilities.PageEach(locs, 100, async pageList => {
await _db.Insertable(pageList).ExecuteCommandAsync();
});
}
else
{
row = await _db.Insertable(locs).ExecuteCommandAsync();
}
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@@ -10,6 +10,7 @@ using JNPF.FriendlyException;
using JNPF.VisualDev; using JNPF.VisualDev;
using JNPF.VisualDev.Entitys.Dto.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDev;
using Mapster; using Mapster;
using NPOI.SS.Formula;
using SqlSugar; using SqlSugar;
using Tnb.BasicData.Entities; using Tnb.BasicData.Entities;
using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities;
@@ -80,6 +81,20 @@ namespace Tnb.WarehouseMgr
x.modify_id = null; x.modify_id = null;
x.modify_time = null; x.modify_time = null;
}); });
if (points.Count > 1000)
{
await _db.Fastest<WmsPointH>().BulkCopyAsync(points);
}
else if (points.Count > 400)
{
_db.Utilities.PageEach(points, 100, async pageList => {
await _db.Insertable(pageList).ExecuteCommandAsync();
});
}
else
{
row = await _db.Insertable(points).ExecuteCommandAsync();
}
row = await _db.Insertable(points).ExecuteCommandAsync(); row = await _db.Insertable(points).ExecuteCommandAsync();
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -112,7 +112,20 @@ namespace Tnb.WarehouseMgr
x.modify_time = null; x.modify_time = null;
}); });
} }
row = await _db.Insertable(roads).ExecuteCommandAsync(); if (roads.Count > 1000)
{
await _db.Fastest<WmsRoad>().BulkCopyAsync(roads);
}
else if (roads.Count > 400)
{
_db.Utilities.PageEach(roads, 100, async pageList => {
await _db.Insertable(pageList).ExecuteCommandAsync();
});
}
else
{
row = await _db.Insertable(roads).ExecuteCommandAsync();
}
} }
catch (Exception ex) catch (Exception ex)