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
43
44
45
46
47
48
49
50
51
52
53
54
ÿþ--[[
    x: GT-07-01
     Tðy: îvƉaSŒšÁ‹-Rú^MR
    \O€: LZH
    Rú^öeô•: 2024/5/10
    eQãSýQpeÿ
    ŸRý€ô‹fÿ
        10PDAkbx·ƒÖSAm4l÷SŒT!hŒšir™ex
        20ÇAm4l÷S·ƒÖSù[”^„vîvƉaSáOo`
        30$R­eAm4l÷S·ƒÖS„vîvƉaSáOo`̑b—„v/f&TŒšÁ‹W[µk/f&T:N Y (Y/f—‰ŒšÁ‹ ÿN/fò]ŒšÁ‹b N—‰ŒšÁ‹)
        40‚Yœg:NYRŒšÁ‹!hŒšir™exŒTîvƉaSáOo`„vir™ex/f&TN7h ÿ NN7hR¥b•
        50ŒšÁ‹Œ[bRîO9e0îvƉaS0-N„vS_VERIFY_RESULT = OK
--]]
 
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_SERIAL_NO", "S_VERIFY_CODE")
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS‘áOo`1Y% " .. strRetInfo)
    end
    local obj_attrs = json.decode(strRetInfo)
    local serial_no = obj_attrs[1].value
    local verift_code = obj_attrs[2].value
 
 
    -- ·ƒÖSîvƉaSáOo`
    nRet, label_card = m3.GetDataObjectByKey( strLuaDEID, "GT_Label_Crad", "S_SERIAL_NO", serial_no )
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSîvƉaSáOo`1Y%ÿ"..label_card ) end
 
    -- —‰!hŒš
    if (label_card.is_validate == "Y") then
        if ( verift_code == nil or  verift_code == '') then
            lua.Error(strLuaDEID, debug.getinfo(1), "÷‹HQÏc›O”^FUir™ex!" )
        end
    
        -- !hŒšir™ex/f&TNô
        if (label_card.item_code ~= verift_code) then
            lua.Error(strLuaDEID, debug.getinfo(1), "ŒšÁ‹1Y%,îvƉaSáOo`„vir™exN“eQ„v!hŒšir™ex NNô!")
        end
        
        -- ŒšÁ‹Œ[bîO9eîvƉaSáOo`„v/f&TŒšÁ‹W[µk:N N
        local strcondition = "S_SERIAL_NO = '" .. serial_no .. "'"
        local strSetSQL = "S_VERIFY_RESULT = 'OK'"
        nRet, strRetInfo = mobox.updateTableAttrByCondition(strLuaDEID, "TN_GT_Label_Crad", strcondition, strSetSQL)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), 'îO9eŒšÁ‹Ó~œg1Y%' .. strRetInfo) end
    end
 
end