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
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
ÿþ--[[
   x: GT-27-15
    Tðy: $R­e/f&T—‰Œèb¡[8h
   \O€ÿLZH
   åegÿ2024-12-19
 
   ýQpeÿ IsAllotAudit
   ŸRý€:  Çô~¤b„vir™eåNÊS NP–$R­eù[”^“^:S„v
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
function IsAllotAudit(strLuaDEID)
    -- Ru˜·ƒÖS‰|™eŒèb3u÷‹USpenc
    local strCondition = "S_STATE = '‘'"
    local nRet, glue_drying = mobox.queryDataObjAttr2(strLuaDEID, "GT_Allot_Order", strCondition, "", 100, "S_ITEM_CODE",
        "S_AREA_CODE", "N_ALLOT_QTY", "S_LEVEL", "T_START", "T_END","N_FLOOR_QTY")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹0‰|™eŒèb3u÷‹US0áOo`1Y%!" .. glue_drying) end
    if (glue_drying == nil or glue_drying == '') then return end
    local queryInfo = json.decode(glue_drying)
    local nPageCount = queryInfo.pageCount
    local dataSet = queryInfo.dataSet
    local queryID = queryInfo.queryID
    lua.Debug(strLuaDEID, debug.getinfo(1), 'queryInfo', queryInfo)
 
    -- Ru˜·ƒÖSpenc
    for i = 1, nPageCount do
        for j = 1, #dataSet do
            local attrs = m3.KeyValueAttrsToObjAttr(dataSet[j].attrs)
            if (attrs == nil or attrs == '') then goto coroutine end
            -- ·ƒÖSpenc
            local item_code = attrs.S_ITEM_CODE  -- ir™ex
            local area_code = attrs.S_AREA_CODE  -- “^:Sx
            local allot_qty = attrs.N_ALLOT_QTY  -- ûy“^Xbpe
            local level = attrs.S_LEVEL          -- eˆ'§~+R
            local floor_qty = attrs.N_FLOOR_QTY    -- ‰[hQ NP–
            local start_time = attrs.T_START     -- _ËYeˆ'öeô•
            local end_time = attrs.T_END         -- Ó~_geˆ'öeô•
 
            -- ·ƒÖSù[”^“^:Sir™e„v“^X[Xbpe
            local item_qty
            strCondition = "S_LOC_CODE IN (SELECT S_CODE FROM TN_Location WHERE N_LOCK_STATE = 0 AND S_AREA_CODE = '"..area_code.."') AND "
            strCondition = strCondition.."S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_CG_Detail WHERE S_ITEM_CODE = '"..item_code.."')"
            nRet, item_qty = mobox.getDataObjCount(strLuaDEID, "Loc_Container", strCondition)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1),item_qty) end
 
            -- S_XbpeNOŽN NP–öeîO9e¶r`:N¡[8h
            if(tonumber(item_qty) <= tonumber(floor_qty)) then
                -- îO9e3u÷‹US¶r`:N¡[8h
                local strSetSQL_update, strRetInfo
                strCondition = "S_ITEM_CODE = '" .. item_code .. "' AND S_AREA_CODE = '"..area_code.."'"
                strSetSQL_update = " S_STATE = '¡[8h'"
                nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Allot_Order", strCondition,
                    strSetSQL_update)
                if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eØpö€ô~¤b1Y%!" .. strRetInfo) end
            end
 
            ::coroutine::
        end
 
        -- Ru˜·ƒÖS NNu˜
        if ((i + 1) <= nPageCount) then
            -- ÖS NNu˜
            local data
            nRet, data = mobox.queryDataObjAttr2(queryID, (i + 1))
            if (nRet ~= 0) then
                lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹0“^:Sϑhˆ01Y%! nPage=" .. i + 1 .. "  " .. data)
            end
            data = json.decode(data)
            dataSet = data.dataSet
        end
    end
end