lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
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
ÿþ--[[
    x: WMS-40-13
     Tðy: •ï‹Í‘n
    \O€ÿHAN    
    eQãSýQpeÿ ResetState
 
    ŸRý€ô‹f:
        Šb•ï‹¶r`¾‹n:NgbLˆ¶r`
    ôf9e°‹U_:
 
--]]
wms_cntr = require("wms_container")
wms_wh = require("wms_wh")
wms_op = require( "wms_operation" )
m3 = require( "oi_base_mobox" )
function ResetState ( strLuaDEID ) 
    local nRet, strRetInfo
    local objs
 
    -- step1  ·ƒÖSS_MR¹p-N„v\ON
    nRet, objs = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.lua.Error( strLuaDEID, debug.getinfo(1), objs ) end  
    -- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
    local nCount = #objs
    if (nCount == 0) then  return end
 
    local strObjJson
    local success    
    local operation = {}
    for n = 1, nCount do
        -- ÀhågN NN_B_STATE/f&T=3(•ï‹)
        nRet, strObjJson = mobox.objAttrsToLuaJson( "Operation", lua.table2str( objs[n].attrs ) )
        success, operation = pcall( json.decode, strObjJson )
        if ( success == false ) then lua.lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson (Operation) ÔÞV„v„vJSON<h_ NTÕl !"..operation ) end
        if ( operation.bs_state_name == "•ï‹") then
            -- Í‘°eû‹ÖSN N operation ^\'` ÿُ*N^\'`/fŒ[te„v ÿreset —‰Œ[te„v \ON ù[aŒ^\'`
            nRet, operation = wms_op.GetInfo(strLuaDEID, operation.code)
            if ( nRet ~=0 ) then lua.lua.Error( strLuaDEID, debug.getinfo(1), "ň}\ONù[aŒáOo`1Y%!" ) end 
            nRet, strRetInfo = wms_op.Reset( strLuaDEID, operation )
            if ( nRet ~= 0 ) then lua.lua.Error( strLuaDEID, debug.getinfo(1), "WMS_Operation_Reset1Y%! "..strRetInfo ) end
        end
    end
 
    -- ‚Yœg1\/fNLˆ7R°eS_MRLˆ
    if ( nCount == 1 ) then
        local strAction = '[{"action_type":"refresh_cur_row","value":""}]'
        nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
        if ( nRet ~= 0 ) then lua.lua.Error( strLuaDEID, debug.getinfo(1), "setAction•ï‹: "..strRetInfo) end     
    end  
end