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
ÿþ--[[
   x: GT-24-16
    Tðy: Œèb¡[8hUS>f:yMR
   \O€ÿLZH
   åegÿ2024-12-19
 
   ýQpeÿ BeforeGridShow
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function BeforeGridShow(strLuaDEID)
    local nRet, strRetInfo, arobjs
    local setAction = ""
 
    -- ·ƒÖS 0‰|™eŒèb„˜f‹0 „vpenc
    nRet, arobjs = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), arobjs) end
 
    if (arobjs == nil or arobjs == '') then return end
    -- lua.Debug(strLuaDEID, debug.getinfo(1), 'arobjs', arobjs)
 
    setAction = ''
    for i = 1, #arobjs do
        local id = arobjs[i].id
        local attrs = m3.KeyValueAttrsToObjAttr(arobjs[i].attrs)
 
        setAction = setAction .. '{"id":"' .. id .. '","attrs":['
 
        -- ·ƒÖSJS¢”peϑß~¡‹
        local bg_count, qg_count
        local strCondition = "S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_CG_Detail WHERE S_ITEM_CODE = '" ..
            attrs.S_ITEM_CODE .. "') "
        strCondition = strCondition ..
            "AND S_LOC_CODE IN (SELECT S_CODE FROM TN_Location WHERE S_AREA_CODE IN ('PFL','HWPFL'))"
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "Loc_Container", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "getDataObjCount 1Y%!" .. strRetInfo) end
 
        bg_count = tonumber(strRetInfo)
 
        -- ·ƒÖShQ¢”peϑß~¡‹
        strCondition = "S_CNTR_CODE IN (SELECT S_CNTR_CODE FROM TN_CG_Detail WHERE S_ITEM_CODE = '" ..
            attrs.S_ITEM_CODE .. "') "
        strCondition = strCondition ..
            "AND S_LOC_CODE IN (SELECT S_CODE FROM TN_Location WHERE S_AREA_CODE IN ('TFL','HWTFL'))"
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "Loc_Container", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "getDataObjCount 1Y%!" .. strRetInfo) end
 
        qg_count = tonumber(strRetInfo)
 
        local strCellBkground = ''
        local s_b_state
        if (attrs.S_B_STATE == '0') then
            s_b_state = "*g/T(u"
            strCellBkground = ', "bk_color":"#73B3F6","text_color":"#000000"'
        elseif (attrs.S_B_STATE == '1') then
            s_b_state = "¡[8hÇ"
            strCellBkground = ', "bk_color":"#BDB76B","text_color":"#000000"'
        elseif (attrs.S_B_STATE == '2') then
            s_b_state = "gbLˆ-N"
            strCellBkground = ', "bk_color":"#BDB76B","text_color":"#000000"'
        else
            s_b_state = "Œ[b"
            strCellBkground = ', "bk_color":"#00FF00","text_color":"#008000"'
        end
        local start_time = attrs.T_START
        local end_time = attrs.T_END
        setAction = setAction .. '{"attr":"S_B_STATE","value":"' .. s_b_state .. '"' .. strCellBkground .. '},'
        setAction = setAction ..
        '{"attr":"T_START","value":"' .. string.sub(start_time, #start_time - 7, #start_time) .. '"},'
        setAction = setAction .. '{"attr":"T_END","value":"' .. string.sub(end_time, #end_time - 7, #end_time) .. '"},'
        if (attrs.S_LEVEL == '1') then
            setAction = setAction .. '{"attr":"S_LEVEL","value":"'}%`"},'
        else
            setAction = setAction .. '{"attr":"S_LEVEL","value":"ck8^"},'
        end
 
        -- üb¥cԏÞVaction
        setAction = setAction .. '{"attr":"S_ITEM_CODE","value":"' .. attrs.S_ITEM_CODE .. '"},'
        setAction = setAction .. '{"attr":"S_ITEM_NAME","value":"' .. attrs.S_ITEM_NAME .. '"},'
        setAction = setAction .. '{"attr":"S_AREA_NAME","value":"' .. attrs.S_AREA_NAME .. '"},'
        setAction = setAction .. '{"attr":"S_AREA_CODE","value":"' .. attrs.S_AREA_CODE .. '"},'
        setAction = setAction .. '{"attr":"N_ALLOT_QTY","value":"' .. attrs.N_ALLOT_QTY .. '"},'
        setAction = setAction .. '{"attr":"N_BG_QTY","value":"' .. bg_count .. '"},'
        setAction = setAction .. '{"attr":"N_QG_QTY","value":"' .. qg_count .. '"},'
        setAction = setAction .. '{"attr":"N_FLOOR_QTY","value":"' .. attrs.N_FLOOR_QTY .. '"}]},'
    end
    -- ÖSˆmgTN*N,÷S
    setAction = lua.trim_laster_char(setAction)
    -- lua.Debug(strLuaDEID, debug.getinfo(1), 'setAction', '[{"action_type":"reset_data_attr","value":[' .. setAction .. ']}]')
    local strAction = '[{"action_type":"reset_data_attr","value":[' .. setAction .. ']}]'
    nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "setAction•ï‹: " .. strRetInfo)
    end
end