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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
ÿþ--[[
    x: hh-mobox-002
     Tðy: 'MO¶r`
    \O€ÿSGX
    åegÿ2024-11-27
    ýQpeÿ GenChartJson
 
    ŸRý€:
       àSñg¶rþV
 
    ôf9e°‹U_:
 
--]]
json = require("json")
mobox = require("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function GenChartJson1(strLuaDEID)
    lua.Debug( strLuaDEID, debug.getinfo(1), "111! ", 111 )
 
    local nRet, strRetInfo
    --[[ h˜˜œ˜r‚ ]]
    local strTitle = "ir™epeϑ"
    --[[ ‡eW[œ˜r‚ ]]
    local strColor = "#fff"
    --[[ ñg¶rþVñgP[ Tðy ÿù[”^ series  Nname ]]
    local tabLegendData = { 'peϑ' }
    --[[ Xtpenc ÎNæ]TóS ]]
    local tabXAxis = { 'ö€™e', '¢”N'}
    --[[ Yt g
N¹e>f:y‡eW[ ]]
    local strYAxisName = "ir™epeϑ"
    --[[ ánÓNœ˜r‚ ]]
    local strMCColor = '#45A048'
 
    local jl_num = 0
    local gs_num = 0
    local fl_num = 0
    local fc_num = 0
    local th_num = 0
    local lzb_num = 0
 
    local strCondition = "S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_Loc_Container)"
    local nRet, cg_detail = mobox.queryDataObjAttr2(strLuaDEID, "CG_Detail", strCondition, "", 100, "S_ITEM_CODE")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ågâ‹0¹[hV'ÁTfÆ~0áOo`1Y%!" .. cg_detail) end
    if (cg_detail ~= nil and cg_detail ~= '') then
        local queryInfo = json.decode(cg_detail)
        local nPageCount = queryInfo.pageCount
        local dataSet = queryInfo.dataSet
        local queryID = queryInfo.queryID
        lua.Debug(strLuaDEID, debug.getinfo(1), 'queryInfo:', queryInfo)
    
        -- Ru˜·ƒÖS'MO„vpenc
        for i = 1, nPageCount do
            for j = 1, #dataSet do
                local attrs
                nRet, attrs = m3.ObjAttrStrToLuaObj("CG_Detail", lua.table2str(dataSet[j].attrs))
                if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "ObjAttrStrToLuaObj1Y%!" .. attrs) end
    
                -- Çir™ex·ƒÖSir™e{|‹W
                local item_type_new, material
                nRet, item_type_new, material = GT_Get_ItemType(strLuaDEID, attrs.item_code)
                if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), item_type_new) end
    
                if (item_type_new == 'ö€™e' or item_type_new == ')Y6qö€' or item_type_new == 'ceňö€') then
                    jl_num = jl_num + 1
                elseif (item_type_new == '¢”N') then
                    gs_num = gs_num + 1
                elseif (item_type_new == '‰|™e') then
                    fl_num = fl_num + 1
                elseif (item_type_new == '…Pg') then
                    fc_num = fc_num + 1
                elseif (item_type_new == '³xў') then
                    th_num = th_num + 1
                elseif (item_type_new == '^P[^') then
                    lzb_num = lzb_num + 1
                end
            end
    
            if ((i + 1) <= nPageCount) then
                -- ÖS NNu˜
                local data
                nRet, data = mobox.queryDataObjAttr2(queryID, (i + 1))
                if (nRet ~= 0) then
                    lua.Error(strLuaDEID, debug.getinfo(1), "queryDataObjAttr21Y%! nPage=" .. i + 1 .. "  " .. data)
                end
                data = json.decode(data)
                dataSet = data.dataSet
            end
        end
    end
    local tabSeriesMCData = { jl_num, gs_num}
 
    local option = {
        title = {
            text = strTitle,
            left = 20,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        legend = {
            data = tabLegendData,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        grid = {
            left = '5%',
            right = '5%',
            bottom = '5%',
            top = '22%',
            containLabel = true
        },
        xAxis = {
            type = 'category',
            data = tabXAxis,
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        },
        yAxis = {
 
            type = 'value',
            nameTextStyle = {
                color = strColor
            },
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        },
        series = { {
            name = 'peϑ',
            type = 'bar',
            stack = 'total',
            label = {
                show = true
            },
            color = strMCColor,
            data = tabSeriesMCData
        } }
    }
 
    local action = {}
    action[1] = {
        action_type = "chart",
        value = {
            graphicType = "echart",
            title = {
                text = strTitle,
                align = "center",
                color = "#515a6e",
                font = "®_oÅ–Ñž",
                fontSize = 12
            },
            option = option
        }
    }
 
    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 .. ' action = ' .. strAction)
    end
end