1
Jianw
10 天以前 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
--[[
   编码: JX-01-30
   名称: 
   作者:
   日期:2025-04-14
 
   函数: CheckCellStatus
   功能:
 
   更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
wms_cntr = require("wms_container")
wms_op = require("wms_operation")
wms_task = require("wms_task")
jx_base = require("jx_base")
wms_wh = require("wms_wh")
 
function CheckCellStatus(strLuaDEID)
 
    local query_condition = " N_TYPE = 3"
    local nRet, strRetInfo = mobox.queryDataObjAttr2( strLuaDEID, "Container", query_condition, "", 500,  "S_CODE" )
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "查询Container!失败"..strRetInfo)
    end
 
    if (strRetInfo == '') then
        return
    end
    local queryInfo = json.decode(strRetInfo)
    local queryID = queryInfo.queryID
    local nPageCount = queryInfo.pageCount
 
    local nPage = 1
    local dataSet = queryInfo.dataSet
    local cell_array
    local item_code, cntr_code, cell_no
    local cell
 
    while (nPage <= nPageCount) do
            for n = 1, #dataSet do
                cell_array = m3.KeyValueAttrsToObjAttr(dataSet[n].attrs)
                cntr_code = cell_array.S_CODE
 
                local container
                nRet, container = wms_cntr.GetInfo( strLuaDEID, cntr_code )
                if (nRet ~= 0) then 
                    lua.Error( strLuaDEID, debug.getinfo(1), "获取【容器】信息失败! " .. container) 
                end        
 
                nRet, strRetInfo = wms_cntr.Reset( strLuaDEID, container )
                if ( nRet ~= 0 ) then 
                    lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) 
                end 
 
 
                
            end
    
            -- 翻到下一页
            nPage = nPage + 1
            if (nPage <= nPageCount) then
                -- 取下一页
                nRet, strRetInfo = mobox.queryDataObjAttr2(queryID, nPage)
                if (nRet ~= 0) then
                    lua.Error(strLuaDEID, debug.getinfo(1), "查询失败! nPage="..nPage.."  "..strRetInfo)
                end
                queryInfo = json.decode(strRetInfo)
                dataSet = queryInfo.dataSet
            end
    end
 
end