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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ÿþ--[[
   x: 
    Tðy: 
   \O€ÿ
   åegÿ2024-11-25
 
   ýQpeÿ Import
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function Import( strLuaDEID )
    local nRet, strRetInfo
    -- ·ƒÖSü[eQ„vpenc, ÔÞV [{"attr":"xx","value":""},...]
    local row_data = {}
    nRet, row_data = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0 or strRetInfo == '') then lua.Error( strLuaDEID, debug.getinfo(1), "àeÕl·ƒÖSir™eü[eQpenc!") end
 
    lua.Debug( strLuaDEID, debug.getinfo(1), 'row_data', row_data )
 
    local row_attrs
    local n, nCount, nValue, nRows
    nRows = #row_data
    if ( nRows == 0 ) then return end
 
    -- N›NsQ.•^\'`
    local a = ''
    local b = ''
    local c = ''
    local d = ''
    local e = ''
    local f = ''
    local g = ''
    local h = ''
    local material = {}
 
    -- ek¤š1 ·ƒÖSÎNexcelü[eQ„vNLˆpenc
    for row = 1, nRows do
        row_attrs = row_data[row]
        nCount = #row_attrs
        strItemCode = ''
        strItemName = ''
        strAreaCode = ''
        strIsYz = ''
        strIsHw = ''
        strIsBw = ''
        strZl = ''
        strXl = ''
 
        -- RËYS ir™e ù[aŒ
        material = m3.AllocObject(strLuaDEID,"GT_ITEM_TYPE")
        for n = 1, nCount do
            strAttr = row_attrs[n].attr
            strValue = row_attrs[n].value
            if (strAttr ~= '') then
 
                -- 9hncü[eQ„vexcelR4Y TðyۏLˆ$R­e
                -- sQ.•^\'`$R­e ÿ‚Yœg^\'` NX[(W‰¥b•
                if (strAttr == "-N{|") then
                    a = strValue
                elseif (strAttr == "\{|") then
                    b = strValue
                elseif (strAttr == "ir™e{|‹W") then
                    c = strValue
                end
            end
        end
 
            material.sub_type = a
            material.minor_type = b
            material.type = c
            -- Rú^¹[hV
            nRet, strRetInfo = m3.CreateDataObj( strLuaDEID, material )
            if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "Rú^ir™e1Y%! " .. strRetInfo ) end
        end
end