--[[
|
编码: WMS-16-01
|
名称: 盘点计划-创建前
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: BeforeDataObjCreate
|
|
功能:
|
-- 生成到盘点计划号格式:CP2301-00001
|
-- 盘点类型名称 赋值
|
|
更改记录:
|
|
--]]
|
wms_base = require( "wms_base" )
|
|
function BeforeDataObjCreate ( strLuaDEID )
|
local nRet, strRetInfo
|
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_CP_NO", "N_TYPE" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end
|
local obj_attrs = json.decode( strRetInfo )
|
local cp_code = lua.Get_StrAttrValue( obj_attrs[1].value )
|
local count_type = lua.Get_NumAttrValue( obj_attrs[2].value )
|
|
-- 生成盘点计划号
|
if ( cp_code == '' ) then
|
local strHeader = 'CP'..os.date("%y%m")..'-'
|
nRet,cp_code = mobox.getSerialNumber( "盘点计划", strHeader, 4 )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '生成盘点计划号失败!'..cp_code ) end
|
end
|
|
local str_count_type = wms_base.GetDictItemName( strLuaDEID, "WMS_CountType", count_type )
|
|
-- 设置信息
|
local attr_value = {}
|
attr_value[1] = lua.KeyValueObj( "S_CP_NO", cp_code )
|
attr_value[2] = lua.KeyValueObj( "S_TYPE", str_count_type )
|
nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【盘点计划】信息失败! "..strRetInfo ) end
|
end
|