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
ÿþ--[[
    x: GT-03-14
     Tðy: Åˆ±{å]US-    c®”-¾‹n:N/T¨R
    \O€ÿHAN
    åegÿ2023-05-10
 
    ýQpeÿ SetState
 
    ŸRý€:
       -- ¾‹n:N /T¨R ¶r`
 
    ôf9e°‹U_:
    V2.0 LZH 2024-06-06 ¾‹n¶r`T7R°eu˜b—
    V2.1 LZH 2024-06-06  TNå]MO TöeêSý€    gN*N/T¨R¶r`„vň±{å]US
 
--]]
json  = require("json")
mobox = require("OILua_JavelinExt")
m3    = require("oi_base_mobox")
 
function SetState(strLuaDEID)
    local nRet, strRetInfo, objs, nCount
 
    -- ·ƒÖSS_MR    -N„vpencù[aŒ
    nRet, objs = m3.GetSysDataJson(strLuaDEID)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), objs) end
    lua.Debug(strLuaDEID, debug.getinfo(1), '¾‹n:N/T¨RÂSpe:', objs)
 
    local obj_attrs
    local strCondition, strSetAttr
 
    for n = 1, #objs do
        obj_attrs = m3.KeyValueAttrsToObjAttr(objs[n].attrs)
        if (obj_attrs ~= nil and obj_attrs ~= '') then
            -- V2.1 $R­eå‹å]MO Nb—/f&Tò]Ï~X[(W/T(u¶r`„vň±{å]US
            strCondition = "S_STATION = '" .. obj_attrs.S_STATION .. "' AND S_STATE = '/T(u'"
            nRet, nCount = mobox.getDBRecordCount(strLuaDEID, "TN_GT_Packing_Order", strCondition)
            if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), nCount) end
            if (tonumber(nCount) > 0) then
                lua.Error(strLuaDEID, debug.getinfo(1),
                    obj_attrs.S_STATION .. "å]MOò]X[(W/T(u¶r`„vň±{å]USÿ")
            end
 
            if (obj_attrs.S_STATE == '°eú^') then
                strCondition = "S_PACK_NO = '" .. obj_attrs.S_PACK_NO .. "'"
                strSetAttr = "S_STATE = '/T(u'"
                nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_Packing_Order", strCondition,
                    strSetAttr)
                if (nRet ~= 0) then
                    lua.Error(strLuaDEID, debug.getinfo(1), "¾‹n¶r`1Y%!" .. strRetInfo)
                end
            end
        end
    end
    -- V2.0 ¾‹n¶r`T7R°eGridu˜b—
    local strAction = '[{"action_type":"refresh","value":""}]'
    nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction•ï‹: " .. strRetInfo) end
end