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
ÿþ--[[
   x: GT-27-10
    Tðy: Í‘°eÑS÷‹Bl
   \O€ÿlzh
   åegÿ2024-12-17
 
   ýQpeÿ Resend
   ŸRý€:
 
   ôf9e°‹U_:
 
--]]
 
json  = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function Resend(strLuaDEID)
    local nRet, strRetInfo, objs
 
    -- ·ƒÖ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), 'ÂSpe:', objs)
 
    local obj_attrs
    for n = 1, #objs do
        local id = lua.trim_guid_str( objs[n].id )
        obj_attrs = m3.KeyValueAttrsToObjAttr(objs[n].attrs)
        if (obj_attrs ~= nil and obj_attrs ~= '') then
            -- if (obj_attrs.S_STATE == '1Y%') then
                local strurl = obj_attrs.S_URL
                local strHeader = ""
                local strBody = obj_attrs.S_BODY
                nRet, strRetInfo = mobox.sendHttpRequest(strurl, strHeader, strBody)
                if (nRet ~= 0) then
                    lua.Error(strLuaDEID, debug.getinfo(1), "Œ(uGTWMSÞV O¥cãS1Y%!" .. strRetInfo)
                end
                if (strRetInfo == '' or strRetInfo == nil) then
                    lua.Error(strLuaDEID, debug.getinfo(1), "Œ(uGTWMSÞV O¥cãSԏÞV:Nzz!")
                else
                    lua.Debug(strLuaDEID, debug.getinfo(1), 'strRetInfo', strRetInfo)
                    local success, resJson = pcall(json.decode, strRetInfo)
                    if (success == false) then lua.Error(strLuaDEID, debug.getinfo(1), "^—Õl„vJSON<h_!" .. resJson) end
                    local success,message
                    if(obj_attrs.S_SOURCE == 'GTWMS')then
                        success = resJson.success
                        message = resJson.message
                    elseif(obj_attrs.S_SOURCE == 'AGV')then
                        success = resJson.code
                        message = resJson.msg
                    elseif(obj_attrs.S_SOURCE == 'WCS')then
                        success = resJson.result_flag
                        message = resJson.err_msg
                    end
                    lua.Debug(strLuaDEID, debug.getinfo(1), 'success', success)
                    lua.Debug(strLuaDEID, debug.getinfo(1), 'message', message)
                    if(tonumber(success) == 1)then
                        success = false
                    end
                    lua.Debug(strLuaDEID, debug.getinfo(1), 'success', success)
 
                    local strCondition = "S_ID = '" .. id .. "'"
                    local strSetAttr = ''
                    if (success == false) then
                        strSetAttr = "S_ERR = '"..message.."',S_STATE = '1Y%'"
                    else
                        strSetAttr = "S_ERR = '',S_STATE = 'bŸR'"
                    end
                    nRet, strRetInfo = mobox.updateTableAttrByCondition(strLuaDEID, "TN_GT_Interface_Exc", strCondition,
                        strSetAttr)
                    if (nRet ~= 0) then
                        lua.Error(strLuaDEID, debug.getinfo(1), "¾‹n¶r`1Y%!" .. strRetInfo)
                    end
                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