--[[
|
编码: GT-100-18
|
名称: 空胶框回库
|
作者: LZH
|
入口函数:MESEmptyCntrReturn
|
功能说明: mes下发线边库起点,AGV搬运到二楼回库口
|
输入数据:
|
{
|
"startLocCode": "起点位置编码"
|
"cntrCode":"容器号"
|
}
|
|
处理逻辑
|
-- step1 解析接口传递的 datajson 参数
|
-- step2 校验必传字段是否为空,为空则报错
|
-- step3 重新计算终点货位
|
变更历史:
|
--]]
|
require("WMS-Equipment")
|
wms_cntr = require("wms_container")
|
wms_wh = require("wms_wh")
|
require("GT-Base")
|
function MESEmptyCntrReturn(strLuaDEID)
|
local nRet, in_date
|
-- step1 获取接口数据
|
nRet, in_date = m3.GetSysDataJson(strLuaDEID)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WCStoreCallback 无法获取数据包!" .. in_date) end
|
lua.Debug(strLuaDEID, debug.getinfo(1), '空工装返回参数:', in_date)
|
|
-- step2 判断 必填项 是否都有值?没值报错返回
|
local locationCode = in_date.startLocCode -- 起点位置
|
local CntrCode = in_date.cntrCode -- 容器号
|
if (locationCode == nil or locationCode == '') then lua.Error(strLuaDEID, debug.getinfo(1), "起点不能为空!") end
|
if (CntrCode == nil or CntrCode == '') then lua.Error(strLuaDEID, debug.getinfo(1), "容器号不能为空!") end
|
|
-- 绑定空托物料
|
local cg_detail = m3.AllocObject(strLuaDEID, "CG_Detail")
|
cg_detail.cntr_code = CntrCode
|
cg_detail.item_code = "KGZ"
|
cg_detail.item_name = "空工装"
|
cg_detail.qty = 1
|
cg_detail.uom = '个'
|
nRet, cg_detail = m3.CreateDataObj(strLuaDEID, cg_detail)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), '创建【容器货品明细】对象失败!' .. cg_detail) end
|
|
-- 获取起点信息
|
local loc_start
|
nRet, loc_start = wms_wh.Location_GetInfo(strLuaDEID, locationCode)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "WMS_Location_GetInfo失败! " .. loc_start) end
|
|
-- 创建空托盘组回库任务 一段任务agv搬运,二段任务国自搬运
|
local operation = m3.AllocObject(strLuaDEID, "Operation")
|
-- 起点信息
|
operation.start_wh_code = loc_start.wh_code
|
operation.start_area_code = loc_start.area_code
|
operation.start_loc_code = loc_start.code
|
|
operation.cntr_code = CntrCode
|
|
operation.op_type = wms_base.Get_nConst(strLuaDEID, "作业类型-入库")
|
operation.op_def_name = "AGV空托回库"
|
|
nRet, operation = m3.CreateDataObj(strLuaDEID, operation)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), '创建【作业】失败!' .. operation) end
|
end
|