调整获取随机数方式

This commit is contained in:
yang.lee
2023-11-14 15:21:18 +08:00
parent cd7d12a301
commit 3f6deb4204
4 changed files with 18 additions and 19 deletions

View File

@@ -114,7 +114,7 @@ namespace Tnb.WarehouseMgr
List<string?> freeLocIds = fLocIds.Except(minTaskNumLocs.Select(x => x.endlocation_id)).ToList();
if (freeLocIds?.Count > 0)
{
int rIdx = new Random().Next(0, freeLocIds.Count);
int rIdx = Random.Shared.Next(0, freeLocIds.Count);
loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == freeLocIds[rIdx]);
}
else
@@ -125,7 +125,7 @@ namespace Tnb.WarehouseMgr
}
else if (minTaskNumLocs?.Count < 1)
{
int rIdx = new Random().Next(0, fLocIds.Count);
int rIdx = Random.Shared.Next(0, fLocIds.Count);
loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == fLocIds[rIdx]);
}
input.data[nameof(WmsOutstockH.location_id)] = loc.id;