Jianw
2025-05-14 29f8b36ebb718d2051bf0e7e701973ec4419ee80
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
--[[
    编码: WMS-15-10
    名称: 收货单-主从面板-仓库变化后
    作者:HAN  
    日期:2025-1-29
 
    级别:项目 (说明本段代码在项目中需要变化)
    
    函数:AfterWHChange
 
    功能:
        - 根据新的仓库编号获取仓库下面的 收货区编码
    更改记录:
 
--]]
 
wms_wh = require( "wms_wh" )
 
function AfterWHChange ( strLuaDEID )
    local   nRet, strRetInfo
 
    -- 获取仓库编码
    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 = obj_attrs[1].value               -- 仓库编码
 
    -- 获取收货区
    local area_items = ''
    local area_code = ''
    nRet, area_items = wms_wh.GetArea( strLuaDEID, wh_code, wms_base.Get_nConst(strLuaDEID, "库区类型-收货区") )
    if ( nRet == 1 ) then area_code = lua.trim_quotation_mark( area_items ) end
 
    local setAttr = '[{"attr":"S_AREA_CODE","value":"'..area_code..'","choice_list":['..area_items..']}]'
    local strAction = '[{"action_type":"set_dlg_attr","value":'..setAttr..'}]'
    nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end         
end