调整获取随机数方式

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

@@ -290,7 +290,7 @@ namespace Tnb.WarehouseMgr
[HttpGet]
public async Task<dynamic> GetTaskDetailByCheckType([FromQuery] CheckDetailQuery input)
{
if(_carryMap.Count == 0)
if (_carryMap.Count == 0)
{
_carryMap = await _db.Queryable<WmsCarryH>().ToDictionaryAsync(x => x.id, x => x.carry_code);
}
@@ -299,28 +299,26 @@ namespace Tnb.WarehouseMgr
.And((a, b, c) => a.wh_id == input.warehouse_id)
.And((a, b, c) => a.is_type == ((int)EnumLocationType.).ToString())
.And((a, b, c) => c.is_lock == 0);
switch (input.CheckType)
filterExpable = input.CheckType switch
{
case EnumCheckType.:
filterExpable.AndIF(!string.IsNullOrEmpty(input.material_id), (a, b, c) => b.material_id == input.material_id);
break;
case EnumCheckType.:
filterExpable.AndIF(input.regionIds?.Count> 0, (a, b, c) => input.regionIds.Contains(a.region_id));
break;
}
EnumCheckType. => filterExpable.AndIF(!string.IsNullOrEmpty(input.material_id), (a, b, c) => b.material_id == input.material_id),
EnumCheckType. => filterExpable.AndIF(input.regionIds?.Count > 0, (a, b, c) => input.regionIds.Contains(a.region_id)),
_ => filterExpable,
};
var carryCodes = await _db.Queryable<BasLocation>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.location_id)
.InnerJoin<WmsCarryH>((a, b, c) => b.carry_id == c.id)
.Where(filterExpable.ToExpression())
.Select<WmsCarryCode>()
.ToListAsync();
List<CheckTaskDetailOutput> outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new CheckTaskDetailOutput
List<WmsCheckstockD> outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new WmsCheckstockD
{
material_code = x.Key.material_code,
code_batch = x.Key.code_batch,
location_code = x.Key.location_code,
carry_id = x.Key.carry_id,
carry_code = _carryMap[x.Key.carry_id]?.ToString() ?? string.Empty,
location_id = x.FirstOrDefault(y => y.location_code == x.Key.location_code)?.location_id ?? string.Empty,
location_code = x.Key.location_code,
pr_qty = x.Sum(d => d.codeqty),
closing_status = WmsWareHouseConst.CLOSINGSTATUS_WJS_ID,
qty = 0,