--[[
|
编码: WMS-85-20
|
名称: 新增小窗口-初始化
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: InitialDlg
|
|
功能:
|
-- 获取【码盘单】中的码盘编码流水号,容器号属性
|
|
更改记录:
|
|
--]]
|
|
wms_cntr = require( "wms_container" )
|
|
function InitialDlg ( strLuaDEID )
|
local nRet, strRetInfo
|
local run_paramter
|
|
-- step1 获取运行环境参数
|
nRet, run_paramter = m3.GetRuntimeParam(strLuaDEID)
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), run_paramter ) end
|
local master = run_paramter.master
|
if (master == nil) then lua.Error( strLuaDEID, debug.getinfo(1), "系统没有在环境参数中定义master对象信息!" ) end
|
|
local cntr_code = master.objAttr.S_CNTR_CODE or ''
|
local inb_no = master.objAttr.S_IBP_NO or ''
|
|
if ( cntr_code == '' or inb_no == '') then return end
|
|
local cntr
|
nRet, cntr = wms_cntr.GetInfo( strLuaDEID, cntr_code )
|
if ( nRet ~= 0 ) then
|
return 2, cntr
|
end
|
|
local attr_value = {
|
{ attr = "S_IBP_NO", value = inb_no },
|
{ attr = "S_CNTR_CODE", value = cntr_code }
|
}
|
if ( cntr.type == "Cell_Box" ) then
|
local cell_list = {}
|
|
local strCondition = "S_CNTR_CODE = '"..cntr_code.."'"
|
nRet, data_objects = m3.QueryDataObject(strLuaDEID, "Container_Cell", strCondition, "S_CELL_NO" )
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "QueryDataObject失败!"..data_objects )
|
return
|
end
|
if ( data_objects ~= '') then
|
for n = 1, #data_objects do
|
data_attr = m3.KeyValueAttrsToObjAttr(data_objects[n].attrs)
|
table.insert( cell_list, data_attr.S_CELL_NO )
|
end
|
end
|
|
local attr_set = { attr = "S_CELL_NO", value = "", choice_list = cell_list }
|
table.insert( attr_value, attr_set )
|
|
local action = {
|
{
|
action_type = "set_dlg_attr",
|
value = attr_value
|
}
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action ) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction )
|
return
|
end
|
else
|
-- 如果不是带料格的料箱 不显示 料格
|
local action = {
|
{
|
action_type = "set_dlg_attr_show",
|
value = {
|
{ attr = "S_CELL_NO",show = false}
|
}
|
}
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str( action ) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction )
|
return
|
end
|
end
|
|
nRet, strRetInfo = mobox.setCurEditDataObjAttr( strLuaDEID, lua.table2str(attr_value) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "设置【逻辑库区】信息失败! "..strRetInfo )
|
return
|
end
|
end
|