1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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-99-01
    名称: 创建前
    作者:HAN  
    日期:2025-05-12
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeDataObjCreate
 
    功能:
        1)生成错误编码
    更改记录:
        V6.0 HAN 2023/9/6  -- Error/Debug 函数变化 
--]]
json  = require ("json")
mobox = require ("OILua_JavelinExt")
lua   = require ("oi_base_func")
 
function BeforeDataObjCreate ( strLuaDEID ) 
    local   nRet, strRetInfo
     -- 生成作业编码
    local strCode = ''
    local strHeader = 'WE'..os.date("%y%m%d")..'-'
    nRet,strCode = mobox.getSerialNumber( "WMS错误", strHeader, 5 )  
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, '申请WMS错误编码失败!'..strCode )
        return
    end
 
    -- 设置信息
    local   attr_value = {
        { attr = "S_CODE", value = strCode }
     }
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "设置WMS错误信息失败!  "..strRetInfo ) 
        return
    end   
end