m3 = require("oi_base_mobox")
|
lua = require("oi_base_func")
|
json = require("json")
|
mobox = require("OILua_JavelinExt")
|
wms_base = require("wms_base")
|
wms_cntr = require("wms_container")
|
|
function CreateOpbyNum(strLuaDEID)
|
local nRet, strRetInfo
|
-- step1获取当前表头输入的数量
|
nRet, strRetInfo = m3.GetSysInputParameter(strLuaDEID)
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "获取当前输入面板里的属性失败! " .. strRetInfo)
|
end
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), "strRetInfo", strRetInfo)
|
local input_attr = m3.KeyValueAttrsToObjAttr(strRetInfo.attrs)
|
|
local op_num = tonumber(input_attr.N_NUM)
|
local end_loc = input_attr.S_END_LOC
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), "end_loc", end_loc)
|
local cntr_code
|
|
if (op_num <= 0) then
|
lua.Stop(strLuaDEID, "输入数量不能为0!")
|
return
|
end
|
|
|
if (op_num > 5) then
|
lua.Stop(strLuaDEID, "输入数量不能大于5!")
|
return
|
end
|
|
-- 创建作业
|
local operation = m3.AllocObject(strLuaDEID, 'Operation')
|
-- operation.op_def_code = op_code -- 作业定义编码
|
operation.op_type = 3 --作业类型(移库)
|
operation.op_def_name = "料箱出库" -- 作业名称
|
operation.bs_state = 0 -- 状态
|
|
|
-- 起点信息
|
operation.start_wh_code = "0001" -- 仓库
|
operation.start_area_code = "0001" -- 库区
|
operation.start_loc_code = "S-A" -- 货位
|
-- 终点信息
|
operation.end_wh_code = "0001" -- 终点仓库
|
operation.end_area_code = "0001" -- 终点库区
|
operation.end_loc_code = end_loc -- 终点货位
|
operation.code_qty = op_num -- 托盘数量
|
|
-- operation.cntr_code = cntrcode
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), '作业创建前:', operation)
|
|
nRet, strRetInfo = m3.CreateDataObj(strLuaDEID, operation)
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), '创建【作业】失败!' .. strRetInfo)
|
end
|
|
end
|