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
--[[
    编码: WMS-61-22
    名称: 机台关联区-新增小窗口--选库区后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterSelect
 
    功能:
        在货品查询面板中选中一个货品后
 
    更改记录:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AfterSelect ( strLuaDEID )
    local nRet, strRetInfo, select_dataobj
 
    local data_json
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if (nRet ~= 0) then 
        lua.Stop( strLuaDEID, data_json ) 
        return
    end
    if lua.isTableEmpty( data_json ) then return end 
    local obj_attrs = m3.KeyValueAttrsToObjAttr( data_json.attrs )
    if ( volume == 0 ) then 
        lua.Stop( strLuaDEID, "选中的物料体积为0! " ) 
        return
    end
 
    -- 获取仓库编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_LA_TYPE" ) 
    if ( nRet ~= 0 )  then 
        lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo ) 
        return
    end 
    local attrs = json.decode( strRetInfo ) 
    local link_obj_type = lua.Get_NumAttrValue( attrs[1].value )    
 
    local action = {}
 
    if link_obj_type == 0 then
        action = {
                    {
                        action_type = "set_dlg_attr",
                        value = {
                                    { attr = "S_LA_CODE", value = obj_attrs.S_CODE },
                                    { attr = "S_LA_NAME", value = obj_attrs.S_NAME }
                                }
                    }
        }
    end
 
    if not lua.isTableEmpty( action ) then
        nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
        if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
    end  
end