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
--[[
    编码: WMS-54-01
    名称: 供应商-创建前
    作者:HAN  
    日期:2025-1-29
    
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeDataObjCreate
 
    功能:
        1)生成供应商编码 S_NO 格式:SP-0001
 
    变更记录:
        V6.0 HAN 2023/9/6  -- lua.Error/lua.Debug 函数变化  
--]]
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function BeforeDataObjCreate ( strLuaDEID ) 
    local   nRet, strRetInfo 
    -- 生成供应商编码
    local strCode = ''
    nRet,strCode = mobox.getSerialNumber( "供应商", "SP-", 4 )  
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '申请【供应商】编码失败!'..strCode ) end
    
    -- 设置信息
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_NO", strCode )
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "设置【供应商】信息失败!  "..strRetInfo ) end   
end