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
ÿþ--[[
   x: GT-Public-18
    Tðy: ÞVŒir™eáOo`
   \O€ÿZHR
   åegÿ2025-01-20
 
   ýQpeÿ CallBack
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
function CallBack( strLuaDEID )
    lua.Debug(strLuaDEID, debug.getinfo(1), '1', 1)
    local nRet, strRetInfo, attrs
    
    --·ƒÖS‘^\'`
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_CNTR_CODE")
    lua.Debug(strLuaDEID, debug.getinfo(1), 'strRetInfo', strRetInfo)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    local obj_attrs = json.decode(strRetInfo)
    local cntr_code = obj_attrs[1].value -- XbØvx
    if (cntr_code == nil or cntr_code == '') then 
        return end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'cntr_code', cntr_code)
    
    -- ·ƒÖS¹[hV'ÁTfÆ~áOo`
    local cg_detail
    strCondition = "S_CNTR_CODE = '" .. cntr_code .. "'"
    nRet, cg_detail = m3.GetDataObjByCondition(strLuaDEID, "CG_Detail", strCondition)
    if (nRet == 1) then lua.Error(strLuaDEID, debug.getinfo(1), "XbØv*gågâ‹0Rir™eáOo`!") end
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0¹[hV'ÁTfÆ~0áOo`1Y%! " .. cg_detail) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'cg_detail', cg_detail)
    
    -- ÞVŒ¾‹n—zãSáOo`
    setAttr = '[{"attr":"S_ITEM_CODE","value":"' .. cg_detail.item_code .. '"},'
    setAttr = setAttr .. '{"attr":"S_ITEM_NAME","value":"' .. cg_detail.item_name .. '"}]'
    local action = {}
    action.action_type = "set_dlg_attr"
    action.value = json.decode(setAttr)
    lua.Debug(strLuaDEID, debug.getinfo(1), 'action', action)
    nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) .. ']')
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo) end
end