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
40
41
42
43
44
45
46
47
48
49
50
--[[
    编码: WMS-05-06
    名称: 逻辑库区-初始化小窗口
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: InitialDlg
 
    功能:
        1)在5505 功能点(逻辑库区维护)中新增逻辑库区,需要把当前操作的仓库和库区信息带人到Zone的相关信息中
        2)在 5505 点击新增的时候,前端会把当前的仓库编码、库区编码作为全局变量 传入,格式如下;
           {"wh_code":"xxx","area_code":"xxxx"}
    更改记录:
--]]
wms_base = require ("wms_base")
 
function InitialDlg ( strLuaDEID ) 
    local nRet, strRetInfo
    local global_attrs
    nRet,  global_attrs = m3.GetSysGloablAttr( strLuaDEID )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), global_attrs ) end 
 
    local wh_code = global_attrs.wh_code
    if ( wh_code == nil or wh_code == '' ) then lua.Error( strLuaDEID, debug.getinfo(1), "仓库编码不能为空!" ) end 
    local area_code = global_attrs.area_code
    if ( area_code == nil or area_code == '' ) then lua.Error( strLuaDEID, debug.getinfo(1), "库区编码不能为空!" ) end 
 
    -- 获取当前的逻辑库区类型
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
 
 
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_WH_CODE", wh_code )
    attr_value[2] = lua.KeyValueObj( "S_AREA_CODE", area_code )
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1),"设置【逻辑库区】信息失败!  "..strRetInfo ) end
    
    -- 如果不是接驳类型的逻辑库区,不显示 N_CONNECT_TYPE
    local nType = obj_attrs[1].value                         -- 逻辑库区类型
    if ( nType ~= wms_base.Get_nConst(strLuaDEID, "逻辑库区类型-接驳") )  then -- 接驳类型
        local strAction = '[{"action_type":"set_dlg_attr_show","value":[{"attr":"N_CONNECT_TYPE","show":false}]}]'
        nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction  )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
    end
 
end