wsz
2025-06-20 19898bd66dec87b500b200d5d50961d0fb538ce5
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
--[[
    编码: WMS-11-01
    名称: 货位容器绑定记录-创建前
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeDataObjCreate
 
    功能:
        1)获取 N_BINDING_METHOD, 根据字典获取这些值的说明
        2)获取 N_ACTION_TYPE, 根据字典获取这些值的说明
    更改记录:
 
--]]
 
wms_base = require( "wms_base" )
 
function BeforeDataObjCreate ( strLuaDEID ) 
    local   nRet, strRetInfo
 
    -- step1  获取当前货位绑定表的信息,获取 货位号,容器编号
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_BINDING_METHOD","N_ACTION_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local binding = lua.StrToNumber( obj_attrs[1].value )            -- 绑定方式
    local action_type = lua.StrToNumber( obj_attrs[2].value )        -- 绑定方式
 
    -- 根据字典获取 N_BINDING_METHOD 的显示名称
    local str_binding = wms_base.GetDictItemName( strLuaDEID, "WMS_LocCntrBindingMethod", binding ) 
 
    -- 根据字典获取 N_ACTION_TYPE 的显示名称
    local str_action_type = wms_base.GetDictItemName( strLuaDEID, "WMS_BingdingAction", action_type ) 
 
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_BINDING_METHOD", str_binding )
    attr_value[2] = lua.KeyValueObj( "S_ACTION_TYPE", str_action_type )
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【货位容器绑定记录】信息失败!  "..strRetInfo ) end   
end