fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
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
--[[
    编码: WMS-09-14
    名称: 锁-仓库变化后
    作者:HAN  
    日期:2025-3-06
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterWareahouseChg
 
    功能:
          根据出库类型不同 设置显示不显示一些控件
 
    更改记录:
   
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AfterWareahouseChg ( strLuaDEID ) 
    local nRet, strRetInfo, n
 
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_WH_CODE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    
    local wh_code = lua.Get_StrAttrValue( obj_attrs[1].value )
 
    local strCondition = "S_WH_CODE = '"..wh_code.."'"
    local strOrder = "S_CODE"
    local area_choice_items = {}
 
    nRet, strRetInfo = mobox.queryDataObjAttr(strLuaDEID, "Area", strCondition, strOrder,"S_CODE" )
    if (nRet ~= 0) then lua.Error( "获取【库区】信息失败! " .. strRetInfo) end
    if ( strRetInfo ~= '' ) then
        local area = {}
        success, area = pcall( json.decode, strRetInfo)
        if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【库区】信息失败! 非法的JSON格式!"..area ) end
        for n = 1, #area do
            attrs = area[n].attrs
            area_choice_items[n] = attrs[1].value
        end
    end
    local action = {
        {
            action_type = "set_dlg_attr",
            value = {
                { attr = "S_AREA_CODE", value = "", choice_list = area_choice_items }
            }
         }    
    }
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
end