Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
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
--[[
    编码: WMS-81-13
    名称: 出入库测试-新增窗口-选目标货位前
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: BeforeSelectLoc
 
    功能:
        弹出货位查询面板
    更改记录:
        V2.0 HAN 2024-03-29 改了一下查询条件
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function BeforeSelectLoc ( strLuaDEID )
    local nRet, strRetInfo
 
    -- 获取仓库编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_TO_WH_CODE","S_TO_AREA_CODE","S_TEST_TYPE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local wh_code = lua.Get_StrAttrValue( obj_attrs[1].value )
    local area_info = lua.Get_StrAttrValue( obj_attrs[2].value )
    local test_type = lua.Get_StrAttrValue( obj_attrs[3].value )
    if ( area_info == '' or  wh_code == '') then return end
 
    local seg = {}
    seg = lua.split( area_info, '#' )
    local area_code = seg[1]
 
    -- 设置 action 的参数
    local action = {}
    local value = {}
    action.action_type = "open_data_query_dlg"
    value.multi_choice = false                      -- 不多选
    value.cls_name = "Location"                     -- 选择的数据类标识
    value.grid_style = "basis-选择面板用"                  -- 选择面板中 GridStyle
    -- 选择wh_code仓库area_code库区,已经启用并且没有被锁,并且有空余容量的货位
    value.condition = "S_WH_CODE = '"..wh_code.."' AND S_AREA_CODE = '"..area_code.."' AND C_ENABLE = 'Y' AND N_LOCK_STATE = 0 AND "
    if ( test_type == "入库" ) then
        value.condition = value.condition.." N_CURRENT_NUM = 0"
    else
         value.condition = value.condition.." N_CURRENT_NUM > 0"
    end
    value.order = "S_CODE" 
    action.value = value
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, '['..lua.table2str(action)..']' )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
end