--[[
|
编码: WMS-81-15
|
名称: 出入库测试-新增窗口-选容器前
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: BeforeSelectCntr
|
|
功能:
|
弹出容器查询面板
|
更改记录:
|
|
--]]
|
|
wms_base = require( "wms_base" )
|
|
function BeforeSelectCntr ( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 获取仓库编码
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_TEST_TYPE","S_TO_AREA_CODE","S_TO_LOC_CODE","S_CNTR_FROM" )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo )
|
return
|
end
|
local obj_attrs = json.decode( strRetInfo )
|
local test_type = lua.Get_StrAttrValue( obj_attrs[1].value )
|
local area_code = lua.Get_StrAttrValue( obj_attrs[2].value )
|
local loc_code = lua.Get_StrAttrValue( obj_attrs[3].value )
|
local cntr_from = lua.Get_StrAttrValue( obj_attrs[4].value )
|
if ( area_code == '' or test_type == '') then return end
|
|
local seg = {}
|
seg = lua.split( area_info, '#' )
|
local area_code = seg[1]
|
local strCondition = ''
|
|
if ( loc_code == '' or loc_code == nil ) then
|
mobox.setInfo( strLuaDEID, "必须先选一个货位!" )
|
return
|
end
|
|
if ( test_type == "入库" ) then
|
if ( cntr_from == "码盘单" ) then
|
-- 如果是入库,选[码盘] 状态 = 10/码盘中 11/码盘完成的
|
strCondition = 'S_CODE IN ( Select S_CNTR_CODE From TN_Inbound_Palletization where N_B_STATE <= '..PALLET_STATE.PalletOK..')'
|
elseif ( cntr_from == "空料箱" ) then
|
-- 没有货位绑定,并且是空的料箱
|
strCondition = "S_POSITION = '' AND N_EMPTY_FULL = 0"
|
else
|
mobox.setInfo( strLuaDEID, "容器来源不合规!" )
|
return
|
end
|
else
|
-- 如果是出库,选的容器必须是在选中库区的
|
strCondition = 'S_CODE IN ( Select S_CNTR_CODE From TN_Loc_Container '
|
strCondition = strCondition.." Where S_LOC_CODE = '"..loc_code.."')"
|
end
|
|
-- 设置 action 的参数
|
local action = {
|
{
|
action_type = "open_data_query_dlg",
|
value = {
|
multi_choice = false, -- 不多选
|
cls_name = "Container", -- 选择的数据类标识
|
grid_style = "basis-选择面板用", -- 选择面板中 GridStyle
|
condition = strCondition,
|
order = "S_CODE"
|
}
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, strRetInfo )
|
return
|
end
|
end
|