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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
ÿþ--[[
   x: hh-mobox-003
    Tðy: S_MReQ“^ûN¡R
   \O€ÿSGX
   åegÿ2024-11-17
 
   ýQpeÿ GenerateViewHTML
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
json = require("json")
mobox = require("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function GenerateViewHTML(strLuaDEID)
    local nRet, strRetInfo
    local autoplay = false
    local strHtmlTitle = "";
    local strHtmlRow = "";
    --[[ ·ƒÖS7h_ ]]
    local strHtmlStyle = GetHtmlStyle();
    --[[    Rf ]]
    local tabTitleList = { "ir™ex", "ir™e Tðy", "¶r`", ";`͑ϑ" }
 
    --[[ Ä~Ç~R T ]]
    for i = 1, #tabTitleList do
        strHtmlTitle = strHtmlTitle .. '<div class="table-col' .. i .. '">' .. tabTitleList[i] .. '</div>'
    end
    -- ·ƒÖSgbLˆ-N„v\ONpenc
    local tabDataList = {}
    local operation_list
    local condition = "TO_CHAR(T_CREATE, 'YYYY-MM-DD') = TO_CHAR(SYSDATE, 'YYYY-MM-DD')"
    local strFieldList = '["S_STATE","S_ITEM_CODE","S_ITEM_NAME","F_ACTUAL_QTY"]'
    nRet, operation_list = mobox.queryTable(strLuaDEID, "TN_GT_Incoming_Info", strFieldList, 1000, condition,
        "T_CREATE ASC")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖS0eQ“^US01Y%ÿ" .. operation_list) end
    if (operation_list == '') then return end
    operation_list = json.decode(operation_list)
    -- ûm ReQ“^áOo`
    for i = 1, #operation_list do
        tabDataList[i] = {
            item_code = operation_list[i].S_ITEM_CODE,
            item_name = operation_list[i].S_ITEM_NAME,
            weight = operation_list[i].F_ACTUAL_QTY
        }
 
        if (operation_list[i].S_STATE == '°eú^') then
            tabDataList[i].state = "…_gbLˆ"
            tabDataList[i].back = "#ff5722"
        elseif (operation_list[i].S_STATE == '/T(u') then
            tabDataList[i].state = "gbLˆ-N"
            tabDataList[i].back = "#ffc107"
        elseif (operation_list[i].S_STATE == 'Œ[b') then
            tabDataList[i].state = "ò]Œ[b"
            tabDataList[i].back = "#2196F3"
        end
    end
    -- local tabDataList = {
    --     {
    --         item_code = "111",
    --         item_name = "111",
    --         state = "gbLˆ-N",
    --         weight = 100,
    --         back = "#ff5722"
    --     }, {
    --     item_code = "222",
    --     item_name = "222",
    --     state = "Œ[b",
    --     weight = 100,
    --     back = "#2196F3"
    -- }, {
    --     item_code = "111",
    --     item_name = "111",
    --     state = "gbLˆ-N",
    --     weight = 100,
    --     back = "#ff5722"
    -- }, {
    --     item_code = "111",
    --     item_name = "111",
    --     state = "gbLˆ-N",
    --     weight = 100,
    --     back = "#ff5722"
    -- }, {
    --     item_code = "111",
    --     item_name = "111",
    --     state = "gbLˆ-N",
    --     weight = 100,
    --     back = "#ff5722"
    -- }
    -- }
 
 
    if (#tabDataList > 4) then
        autoplay = true
    end
 
    --[[ Ä~Ç~Lˆpenchtml ]]
    for i = 1, #tabDataList do
        strHtmlRow = strHtmlRow .. '<div class="swiper-slide"><div class="table-row-data">' ..
            '<div class="table-col1">' ..
            tabDataList[i].item_code .. '</div>' .. '<div class="table-col2">' .. tabDataList[i].item_name ..
            '</div>' ..
            '<div class="table-col3">' ..
            '<div style=" background: ' .. tabDataList[i].back .. ';">' .. tabDataList[i].state
            ..
            '</div>' .. '</div>' .. '<div class="table-col4">' .. tabDataList[i].weight .. '</div>' .. '</div></div>'
    end
 
    --[[ ;`html ]]
    local strHtml = ' <div class="table3">' .. '<div class="table-head">' .. strHtmlTitle .. '</div>' ..
        '<div class="table-body"  style="overflow: hidden;"> <div class="swiper-container crkrw"><div class="swiper-wrapper">' ..
        strHtmlRow .. '</div></div></div>' .. '</div>'
 
    local action = {}
    action[1] = {
        action_type = "chart",
        value = {
            graphicType = "html",
            title = {
                text = "S_MReQ“^ûN¡R",
                align = "left",
                color = "#fff",
                font = "®_oÅ–Ñž",
                fontSize = 18
            },
            swiper = {
                --[[ ¹[hV Tðy Ný€Í‘ Y  Ný€:Nzz swiper-container class —‰cš[ ]]
                containerName = "crkrw",
                --[[ :_6RSwiper„v½[¦^(px) ÿ"undefined" b  tepe ÿ S_`O„vSwiper(W–Ï…¶r` NRËYSöe(u—_
N0ُ*NÂSpeOOꁐ”^1YHe0ïS¾‹n:NundefinedOُ*NÂSpeàeHe0  ]]
                width = "undefined",
                --[[ :_6RSwiper„vؚ¦^(px) ÿS_`O„vSwiper(W–Ï…¶r` NRËYSöeNRbc¹eT:N‚WôvMb(u—_
N0ُ*NÂSpeOOꁐ”^1YHe0 ]]
                height = 150,
                --[[ ’cR¹eT  vertical  ÿ horizontal ]]
                direction = "vertical",
                --[[  Rbc¦^ ÿsSsliderꁨRÑn¨R_ËY0RÓ~_g„vöeô•ÿUSMOms    ÿ ]]
                speed = 1000,
                --[[  loop !j_‚YœgN slidesPerView: 'auto' NwO(u ÿ—‰¾‹n loopedSlides cš[‰ª_¯sÿ͑ Y    ÿ„v{^opGrpeϑ0 ]]
                loop = true,
                --[[  ¾‹nslider¹[hVý€Y Töe>f:y„vslidespeϑ,tepebauto ]]
                slidesPerView = 'auto',
                --[[  (WslideKNô•¾‹nݍ»yÿUSMOpx    ÿ0 ]]
                spaceBetween = 1,
                --[[  Øž¤‹Å`µQ NSwiper Ïk!kÑn¨RöeêSÑn¨RN*NSlide ÿv^NOꁨR4TWrapper0_/Tê1u!j_T ÿSwiper O9hncï`'`Ñn¨RïSý€ NbkN<hN NO4T0 ]]
                freeMode = true,
                --[[ ¾‹š[slideNæ]¹Fh„v„˜¾‹OPûyϑÿUSMOpx    ÿ0 ‚Wôv1\LˆN
N¹eݍ»y ]]
                slidesOffsetBefore = 0,
                --[[  ¾‹š[slideNóS¹Fh„v„˜¾‹OPûyϑÿUSMOpx    ÿ0 ‚Wôv1\LˆN N¹eݍ»y ]]
                slidesOffsetAfter = 0,
                --[[/f&TꁨR­d>e ÿtrue —‰cš[ autoplayDelay ]]
                autoplay = autoplay,
                --[[ ­d>eô•”–öeô• ÿUSMOms  ]]
                autoplayDelay = 500
            },
            html = strHtmlStyle .. strHtml
        }
    }
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, json.encode(action))
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo)
    end
end
 
function GetHtmlStyle()
    return
        '<style>' .. '.table3 {' .. '    border: 2px solid #fff;' .. '    width: 100%;' .. '    height: 100%;' .. '}' ..
        '.table-head {' .. '    border-bottom: 2px solid #fff;    color: #fff;' .. '}' .. '.table-head>div {' ..
        '    text-align: center;' .. '    display: inline-block;' .. '    padding: 5px 0px;' ..
        '    font-size: 17px;' ..
        '    font-weight: 600;' .. '}' .. '.table3 .table-head .table-col1 {' .. '    width: 20%;' ..
        '    border-right: 2px solid;' .. '}'
        .. '.table3 .table-head .table-col2 {' .. '    width: 50%;' ..
        '    border-right: 2px solid;' .. '}' .. '.table3 .table-head .table-col3 {' .. '    width: 15%;' ..
        '    border-right: 2px solid;' .. '}' .. '.table3 .table-row-data .table-col3>div {' ..
        '    border-radius: 50px;' .. '    width: 92%;' .. '    display: inline-block;' .. '    padding: 5px 1px;' ..
        '    font-size: 12px;' .. '}' .. '.table3 .table-head .table-col4 {' .. '    width: 15%;' .. '}' ..
        '.table3 .table-body .table-row-data{    margin-top: 10px;} .table-body .table-row-data>div {' ..
        '    text-align: center;' .. '    display: inline-block;' .. '    padding: 5px 0px;' .. '    color: #fff;' ..
        '}' ..
        '.table3 .table-row-data .table-col1 {' ..
        '    width: 20%;' .. '}' .. '.table3 .table-row-data .table-col2 {' .. '    width: 50%;' .. '}' ..
        '.table3 .table-row-data .table-col3 {' ..
        '    width: 15%;' .. '}' .. '.table3 .table-row-data .table-col4 {' .. '    width: 15%;' .. '}' .. '</style>'
end