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
ÿþ--[[
    x: WMS-05-01
     Tðy: ;‘“^:S-Rú^MR
    \O€ÿHAN  
    åegÿ2023-03-05
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
    
    ýQpeÿ BeforeDataObjCreate
 
    ŸRý€:
        -- ub;‘“^:Sx
        -- ubN›Npe<P^\'`„v Tðy N_LOCK_STATE ÿN_TYPE
 
    ôf9e°‹U_:
        V2.0 HAN 2023-6-11
            °ežXù[ S_LOCK_STATE S_ZONE_TYPE „vRËYSÍd\O
        V3.1 HAN 2023-7-2
            getDictItemIInfo 9eb wms_GetDictTypeName   
        V4.1 HAN 2023-8-9  wmsøvsQ¥cãSŒte  
        V4.2 wms_GetDictTypeName -> wms_base.GetDictItemName  
        V6.0 HAN 2023/9/6  -- lua.Error/lua.Debug ýQpeØSS  
        V6.1 HAN 2023/9/20 -- N_ZONE_TYPE 9eb N_TYPE                   
--]]
require ("WMS-BASE")
 
function BeforeDataObjCreate ( strLuaDEID ) 
    local   nRet, strRetInfo
 
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "N_LOCK_STATE", "N_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local nLockState = lua.StrToNumber(obj_attrs[1].value)           -- •¶r`
    local nZoneType = lua.StrToNumber(obj_attrs[2].value)           -- ;‘“^:S{|‹W
 
    -- ub0;‘“^:S0x
    local strCode = ''
    local strHeader = 'Z'
    nRet,strCode = mobox.getSerialNumber( ";‘“^:S", strHeader, 4 )  
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1),'[1] 3u÷‹0;‘“^:S0x1Y%!'..strCode ) end
   
    -- 9hncW[xQ·ƒÖS N_LOCK_STATE „v>f:y Tðy
    local str_lock_state = wms_base.GetDictItemName( strLuaDEID, "WMS_LocationLockState", nLockState ) 
    -- 9hncW[xQ·ƒÖS N_ZONE_TYPE „v>f:y Tðy
    local str_zone_type = wms_base.GetDictItemName( strLuaDEID, "WMS_AreaType", nZoneType ) 
 
    -- ¾‹náOo`
    local   attr_value = {}
    attr_value[1] = lua.KeyValueObj( "S_CODE", strCode )
    attr_value[2] = lua.KeyValueObj( "S_LOCK_STATE", str_lock_state )
    attr_value[3] = lua.KeyValueObj( "S_TYPE", str_zone_type )
    nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1),"[2] ¾‹n0;‘“^:S0áOo`1Y%!  "..strRetInfo ) end   
end