1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--[[
    编码: 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