Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
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
--[[
    编码: WMS-05-03
    名称: 逻辑库区-修改前
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeDataObjModify
 
    功能:
        设置 S_LOCK_STATE S_ZONE_TYPE 
    更改记录:
        
--]]
 
wms_base = require( "wms_base" )
 
function BeforeDataObjModify ( strLuaDEID ) 
    local   nRet, strRetInfo
    
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_LOCK_STATE", "N_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "[1] 获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local nLockState = lua.StrToNumber(obj_attrs[1].value)           -- 锁状态
    local nZoneType = lua.StrToNumber(obj_attrs[2].value)            -- 逻辑库区类型
 
    -- 根据字典获取 N_LOCK_STATE 的显示名称
    local str_lock_state = wms_base.GetDictItemName( strLuaDEID, "WMS_LocationLockState", nLockState ) 
 
    -- 根据字典获取 N_ZONE_TYPE 的显示名称
    local str_zone_type = wms_base.GetDictItemName( strLuaDEID, "WMS_AreaType", nZoneType ) 
 
    -- 设置信息
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_LOCK_STATE", str_lock_state )
    attr_value[2] = lua.KeyValueObj( "S_TYPE", str_zone_type )
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "[2] 设置【逻辑库区】信息失败!  "..strRetInfo ) end   
end