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
ÿþ--[[
   x: GT-23-16
    Tðy: š[öegbLˆ
   \O€ÿLZH
   åegÿ2024-10-29
 
   ýQpeÿ Execute
   ŸRý€:
        10ù[(u7b(W0Øpö€ô~¤b0u˜b—ô~¤b„vù[”^ir™e„vïS(u)Ype$R­e ÿ‚Yœg <=4R®öN„˜f‹Rú^NagØpö€¡[8h•ï‹°‹U_                                                                                                                 
        20ù[(u7b(W0Øpö€ô~¤b0u˜b—ô~¤b„v'Y{|åNÊS'Y{|ù[”^„vÔk‹O ÿŒT708÷]S„v“^X[`SÔkøvÔkƒ ÿ‚YœgNOŽNô~¤b„vÔk‹O                                                                                                                
        R—‰ÎN1~6÷]S\'Y{| Nô~¤b„vir™eûy“^0R708÷]S0                                                                                                                
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function Execute(strLuaDEID)
    -- Ru˜·ƒÖSØpö€ô~¤bpenc
    local strCondition = "S_ITEM_CODE = S_ITEM_CODE"
    local nRet, glue_drying = mobox.queryDataObjAttr2(strLuaDEID, "GT_Glue_Drying", strCondition, "", 100, "S_ITEM_CODE",
        "N_QTY", "N_DAY_QTY")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹0Øpö€ô~¤b0á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˜·ƒÖSØpö€ô~¤b„vpenc
    for i = 1, nPageCount do
        for j = 1, #dataSet do
            local attrs = m3.KeyValueAttrsToObjAttr(dataSet[j].attrs)
            local item_code = attrs.S_ITEM_CODE       -- ir™ex
            local qty = tonumber(attrs.N_QTY)         -- “^X[ϑ
            local day_qty = tonumber(attrs.N_DAY_QTY) -- åe(uϑ
 
            -- ¡‹—{ïS(u)Ype ïS(u)Ype=“^X[ϑ/åe(uϑ
            local days_available = qty / day_qty
            lua.Debug(strLuaDEID, debug.getinfo(1), item_code..'ïS(u)Ype:', days_available)
            -- ïS(u)Ype <= 4 R
            if (days_available <= 4) then
                -- ÑS®±{„˜f‹(‚föe¡l_)
                -- îO9eØpö€ô~¤bù[”^ir™e„v“^X[ϑ
                local strSetSQL_update, strRetInfo
                strCondition = "S_ITEM_CODE = '" .. item_code .. "'"
                strSetSQL_update = " S_EXPLAIN = 'ïS(u)Ypeò] N³4)Y!',T_MODIFY = SYSDATE"
                nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Glue_Drying", strCondition,
                    strSetSQL_update)
                if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9eØpö€ô~¤b1Y%!" .. strRetInfo) end
            end
        end
        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