lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
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
42
ÿþ--[[
   x: GT-119-02
    Tðy: 
   \O€ÿ
   åegÿ2025-05-08
 
   ýQpeÿ BeforeDataObjCreate
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require ("oi_base_mobox")
 
function BeforeDataObjCreate( strLuaDEID )
    local nRet, strRetInfo
    -- ·ƒÖSS_MRRú^„vpencù[aŒ^\'`
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID,"S_DO_NO")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS‘áOo`1Y% " .. strRetInfo)
    end
    local obj_attrs = json.decode(strRetInfo)
    local do_no = obj_attrs[1].value
 
    local strCode = ''
    if (do_no == nil or do_no == '') then
        -- ê¨RubúQ“^US÷S(xĉR C + 7MOpeW[)
        nRet, strCode = mobox.getSerialNumber("ºNå]U_eQúQ“^US÷S", 'C', 7)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1),"3u÷‹ºNå]U_eQúQ“^USx1Y%!" .. strCode) end
    end
 
    if(strCode ~= '')then
        -- ¾‹náOo`
        local attr_value = {}
        attr_value[1] = lua.KeyValueObj("S_DO_NO", strCode)
        nRet, strRetInfo = mobox.setCurEditDataObjAttr(strLuaDEID, lua.table2str(attr_value))
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "¾‹neQ“^USncLˆáOo`1Y%!  " .. strRetInfo) end
    end
end