--[[
|
编码: JX-24-21
|
名称: 出库单-查询面板-查询
|
作者:HAN
|
日期:2025-02-10
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: InputChg
|
|
功能:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
lua = require ("oi_base_func")
|
|
function InputChg ( strLuaDEID )
|
local nRet, strRetInfo
|
local parameter = {}
|
local attrs
|
|
-- 获取运行时参数
|
local runtime_parameter
|
nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
|
if ( nRet ~= 0 ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter )
|
end
|
lua.Debug(strLuaDEID, debug.getinfo(1), "runtime_parameter", runtime_parameter)
|
local strSQL = lua.Get_StrAttrValue(runtime_parameter.base_condition)
|
|
-- 获取查询面板里的输入属性
|
nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
|
if ( nRet ~= 0 ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "GetSysInputParameter失败! "..attrs )
|
end
|
parameter = m3.KeyValueAttrsToObjAttr(attrs)
|
local no = lua.Get_StrAttrValue(parameter.S_NO) -- 出库单号
|
local b_state = lua.Get_StrAttrValue(parameter.N_B_STATE) -- 业务状态
|
local bs_type = lua.Get_StrAttrValue(parameter.S_BS_TYPE) -- 来源类型
|
|
|
-- 生成出库单号查询条件
|
if ( no ~= '' ) then
|
if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end
|
strSQL = strSQL.."S_NO = '"..no.."'"
|
end
|
|
|
-- 生成业务状态查询条件
|
sub_condition = ''
|
if ( b_state == '未配货') then
|
sub_condition = "N_B_STATE = 0"
|
elseif ( b_state == '已配货') then
|
sub_condition = "N_B_STATE = 1"
|
elseif ( b_state == '配货完成') then
|
sub_condition = "N_B_STATE = 2"
|
elseif ( b_state == '作业中') then
|
sub_condition = "N_B_STATE = 3"
|
elseif ( b_state == '出库完成') then
|
sub_condition = "N_B_STATE = 4"
|
end
|
if ( sub_condition ~= '' ) then
|
if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end
|
strSQL = strSQL..sub_condition
|
end
|
|
-- 生成来源类型查询条件
|
sub_condition = ''
|
if ( bs_type == '出库单') then
|
sub_condition = "S_BS_TYPE = '出库单'"
|
elseif ( bs_type == '分拣单') then
|
sub_condition = "S_BS_TYPE = '分拣单'"
|
end
|
if ( sub_condition ~= '' ) then
|
if ( strSQL ~= '' ) then strSQL = strSQL.." AND " end
|
strSQL = strSQL..sub_condition
|
end
|
|
-- 设置查询条件
|
local action = {}
|
action[1] = {
|
action_type = "set_query_condition",
|
value = {
|
condition = strSQL,
|
order = "S_NO DESC"
|
}
|
}
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if ( nRet ~= 0 ) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo)
|
end
|
end
|