--[[
|
编码: GK-40-25
|
名称: 移库作业-任务完成
|
作者:HAN
|
日期:2025-1-29
|
|
版本: V1.0
|
|
场景:作业中的任务完成后触发这个脚本
|
当前数据对象指针是 【作业】Operation
|
【任务】对象属性保存在输入参数 InputParamter
|
|
|
函数: TaskFinish
|
|
功能:
|
|
更改记录:
|
|
--]]
|
wms_op = require( "wms_operation" )
|
|
function TaskFinish ( strLuaDEID )
|
local nRet, strRetInfo
|
local strErr = ''
|
|
-- 获取 触发【作业】任务完成事件的场景参数
|
local task
|
nRet, task = m3.SysInputParamToDataObj( strLuaDEID, "Task")
|
if (nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, debug.getinfo(1), task )
|
return
|
end
|
|
local operation
|
nRet, operation = m3.GetSysCurEditDataObj( strLuaDEID, "Operation" )
|
if (nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, operation )
|
return
|
end
|
|
-- 判断任务类型
|
if ( task.type == TASK_TYPE.Move_Picking ) then
|
local strUpdateSql, strCondition
|
|
nRet, strRetInfo = wms_op.SetFinish( strLuaDEID, operation )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "设置作业编号='"..operation.code.."' 的作业完成失败!"..strRetInfo )
|
return
|
end
|
|
-- 更新作业的 end_loc / Pickin车的位置是由 AGV确定的
|
strUpdateSql = "S_END_WH = '"..task.end_wh_code.."', S_END_AREA = '"..task.end_area_code.."', S_END_LOC = '"..task.end_loc_code.."'"
|
strCondition = "S_CODE = '"..task.op_code.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Operation", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "更新【作业】信息失败!"..strRetInfo )
|
return
|
end
|
|
else
|
lua.Stop( strLuaDEID, "任务编号='"..task.code.."' 的任务类型不对!" )
|
return
|
end
|
end
|