--[[
|
编码: WMS-20-29#2
|
名称: 点领用按钮后
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
来源艾默生项目,选中一个入库单进行入库
|
|
函数: ClickReceiveButton
|
|
功能:
|
-- 点击领用按钮
|
|
更改记录:
|
|
--]]
|
|
wms_base = require ("wms_base")
|
|
function ClickReceiveButton ( strLuaDEID )
|
local nRet, strRetInfo, n
|
local data_json
|
|
nRet, data_json = m3.GetSysDataJson( strLuaDEID )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), data_json ) end
|
local nCount = #data_json
|
if ( nCount == 0 ) then
|
mobox.setInfo( strLuaDEID, "必须选中一个入库单!" )
|
return
|
end
|
if ( nCount > 1 ) then
|
mobox.setInfo( strLuaDEID, "多选无用,只会先一个入库单进行领用!" )
|
end
|
|
--V4.0 HAN 2025/3/12
|
local inbound_obj
|
local checked_data_json = {}
|
|
nRet, inbound_obj = m3.GetDataObject( strLuaDEID, "Inbound_Order", data_json[1].id )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, inbound_obj )
|
return
|
end
|
|
table.insert( checked_data_json, data_json[1] )
|
|
-- 获取输入界面中的工作台属性
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "Station" )
|
local input_value = json.decode( strRetInfo )
|
local station = lua.Get_StrAttrValue( input_value[1].value )
|
|
if ( station == '' ) then
|
mobox.setInfo( strLuaDEID, "必须选择一个工作站!" )
|
return
|
end
|
local strUserLogin, strUserName
|
nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
|
if ( nRet ~= 0 ) then
|
mobox.setInfo( strLuaDEID, "获取当前操作人员信息失败! "..strUserLogin )
|
return
|
end
|
|
-- 组织后台脚本执行的输入参数
|
local parameter = {
|
factory = inbound_obj.factory,
|
as_model = "picking", -- 自动化立库模式 stacker、agv、picking
|
station = station,
|
login = strUserLogin,
|
user_name = strUserName,
|
data_json = checked_data_json,
|
cntr_out_op_def = "料箱出库",
|
cntr_back_op_def = "货品入库"
|
}
|
|
nRet, strRetInfo = mobox.addBackendScriptProc( "Inbound_Order","入库预分配料箱2#算法", lua.table2str( parameter ) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
|
|
local data_json = {proc_id = strRetInfo}
|
local action =
|
{
|
{
|
action_type = "wait",
|
value = {
|
time = 1,
|
event = {
|
cls_name = "入库单",
|
event_name = "获取入库空料箱计算结果",
|
data_json = data_json
|
}
|
}
|
},
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction )
|
return
|
end
|
|
end
|