diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs index f5f38e38..a3551d1a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs @@ -62,15 +62,19 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); //更新任务执行状态 已取消 - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID}).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID }).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); //预任务取消 await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID }).Where(it => it.id == input.data[nameof(WmsDistaskH.pretask_id)].ToString()).ExecuteCommandAsync(); //载具解锁 - // await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); - //库位解锁 - //根据所有库位更新库位的锁定状态为“锁定” - // await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); - + await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0 }).Where(it => it.id == input.data[nameof(WmsDistaskH.carry_id)].ToString()).ExecuteCommandAsync(); + //所有库位解锁 + if (input.data.ContainsKey(nameof(WmsDistaskH.startlocation_id)) && input.data.ContainsKey(nameof(WmsDistaskH.endlocation_id))) + { + var ids = new[] { input.data[nameof(WmsDistaskH.startlocation_id)]?.ToString(), input.data[nameof(WmsDistaskH.endlocation_id)]?.ToString() }; + await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 0 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + } + + await _db.Ado.CommitTranAsync(); }