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
55
56
57
58
59
60
61
62
63
64
65
66
67
ÿþ--[[
   x: GT-17-11
    Tðy:  NÉbFhRËYS
   \O€ÿLZH
   åegÿ2024/7/31
 
   ýQpeÿ Initail
   ŸRý€: RËYS°ežX\—zãS„v NÉbFh
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function Initail(strLuaDEID)
    -- ·ƒÖS“eQLub—-N„v^\'`
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID)  
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! "..strRetInfo ) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'strRetInfo', strRetInfo)
    -- local obj_attrs = json.decode( strRetInfo ) 
    -- local area_code = obj_attrs[1].value                        -- “^:Sx      
    -- ågâ‹ir™eáOo`hˆ„v-N{|ŒT\{|W[µkpeÄ~ ÿ¾‹n0Ru˜b—
    local sub_type_list = ""
    local minor_type_list = ""
    local nRet, strRetInfo = mobox.groupDataObjAttrs(strLuaDEID, "Material", "", "", "S_SUB_TYPE")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹ir™ehˆ1Y% " .. strRetInfo) end
 
    if (strRetInfo ~= '') then
        local material = {}
        local success
        success, material = pcall(json.decode, strRetInfo)
        if (success == false) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0ir™e0áOo`1Y%! ^—Õl„vJSON<h_!" .. material) end
 
        local nCount = #material
        for n = 1, nCount do
            sub_type_list = sub_type_list .. '"' .. material[n][1].value .. '",'
        end
        sub_type_list = lua.trim_laster_char(sub_type_list)
    end
 
    nRet, strRetInfo = mobox.groupDataObjAttrs(strLuaDEID, "Material", "", "", "S_MINOR_TYPE")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹ir™ehˆ1Y% " .. strRetInfo) end
 
    if (strRetInfo ~= '') then
        local material = {}
        local success
        success, material = pcall(json.decode, strRetInfo)
        if (success == false) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0ir™e0áOo`1Y%! ^—Õl„vJSON<h_!" .. material) end
 
        local nCount = #material
        for n = 1, nCount do
            minor_type_list = minor_type_list .. '"' .. material[n][1].value .. '",'
        end
        minor_type_list = lua.trim_laster_char(minor_type_list)
    end
 
    -- ÞVŒPDA/UNx
    -- ¾‹n—zãS-N„váOo`
    local setAttr = '[{"attr":"S_SUB_TYPE","value":"","choice_list":[' .. sub_type_list .. ']}'
    setAttr = setAttr .. ',{"attr":"S_MINOR_TYPE","value":"","choice_list":[' .. minor_type_list .. ']}]'
    local action = {}
    action.action_type = "set_dlg_attr"
    action.value = json.decode(setAttr)
    nRet, strRetInfo = mobox.setAction(strLuaDEID, '[' .. lua.table2str(action) .. ']')
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y% " .. strRetInfo) end
end