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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
ÿþ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 = { "å]MO", "¶r`", "ir™ex", "yb!k÷S", "ň±{öNpe" }"ir™e Tðy",
    local tabTitleList = {  "¶r`", "å]ňx", "ň±{peϑ","Am4l÷S", "S_MRMOn" }
 
    --[[ Ä~Ç~R T ]]
    --[[ class Yt7h_ ÙÌ‘ Ä~bÿtable-col' .. i .. '    ÿ table-col1 ÿtable-col2 ÿtable-col3 ]]
    for i = 1, #tabTitleList do
        strHtmlTitle = strHtmlTitle .. '<div class="table-col' .. i .. '">' .. tabTitleList[i] .. '</div>'
    end
    -- ·ƒÖSň±{¡‹Rpenc
    local tabDataList = {}
    local packing_rec_list,packing_rec
    local strCondition = "S_PACK_NO = (SELECT S_PACK_NO FROM TN_GT_Packing_Order WHERE S_STATE = '/T(u' AND S_STATION = 'C')"
    nRet, packing_rec_list = m3.QueryDataObject(strLuaDEID, "GT_Packing_Rec", strCondition)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "QueryDataObject 1Y%!" .. packing_rec_list) end
    if(packing_rec_list == "")then return end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'packing_rec_list', packing_rec_list)
    -- üb¥cpenc
    for i = 1,#packing_rec_list do
        packing_rec = m3.KeyValueAttrsToObjAttr(packing_rec_list[i].attrs)
        lua.Debug(strLuaDEID, debug.getinfo(1), 'packing_rec', packing_rec)
        
        -- tabDataList[i].cntr_code = packing_rec.S_CNTR_CODE
        -- tabDataList[i].qty = packing_rec.F_QTY
        -- tabDataList[i].serial_no = packing_rec.S_SERIAL_NO
        
        -- ·ƒÖSS_MR¹[hV„v\ONáOo`
        local condition = "S_CNTR_CODE = '"..packing_rec.S_CNTR_CODE.."' AND S_B_STATE IN ('Œ[b','gbLˆ','I{…_','•ï‹')"
        nRet, op_info = m3.GetDataObjByCondition(strLuaDEID, "Operation", condition,"T_CREATE DESC")
        lua.Debug(strLuaDEID, debug.getinfo(1), 'nRet', nRet)
        if (nRet == 1) then
            tabDataList[i].state = "eQ“^-N"
        elseif (nRet > 1) then 
            lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. op_info) 
        elseif (nRet == 0) then
            lua.Debug(strLuaDEID, debug.getinfo(1), 'op_info', op_info)
            -- $R­eS_MR\ON/f&TŒ[b
            if(tonumber(op_info.bs_state) == 2)then
                tabDataList[i] = {
                    cntr_code = packing_rec.S_CNTR_CODE,
                    qty = packing_rec.F_QTY,
                    serial_no = packing_rec.S_SERIAL_NO,
                    state = "ò]eQ“^",
                    station = op_info.end_loc_code
                }
            else
                -- ·ƒÖSS_MR@b(WMOn
                condition = "S_TASK_CODE = (SELECT S_CODE FROM TN_Task WHERE S_OP_CODE = '".. op_info.code .."' AND S_B_STATE = 'ò]¨c')"
                nRet, task_action = m3.GetDataObjByCondition(strLuaDEID, "Task_Action", condition,"T_CREATE DESC")
                lua.Debug(strLuaDEID, debug.getinfo(1), 'task_action', task_action)
                if (nRet == 1) then
                    tabDataList[i] = {
                        cntr_code = packing_rec.S_CNTR_CODE,
                        qty = packing_rec.F_QTY,
                        serial_no = packing_rec.S_SERIAL_NO,
                        state = "eQ“^-N",
                        station = ""
                    }
                elseif (nRet > 1) then 
                    lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. task_action) 
                elseif (nRet == 0) then
                    tabDataList[i] = {
                        cntr_code = packing_rec.S_CNTR_CODE,
                        qty = packing_rec.F_QTY,
                        serial_no = packing_rec.S_SERIAL_NO,
                        state = "eQ“^-N",
                        station = task_action.action
                    }
                end
            end
            lua.Debug(strLuaDEID, debug.getinfo(1), 'tabDataList', tabDataList)
        end
    end
    
    -- KmՋpenc
    -- tabDataList = {
    --     {
    --       state = "eQ“^-N",
    --       cntr_code = "111111122334",
    --       qty = 1000,
    --       serial_no = "1212123424344",
    --       station = "N|i¯s¿~RGV,dЏ-N"
    --     },{
    --       state = "eQ“^-N",
    --       cntr_code = "2324345454523",
    --       qty = 1000,
    --       serial_no = "1212123423232",
    --       station = "N|i¯s¿~RGV,dЏ-N"
    --     },{
    --       state = "eQ“^-N",
    --       cntr_code = "1111123454541",
    --       qty = 1000,
    --       serial_no = "1212123245454",
    --       station = "N|i¯s¿~RGV,dЏ-N"
    --     },{
    --       state = "eQ“^-N",
    --       cntr_code = "1111134534341",
    --       qty = 1000,
    --       serial_no = "1212123454334",
    --       station = "N|i¯s¿~RGV,dЏ-N"
    --     },{
    --       state = "eQ“^-N",
    --       cntr_code = "1111454344311",
    --       qty = 1000,
    --       serial_no = "12123445641234",
    --       station = "N|i¯s¿~RGV,dЏ-N"
    --     }
    -- }
 
    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].state .. '</div>' 
            .. '<div class="table-col2">' .. tabDataList[i].cntr_code .. '</div>' 
            -- .. '<div class="table-col3">' .. tabDataList[i].item_name .. '</div>' 
            .. '<div class="table-col3">' .. tabDataList[i].qty .. '</div>' ..
            '<div class="table-col4">' .. tabDataList[i].serial_no .. '</div>' ..
            '<div class="table-col5">' .. tabDataList[i].station .. '</div>' .. '</div></div>'
    end
 
    --[[ ;`html ]]
    local strHtml = ' <div class="zxjl01">' .. '<div class="table-head">' .. strHtmlTitle .. '</div>' ..
        '<div class="table-body"  style="overflow: hidden;"> <div class="swiper-container zxjl"><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 = "zxjl",
                --[[ :_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 = 200,
                --[[ ’cR¹eT  vertical  ÿ horizontal ]]
                direction = "vertical",
                --[[  Rbc¦^ ÿsSsliderꁨRÑn¨R_ËY0RÓ~_g„vöeô•ÿUSMOms    ÿ ]]
                speed = 2000,
                --[[  loop !j_‚YœgN slidesPerView: 'auto' NwO(u ÿ—‰¾‹n loopedSlides cš[‰ª_¯sÿ͑ Y    ÿ„v{^opGrpeϑ0 ]]
                loop = true,
                -- loopedSlides=10,
                --[[  ¾‹nslider¹[hVý€Y Töe>f:y„vslidespeϑ,tepebauto ]]
                slidesPerView = 'auto',
                --[[  (WslideKNô•¾‹nݍ»yÿUSMOpx    ÿ0 ]]
                spaceBetween = 10,
                --[[  Øž¤‹Å`µ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 = false,
                --[[ ¾‹š[slideNæ]¹Fh„v„˜¾‹OPûyϑÿUSMOpx    ÿ0 ‚Wôv1\LˆN
N¹eݍ»y ]]
                slidesOffsetBefore = 10,
                --[[  ¾‹š[slideNóS¹Fh„v„˜¾‹OPûyϑÿUSMOpx    ÿ0 ‚Wôv1\LˆN N¹eݍ»y ]]
                slidesOffsetAfter = 10,
                --[[/f&TꁨR­d>e ÿtrue —‰cš[ autoplayDelay ]]
                autoplay = autoplay,
                --[[ ­d>eô•”–öeô• ÿUSMOms  ]]
                autoplayDelay = 100
            },
            html = strHtmlStyle .. strHtml
        }
    }
 
    -- 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
 
function GetHtmlStyle()
    return
        '<style>' .. '.zxjl01 {' .. '    border: 0px solid #fff;' .. '    width: 100%;' .. '    height: 100%;' .. '}' ..
        '.zxjl01 .table-head {' ..
        '    border-bottom: 0px solid #fff;    color: #fff;' .. '}' .. '.zxjl01 .table-head>div {' ..
        '    text-align: center;' .. '    display: inline-block;' .. '    padding: 0px 0px;' ..
        '    font-size: 17px;' ..
        '    font-weight: 600;' .. '}' .. '.zxjl01 .table-head .table-col1 {' .. '    width: 10%;' ..
        '    border-right: 0px solid;' ..
        '}' .. '.zxjl01 .table-head .table-col2 {' .. '    width: 20%;border-right: 0px solid;' ..
        '    border-right: 0px solid;' ..
        '}' ..
        -- '.table91 .table-head .table-col3 {' .. '    width: 16%;border-right: 2px solid;' .. '}' ..
        '.zxjl01 .table-head .table-col3 {' .. '    width: 10%;border-right: 0px solid;' .. '}' ..
        '.zxjl01 .table-head .table-col4 {' .. '    width: 20%;border-right: 0px solid;' .. '}' ..
        '.zxjl01 .table-head .table-col5 {' .. '    width: 40%' .. '}' ..
        '.zxjl01 .table-body .table-row-data{    margin-top: 10px;    width: 100%;} .zxjl01 .table-body .table-row-data>div {' ..
        '    text-align: center;' .. '    display: inline-block;' .. '    padding: 5px 0px;' .. '    color: #fff;' ..
        '}' ..
        '.zxjl01 .table-row-data .table-col1 {' ..
        '    width: 10%;' .. '}' .. '.zxjl01 .table-row-data .table-col1>div {' ..
        '    border-radius: 50px;' .. '    width: 92%;' .. '    display: inline-block;' .. '    padding: 5px 1px;' ..
        '    font-size: 12px;' .. '}' .. '.zxjl01 .table-row-data .table-col2 {' .. '    width: 20%;' .. '}' ..
        -- '.table91 .table-row-data .table-col3 {' .. '    width: 16%;' .. '}' ..
        '.zxjl01 .table-row-data .table-col3 {' .. '    width: 10%;' .. '}' ..
        '.zxjl01 .table-row-data .table-col4 {' .. '    width: 20%;' .. '}' ..
        '.zxjl01 .table-row-data .table-col5 {' .. '    width: 40%;' .. '}' ..
 
        '</style>'
end