fy36
2025-06-24 a3f50e5bd0d5ecbd0c5992da042fe4292dbb6911
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
--[[
    编码: WMS-33-10
    名称: 指定出库-新增窗口-初始化
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: InitialNewAddDlg
 
    功能:
          根据登录人员获取仓库下拉列表
 
    更改记录:
   
--]]
 
wms_base = require ("wms_base")
 
function InitialNewAddDlg ( strLuaDEID ) 
    local nRet, strRetInfo, factory, data_objs, n
 
    nRet, factory = m3.GetMyFactory( strLuaDEID )
    if ( factory == '' ) then
        nRet, factory = wms_base.Get_sConst2( strLuaDEID, "默认工厂标识", 1 )
        if ( nRet ~= 0 ) then
            lua.Stop( strLuaDEID, "系统无法获取常量'默认工厂标识'")
            return
        end        
    end
 
    local choice_list = {}
    if ( factory ~= '' ) then
        local strCondition
        local strOrder = 'S_CODE'
        strCondition = "S_FACTORY = '"..factory.."'"
 
        nRet, data_objs = m3.QueryDataObject( strLuaDEID, "Warehouse", strCondition, strOrder )
        if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【Warehouse】信息失败! " .. data_objs) end
        local obj_attrs
 
        for n = 1, #data_objs do
            obj_attrs = m3.KeyValueAttrsToObjAttr(data_objs[n].attrs)
            table.insert( choice_list, obj_attrs.S_CODE )
        end
 
    end
 
    local action = {
        {
            action_type = "set_dlg_attr",
            value = {
                { attr = "S_WH_CODE", value = "81" },--, choice_list = choice_list
                { attr = "S_AREA_CODE", value = "ZG2" },
                { attr = "N_TYPE", value = "1"}
            }
        },
        {
            action_type = "set_dlg_attr_show",   
            value = {
                { attr = "S_ITEM_CODE", show = false },
                { attr = "S_ITEM_NAME", show = false }
            }                     
        }
    }
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
end