1
Jianw
10 天以前 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
69
70
--[[
    编码: GK-20-28
    名称: 入库单领用-初始化
    作者:HAN  
    日期:2025-1-29
 
    级别:标准
    
    函数:InitialDlg
 
    功能:
        -- 入库波次界面中选择入库单进行合并(人工合并)时希望默认能获取当前电脑绑定的站台号
        -- 设置登录人员姓名
 
    更改记录:
 
--]]
 
wms_base = require( "wms_base" )
 
function InitialDlg ( strLuaDEID ) 
    local nRet, strRetInfo
   
    -- 获取当前登录人员账号名称及PC绑定的站台
    local login_info
    nRet, login_info = wms_base.Get_CurLoginUserInfo( strLuaDEID )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), login_info ) end
    local station_enable = true
    if ( login_info.station ~= '' ) then station_enable = false end
    
    local station_list = {}
    local cur_station = ''
    if ( login_info.station ~= '') then
        -- 获取当前站台的作业类型
        table.insert( station_list, login_info.station )
        cur_station = login_info.station
        station_enable = false                  -- 不能选站台
    else
        -- 获取所有可用的站台,类型是 WS(TP/SW)类型
        local station_objs, obj_attrs
 
        strCondition = "C_ENABLE = 'Y' AND S_TYPE = 'WS(TP/SW)'"
        nRet, station_objs = m3.QueryDataObject( strLuaDEID, "Machine_Station", strCondition, "S_CODE" )
        if nRet ~= 0 then 
            lua.Stop( strLuaDEID, "获取【Machine_Station】信息失败! " .. station_objs ) 
            return
        end
    
         for _, obj in ipairs( station_objs ) do
            obj_attrs = m3.KeyValueAttrsToObjAttr(obj.attrs)  
            table.insert( station_list, obj_attrs.S_CODE )  
         end  
         station_enable = true              
    end
 
    local action =  {
        {
            action_type = "set_dlg_attr",
            value = {
                { attr = "Operator", value = login_info.user_name, enable = false },
                { attr = "S_STATION_NO", value = cur_station, choice_list = station_list, enable = station_enable }
            }
        }
    }    
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction ) 
        return
    end 
end