Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
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
--[[
    编码: WMS-38-04
    名称: 任务-行按钮-重置
    作者:HAN  
    日期:2025-1-29
 
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: RestTaskState
 
    功能:
        设置任务状态,把错误状态设置为 等待
    更改记录:
 
--]]
wms_task = require( "wms_task" )
 
function RestTaskState ( 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
    if ( nCount > 1 ) then
        mobox.setInfo( strLuaDEID, "重置任务状态只能选一个任务!")
        return 
    end
 
    local obj_attrs = {}
 
    obj_attrs = m3.KeyValueAttrsToObjAttr( objs[1].attrs )
    -- 4 错误
    if ( obj_attrs.N_B_STATE = '4' ) then
        nRet, strRetInfo = wms_task.SetStateByCode( strLuaDEID, obj_attrs.S_CODE, "任务状态-等待")
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
        local strAction = '[{"action_type":"refresh_cur_row","value":""}]'
        nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end    
    end
 
end