--[[
|
编码: WMS-07-04
|
名称: 常量-查询面板-查询
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: Query
|
|
功能:
|
根据查询面板里的输入,组成SQL的查询条件
|
更改记录:
|
V6.0 HAN 2023/9/6 -- lua.Error/lua.Debug 函数变化
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function Query ( strLuaDEID )
|
local nRet, strRetInfo
|
local parameter = {}
|
local attrs
|
-- 获取查询面板里的输入属性
|
nRet, attrs = m3.GetSysInputParameter( strLuaDEID )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetSysInputParameter 失败! "..attrs ) end
|
parameter = m3.KeyValueAttrsToObjAttr( attrs )
|
lua.Debug( strLuaDEID, debug.getinfo(1), "parameter", lua.table2str(parameter) )
|
|
local group = lua.Get_StrAttrValue( parameter.S_GROUP ) -- 分组名称
|
local name = lua.Get_StrAttrValue( parameter.S_NAME ) -- 常量名称
|
local is_sys = lua.Get_StrAttrValue( parameter.IsSys ) -- 是否是系统
|
local strSQL = ''
|
|
if ( is_sys == "系统" ) then
|
is_sys = 'Y'
|
else
|
is_sys = 'N'
|
end
|
|
if (group ~= '') then
|
strSQL = "S_GROUP = '"..group.."'"
|
end
|
if (name ~= '' ) then
|
if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end
|
strSQL = strSQL.."S_NAME like '%%"..name.."%%'"
|
end
|
if (is_sys ~= '' ) then
|
if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end
|
strSQL = strSQL.."C_SYS = '"..is_sys.."'"
|
end
|
|
if (strSQL == '') then return end
|
|
lua.DebugEx( strLuaDEID, "strSQL", strSQL )
|
|
-- 设置查询面板
|
local setAttr = '{"condition":"'..strSQL..'","order":"S_NAME"}'
|
local strAction = '[{"action_type":"set_query_condition","value":'..setAttr..'}]'
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end
|
|
end
|