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
--[[
    编码: WMS-04-14
    名称: 查询面板-巷道变化后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AisleChange
 
    功能:
 
        需要设置 巷道、排下拉列表
 
    更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AisleChange( strLuaDEID )
    local nRet, strRetInfo
    local parameter = {}
    local attrs
 
    -- 获取查询面板里的输入的仓库编码属性
    nRet, parameter = m3.GetSysInputParameter( strLuaDEID ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "m3.GetSysInputParameter 失败! "..attrs ) end 
 
    attrs = m3.KeyValueAttrsToObjAttr( parameter )
    local aisle = lua.Get_NumAttrValue( attrs.Aisle ) 
    local area_code = lua.Get_StrAttrValue( attrs.S_AREA_CODE ) 
 
    if ( aisle == 0 ) then return end
    -- 查询货位里的巷道库区编码
    
    local strCondition
    local strOrder = 'N_ROW'
    
    strCondition = "S_AREA_CODE = '"..area_code.."' AND N_AISLE = "..aisle
    nRet, strRetInfo = mobox.groupDataObjAttr( strLuaDEID, "Location", strCondition, "N_ROW", strOrder )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "无法从【货位】中获取信息!"..strRetInfo ) end 
 
    local groups = json.decode( strRetInfo ) 
    local n
    local row_choice_items = {}
    for n = 1, #groups do
        table.insert( row_choice_items, groups[n].value )
    end
 
    local value = {}
    if ( #groups == 0 ) then
        value = {
            {attr = "Row", value = ""}
        }
    else
        value = {
            { attr = "Row", value = "", choice_list = row_choice_items }
        }        
    end
 
    local action = {
        {
            action_type = "set_dlg_attr",
            value = value
        },
        {
            action_type = "click_query_button",
            value = ""
        }
    }
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action )  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
end