--[[
|
编码: WMS-69-05
|
名称: 站台亮点处理-库区变化
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: AreaChg
|
|
功能:
|
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function AreaChg( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 获取站台编码
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "Station","AreaType" )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo )
|
return
|
end
|
local obj_attrs = json.decode( strRetInfo )
|
local station = lua.Get_StrAttrValue( obj_attrs[1].value )
|
local area_type = lua.Get_StrAttrValue( obj_attrs[2].value )
|
if ( station == '' or area_type == '' ) then return end
|
|
local station_data
|
nRet, station_data = m3.GetDataFromCache( "Machine_Station", station )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "获取站台信息失败! "..station_data )
|
return
|
end
|
|
local area_code
|
if area_type == "接驳区" then
|
area_code = station_data.S_TP_AREA
|
else
|
area_code = station_data.S_SW_AREA
|
end
|
if lua.StrIsEmpty( area_code ) then
|
lua.Stop( strLuaDEID, "站台配置信息不完整! " )
|
return
|
end
|
|
local loc_objs, obj_attrs
|
|
local strCondition = "S_AREA_CODE = '"..area_code.."'"
|
nRet, loc_objs = m3.QueryDataObject( strLuaDEID, "Location", strCondition, "S_CODE" )
|
if nRet ~= 0 then
|
lua.Stop( strLuaDEID, "获取【Location】信息失败! " .. loc_objs )
|
return
|
end
|
|
local loc_list = {}
|
for _, obj in ipairs( loc_objs ) do
|
obj_attrs = m3.KeyValueAttrsToObjAttr(obj.attrs)
|
table.insert( loc_list, obj_attrs.S_CODE )
|
end
|
|
local action = {
|
{
|
action_type = "set_dlg_attr",
|
value = {
|
{ attr = "Location", value = "", choice_list = loc_list }
|
}
|
}
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, json.encode(action) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo )
|
return
|
end
|
|
end
|