fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--[[
    编码: WMS-01-16
    名称: 容器-重置空满状态
    作者:HAN  
    日期:2025-01-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: UnlockContainer
 
    功能:
        容器解锁
 
    更改记录:
        V2.0 HAN 20241112 
             wms_UnlockCntr 函数加参数
 
--]]
jx_base = require( "jx_base" )
 
function UnlockContainer ( 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( "Container", lua.table2str(objs[1].attrs) )
    if ( nRet ~= 0  ) then lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson Supplier 失败!"..strJson ) end
    local cntr
    success, cntr = pcall( json.decode, strJson )
    if ( success == false ) then
        lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson 返回的的JSON格式不合法!" )
    end
 
    --解锁容器
    nRet, strRetInfo = wms.wms_UnlockCntr( strLuaDEID, cntr.code )
    if ( nRet ~= 0 ) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "解锁容器'"..cntr.code.."'失败!"..strRetInfo )
    end
 
    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