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
ÿþ--[[
    x: WMS-03-10
     Tðy: “^:S-°ežX\—zãSRËYS
    \O€ÿHAN  
    åegÿ2023-7-26
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
    
    ýQpeÿ InitialNewAddDlg
 
    ŸRý€:
        1    ÿ9hncS_MRÍd\O€·ƒÖSÍd\O€„v@b^\USMOx ÿŠbُ*Nx¾‹n0R S_FACTORY
        2    ÿ9hncå]‚S·ƒÖSå]‚S N^\„vÓN“^
    ôf9e°‹U_:
        V6.0 HAN 2023/9/6  -- lua.Error/lua.Debug ýQpeØSS        
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function InitialNewAddDlg ( strLuaDEID ) 
    local nRet, strRetInfo
 
    local strUserLogin, strUserName
    nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MRÍd\OºNXTáOo`1Y%! "..strUserLogin ) end
    -- ·ƒÖSS_MRÍd\OºNXT„vUSMOx ÿ\O:Nå]‚ShƋ
    -- nRet, strRetInfo = mobox.getUserSectionUnit( strUserLogin )
    -- if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MRÍd\OºNXT@b^\USMO1Y%! "..strRetInfo ) end
    -- local orgInfo = json.decode( strRetInfo ) 
    factory = "106"
 
    local choic_items = ''
    local wh_code = ''
    if ( factory ~= '' ) then
        local strCondition
        local strOrder = 'S_CODE'
        strCondition = "S_FACTORY = '"..factory.."'"
        nRet, strRetInfo = mobox.queryDataObjAttr(strLuaDEID, "Warehouse", strCondition, strOrder,"S_CODE" )
        if (nRet ~= 0) then error( "·ƒÖS0ÓN“^0áOo`1Y%! " .. strRetInfo) end
        if ( strRetInfo ~= '' ) then
            local warehouse = {}
            local n, nCount
            local success
            local attrs
            success, warehouse = pcall( json.decode, strRetInfo)
            if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS0ÓN“^0áOo`1Y%! ^—Õl„vJSON<h_!"..warehouse ) end
 
            nCount = #warehouse
            -- Ä~Ç~ NÉbRhˆ    y˜
            
            for n = 1, nCount do
                attrs = warehouse[n].attrs
                choic_items = choic_items..'"'..attrs[1].value..'",'
            end
            choic_items = lua.trim_laster_char( choic_items )
            -- ‚YœgêS    gN*NÓN“^ ÿ£HN1\؞¤‹    Ù*NÓN“^
            if ( nCount == 1) then wh_code = attrs[1].value end
        end
    end
 
    local setAttr = '[{"attr":"S_FACTORY","value":"'..factory..'"},{"attr":"S_WH_CODE","value":"'..wh_code..'","choice_list":['..choic_items..']}]'
    local strAction = '[{"action_type":"set_dlg_attr","value":'..setAttr..'}]'
    nRet, strRetInfo = mobox.setAction( strLuaDEID, strAction  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction1Y%! "..strRetInfo..' action = '..strAction ) end 
end