--[[
|
编码: WMS-40-20#3
|
名称: 作业-入库-启动
|
作者:HAN
|
日期:2025-1-29
|
|
版本: V1.0
|
|
说明:该脚本和项目关联度较高,会根据项目不同而不同, 适合Picking车调度
|
|
函数: OperationStart
|
|
|
功能:
|
-- 创建一个 Picking 车任务实现from-->to 的搬运
|
|
更改说明:
|
|
--]]
|
|
wms_op = require( "wms_operation" )
|
wms_wh = require( "wms_wh" )
|
|
function OperationStart ( strLuaDEID )
|
local nRet, strRetInfo, msg
|
|
-- 获取作业对象
|
local operation_obj = {}
|
nRet, operation_obj = m3.GetSysCurEditDataObj( strLuaDEID, "Operation" )
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "获取作业对象属性失败!"..operation_obj )
|
return
|
end
|
|
local to_wh_code, to_area_code, to_loc_code
|
if lua.StrIsEmpty( operation_obj.end_loc_code ) then
|
to_loc_code = ''
|
if lua.StrIsEmpty( operation_obj.end_area_code ) then
|
lua.Stop( strLuaDEID, "作业中目前货位库区全部为空!" )
|
return
|
end
|
local area
|
nRet, area = wms_wh.GetAreaInfo( operation_obj.end_area_code )
|
if nRet ~= 0 then
|
lua.Stop( strLuaDEID, area )
|
return
|
end
|
to_wh_code = area.wh_code
|
to_arae_code = area.code
|
else
|
local to_loc
|
nRet, to_loc = wms_wh.GetLocInfo( operation_obj.end_loc_code )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "获取货位'"..operation_obj.end_loc_code.."'信息失败! "..to_loc )
|
return
|
end
|
to_wh_code = to_loc.wh_code
|
to_area_code = to_loc.area_code
|
to_loc_code = to_loc.code
|
end
|
|
if lua.StrIsEmpty( operation_obj.cntr_code ) then
|
msg = '容器号不能为空! '
|
lua.Warning( strLuaDEID, debug.getinfo(1), msg )
|
lua.Stop( strLuaDEID, msg )
|
return
|
end
|
|
-- 创建输送线搬运任务
|
local task = m3.AllocObject(strLuaDEID,"Task")
|
|
-- 创建 Picking车搬运任务
|
task.op_code = operation_obj.code -- 作业编码
|
task.source_sys = operation_obj.source_sys -- 来源系统
|
task.op_name = operation_obj.op_def_name
|
task.factory = operation_obj.factory -- 工厂
|
task.bs_type = operation_obj.bs_type
|
task.bs_no = operation_obj.bs_no
|
|
task.type = TASK_TYPE.In_Picking
|
task.cntr_code = operation_obj.cntr_code
|
-- 起点
|
task.start_wh_code = operation_obj.start_wh_code
|
task.start_area_code = operation_obj.start_area_code
|
task.start_loc_code = operation_obj.start_loc_code
|
-- 终点
|
task.end_wh_code = to_wh_code
|
task.end_area_code = to_area_code
|
task.end_loc_code = to_loc_code
|
nRet, task.schedule_type = wms_base.Get_nConst2("调度类型-国自")
|
if nRet ~= 0 then
|
lua.Stop( strLuaDEID, "系统没定义'调度类型-国自'的常量" )
|
return
|
end
|
|
nRet, task = m3.CreateDataObj(strLuaDEID, task)
|
if nRet ~= 0 then
|
lua.Stop( strLuaDEID, "创建输送机任务失败!"..task )
|
return
|
end
|
|
-- 入库货位不加入库锁, Picking 车会根据路径在合适的位置确定一个货位
|
end
|