任务完成,代码调整将更新载具、载具条码改为批量更新
This commit is contained in:
@@ -499,18 +499,37 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
//更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位
|
||||
var multiList = disTasks.Select(it => (it.carry_id, it.endlocation_id, it.endlocation_code)).ToList();
|
||||
var locWhIdMap = await _db.Queryable<BasLocation>().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id);
|
||||
List<WmsCarryH> carryIts = new();
|
||||
List<WmsCarryCode> carryCodeIts = new();
|
||||
for (int i = 0; i < multiList.Count; i++)
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
//更新条码的库位和仓库信息
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.id == multiList[i].carry_id).ToListAsync();
|
||||
if (carryCodes?.Count > 0)
|
||||
WmsCarryH carry = new()
|
||||
{
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == multiList[i].endlocation_id);
|
||||
await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = loc.wh_id, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
id = multiList[i].carry_id,
|
||||
is_lock = 0,
|
||||
location_id = multiList[i].endlocation_id,
|
||||
location_code = multiList[i].endlocation_code
|
||||
};
|
||||
WmsCarryCode carryCode = new()
|
||||
{
|
||||
warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(),
|
||||
location_id = multiList[i].endlocation_id,
|
||||
location_code = multiList[i].endlocation_code
|
||||
};
|
||||
carryIts.Add(carry);
|
||||
carryCodeIts.Add(carryCode);
|
||||
|
||||
//await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { is_lock = 0, location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
////更新条码的库位和仓库信息
|
||||
//var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.id == multiList[i].carry_id).ToListAsync();
|
||||
//if (carryCodes?.Count > 0)
|
||||
//{
|
||||
// await _db.Updateable<WmsCarryCode>().SetColumns(it => new WmsCarryCode { warehouse_id = locWhIdMap[multiList[i].endlocation_id].ToString(), location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }).Where(it => it.id == multiList[i].carry_id).ExecuteCommandAsync();
|
||||
//}
|
||||
}
|
||||
await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
//更新库位信息,使用状态为 使用,锁定状态为未锁定
|
||||
var multis = disTasks.Select(it => (it.endlocation_id, it.carry_status)).ToList();
|
||||
for (int i = 0; i < multis.Count; i++)
|
||||
|
||||
Reference in New Issue
Block a user