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
ÿþ--[[
   x: GT-17-12
    Tðy: åg⋋NöN
   \O€ÿLZH
   åegÿ2024/8/27
 
   ýQpeÿ Query
   ŸRý€:
 
   \O€:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function Query(strLuaDEID)
    -- ·ƒÖSågâ‹b—g̑„v“eQ^\'`
    local nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetSysInputParameter 1Y%! " .. attrs) end
 
    local strSQL = ''
    if (attrs == '') then
        strSQL = ''
    else
        local obj_attr = m3.KeyValueAttrsToObjAttr(attrs)
        if (obj_attr ~= nil) then
            local type = obj_attr.S_TYPE       -- ir™e{|‹W
            local sub_type = obj_attr.S_SUB_TYPE -- -N{|
            local start_date = obj_attr.START_DATE -- _ËYöeô•
            local end_date = obj_attr.END_DATE -- Ó~_göeô•
            
            strSQL = 'S_TYPE = S_TYPE'
            if(type ~= nil and type ~= '') then
                strSQL = strSQL .. " AND S_TYPE = '"..type.."'"
            end
 
            if(sub_type ~= nil and sub_type ~= '') then
                strSQL = strSQL .. " AND S_SUB_TYPE = '"..sub_type.."'"
            end
 
            if(start_date ~= nil and start_date ~= '') then
                strSQL = strSQL.. " AND T_CREATE >= '"..start_date.."'"
            end
 
            if(end_date ~= nil and end_date ~= '') then
                strSQL = strSQL .. " AND T_CREATE <= '"..end_date.."'"
            end
        end
    end
 
    lua.Debug(strLuaDEID, debug.getinfo(1),"strSQL",strSQL)
    -- ¾‹någâ‹b—g
    local setAttr = '{"condition":"'..strSQL..'","order":"T_CREATE"}'
    local strAction = '[{"action_type":"set_query_condition","value":'..setAttr..'}]'
    local strRetInfo
    nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction1Y%! "..strRetInfo..' action = '..strAction ) end 
 
end