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
ÿþ--[[
   x: 
    Tðy: 
   \O€ÿ
   åegÿ2024-11-13
 
   ýQpeÿ BeforeDataObjCreate
   ŸRý€:  9hncf!kæ‹Å`ù[aŒ„vir™eÍy{|egRM‘ è•MO ÿ‚Yœgè•kS„v¶r`:N zzò•-N R¾‹nå‹f!kæ‹Å`°‹U_¶r`:N xS'-N
 
   ôf9e°‹U_:
 
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function BeforeDataObjCreate( strLuaDEID )
    local   nRet, strRetInfo
    -- step1  ·ƒÖSS_MRRú^„váOo`
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_ITEM_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local item_type = obj_attrs[1].value         -- ir™e{|‹W
 
    -- Çir™e{|‹W ÿ·ƒÖS0“^MOir™ehÆQ0ù[”^„vè• ÿ‚Yœg/f (u „vè•R–:gRM‘è•MO
    local dock_door
    local strCondition = "S_ITEM_TYPE = '"..item_type.."'"
    nRet, dock_door = m3.GetDataObjByCondition( strLuaDEID, "GT_Dock_Doors", strCondition )
    -- ‚Yœg nRet == 1 ãNhˆ¡l    g&{TagöN„v°‹U_ ÿRُ*Nf!k„vir™e/f(uè•
    if ( nRet == 1 ) then 
        -- åg⋐(uè•/f&TX[(Wzzò•¶r`„v è•MORM‘ ÿ NX[(WR NRM‘
        strCondition = "S_STATUS = 'zzò•-N' AND S_CODE IN (SELECT S_CODE FROM TN_GT_Loc_Material WHERE S_ITEM_TYPE = '"..item_type.."')"
        nRet, dock_door = m3.GetDataObjByCondition( strLuaDEID, "GT_Dock_Doors", strCondition,strOrder )
        if(nRet == 1) then 
            return 
        elseif( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetDataObjByCondition1Y%! "..dock_door ) end
    elseif ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetDataObjByCondition1Y%! "..dock_door ) end
    lua.Debug(strLuaDEID, debug.getinfo(1), 'dock_door', dock_door)
 
    -- ¾‹náOo`
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_DOOR_CODE", dock_door.code )
    if(dock_door.status == 'zzò•-N') then
        attr_value[2] = lua.KeyValueObj( "S_STATUS", "xS'-N" )
        
        -- îO9e 0xS'è•¡{t0„v¶r`:NxS'-N
        strCondition = "S_CODE = '"..dock_door.code.."'"
        local strUpdateSQL = "S_STATUS = 'xS'-N'"
        nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "GT_Dock_Doors", strCondition, strUpdateSQL )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "updateDataAttrByCondition1Y%! "..strRetInfo ) end 
    end
 
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    lua.Debug(strLuaDEID, debug.getinfo(1), 'lua.table2str(attr_value)', lua.table2str(attr_value))
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "¾‹náOo`1Y%!  "..strRetInfo ) end   
end