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
ÿþ--[[
   x: GT-04-12
    Tðy: ¹pûQnxš[T
   \O€ÿLZH
   åegÿ2024/8/21
 
   ýQpeÿ ClickOk
   ŸRý€: $R­e:ghVx/f&Tò]X[(W ÿX[(WRîO9e ÿ NX[(WRRú^
 
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function ClickOk( strLuaDEID )
    nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "S_PDA_NO","S_STATION","S_START_LOC")
    if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! " .. strRetInfo) end
    local obj_attrs = json.decode(strRetInfo)
    local pda_no = obj_attrs[1].value -- pda¾‹Yx
    local station = obj_attrs[2].value -- å]MO
    local start_loc = obj_attrs[3].value -- w¹p'MO
    if (pda_no == nil or pda_no == '') then lua.Error(strLuaDEID, debug.getinfo(1), "pda¾‹Yx Ný€:Nzz!") end
    if (station == nil or station == '') then lua.Error(strLuaDEID, debug.getinfo(1), "å]MO Ný€:Nzz!") end
    if (start_loc == nil or start_loc == '') then lua.Error(strLuaDEID, debug.getinfo(1), "w¹p'MO Ný€:Nzz!") end
    
    strCondition = "S_PDA_NO = '" .. pda_no .. "'"
    nRet, strRetInfo = m3.GetDataObjByCondition(strLuaDEID, "GT_PDA_Station", strCondition)
    if (nRet ~= 0 and nRet ~= 1) then
       lua.Error(strLuaDEID, debug.getinfo(1), "m3.GetDataObjByCondition 1Y%!" .. strRetInfo)
    end
    if(nRet == 1) then
        local pda_station = m3.AllocObject(strLuaDEID, "GT_PDA_Station")
        pda_station.pda_no = pda_no
        pda_station.station = station
        pda_station.start_loc_code = start_loc
        lua.Debug(strLuaDEID, debug.getinfo(1), 'pda_station', pda_station)
        nRet, pda_station = m3.CreateDataObj(strLuaDEID, pda_station)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), 'mobox Rú^0PDAå]MOsQû|0ù[aŒ1Y%!' .. pda_station) end
    else
        local strSetSQL_update
        strCondition = " S_PDA_NO = '" .. pda_no .. "' "
        strSetSQL_update = " S_STATION = '"..station.."',S_START_LOC = '"..start_loc.."'"
        nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "GT_PDA_Station", strCondition,strSetSQL_update)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "îO9ePDAå]MOsQû|hˆ1Y%ÿ" .. strRetInfo) end
    end
    
    mobox.setInfo(strLuaDEID,"Ñ~š[bŸR!")
end