--[[
|
编码: WMS-90-11#2
|
名称: 查询-带料格
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: Query
|
|
功能:
|
根据查询面板里的输入,组成SQL的查询条件
|
适配界面:
|
自定义表单: 查询条件输入-带适配料格
|
更改记录:
|
|
--]]
|
|
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 )
|
local item_code = lua.Get_StrAttrValue( parameter.S_ITEM_CODE )
|
local item_name = lua.Get_StrAttrValue( parameter.S_ITEM_NAME )
|
local cell_type = lua.Get_StrAttrValue( parameter.S_CELL_TYPE )
|
local strSQL = ''
|
|
if ( item_code ~= '' ) then
|
strSQL = "S_ITEM_CODE like '%"..item_code.."%'"
|
end
|
if ( item_name ~= '' ) then
|
if ( strSQL ~= '' ) then
|
strSQL = strSQL.." AND "
|
end
|
strSQL = strSQL.."S_ITEM_NAME like '%"..item_name.."%'"
|
end
|
|
if ( cell_type ~= '' ) then
|
if ( strSQL ~= '' ) then
|
strSQL = strSQL.." AND "
|
end
|
strSQL = strSQL.."S_CELL_TYPE = '"..cell_type.."'"
|
end
|
|
-- 设置查询条件
|
local action =
|
{
|
{
|
action_type = "set_query_condition",
|
value = {
|
condition = strSQL,
|
order = "S_ITEM_CODE"
|
}
|
}
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action ) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end
|
|
end
|