--[[
|
编码: WMS-108-11
|
名称:
|
作者:
|
日期: 2025-1-29
|
|
函数: DeleteInvalidLock
|
功能:
|
|
更改记录:
|
|
--]]
|
|
wms_task = require( "wms_task" )
|
|
function DeleteInvalidLock( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- step1 获取当前点中的任务
|
nRet, objs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end
|
-- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
|
local nCount = #objs
|
if (nCount == 0) then return end
|
|
local strJson
|
nRet, strJson = mobox.objAttrsToLuaJson( "Lock", lua.table2str(objs[1].attrs) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson Supplier 失败!"..strJson ) end
|
local success, lock
|
success, lock = pcall( json.decode, strJson )
|
if ( success == false ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson 返回的的JSON格式不合法!" )
|
end
|
local do_refrush = false
|
local task_code = lua.Get_StrAttrValue( lock.task_code )
|
if ( task_code ~= '' ) then
|
nRet, task = wms_task.GetInfo( strLuaDEID, task_code )
|
if ( nRet == 1 ) then
|
nRet, strRetInfo = wms.wms_UnlockByTask( strLuaDEID, task_code )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "解锁失败!"..strRetInfo ) end
|
do_refrush = true
|
end
|
end
|
|
if ( do_refrush ) then
|
local action = {
|
{
|
action_type = "refresh_cur_row",
|
value = ""
|
}
|
}
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end
|
end
|
end
|