Jianw
2025-05-14 29f8b36ebb718d2051bf0e7e701973ec4419ee80
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
--[[
    编码: WMS-15-07
    名称: 收货单-主从面板-初始化
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: InitailPanel
 
    功能:
        1)新增收货单的主从窗口时,对仓库根据工厂进行初始化
    更改记录:
 
--]]
 
wms_wh = require( "wms_wh" )
 
function InitailPanel ( strLuaDEID ) 
    local nRet, strRetInfo, factory
 
    -- 获取当前操作者的 工厂标识 
    nRet, factory = m3.GetMyFactory( strLuaDEID ) 
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetMyFactory失败! "..factory ) end
 
    -- 获取工厂下面的仓库列表
    local nWHCount, wh_list
    local nAreaCount, area_list
    local wh_code = ''
    local area_code = ''
    local area_list = ''
 
    nWHCount, wh_list = wms_wh.GetWarehouse( strLuaDEID, factory )
    -- 如果只有一个仓库,直接就选中这个仓库,并且列出这个仓库中的 收货区
    if ( nWHCount == 1 ) then 
        wh_code = lua.trim_quotation_mark( wh_list )        -- 取消字符串前后的"
        -- 获取仓库中的收货区域
        nAreaCount, area_list = wms_wh.GetArea( strLuaDEID, wh_code, "库区类型-收货区" )
        if ( nAreaCount == 1 ) then area_code = lua.trim_quotation_mark( area_list ) end
    end
 
    local setAttr = '[{"attr":"S_FACTORY","value":"'..factory..'"},{"attr":"S_WH_CODE","value":"'..wh_code..'","choice_list":['..wh_list..']}'
    local setAttr = setAttr..',{"attr":"S_AREA_CODE","value":"'..wh_code..'","choice_list":['..area_list..']}]'
    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), "setAction失败! "..strRetInfo..' action = '..strAction ) end     
end