--[[
|
编码: WMS-12-01
|
名称: 任务动作-创建前
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: BeforeDataObjCreate
|
|
功能:
|
1)获取 N_ACTION_CODE 根据字典获取这些动作码的说明
|
更改记录:
|
|
--]]
|
wms_base = require( "wms_base" )
|
|
function BeforeDataObjCreate ( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- step1 获取当前任务动作的动作码和动作名称
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_ACTION_CODE", "S_ACTION" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end
|
local obj_attrs = json.decode( strRetInfo )
|
local action_code = lua.StrToNumber( obj_attrs[1].value ) -- 动作码
|
local action = obj_attrs[2].value
|
|
-- 如果动作码为空
|
if ( action == '') then
|
-- 根据字典获取 S_ACTION
|
action = wms_base.GetDictItemName( strLuaDEID, "WMS_EquipmentAction", action_code )
|
end
|
|
local attr_value = {}
|
attr_value[1] = lua.KeyValueObj( "S_ACTION", action )
|
nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【任务动作】信息失败! "..strRetInfo ) end
|
end
|