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, objs
|
|
-- step1获取当前表头输入的终点
|
nRet, strRetInfo = m3.GetSysInputParameter(strLuaDEID)
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "获取当前输入面板里的属性失败! " .. strRetInfo)
|
end
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), "GetSysInputParameter", strRetInfo)
|
local input_attr = m3.KeyValueAttrsToObjAttr(strRetInfo.attrs)
|
|
local end_loc = input_attr.S_END_LOC -- 任务终点
|
|
-- step2获取选中的数据
|
nRet, objs = m3.GetSysDataJson(strLuaDEID)
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "获取当前输入面板里的属性失败! " .. objs)
|
end
|
if (strRetInfo == '') then
|
lua.Error(strLuaDEID, debug.getinfo(1), 'CancelTaskByNo传递数据为空')
|
return
|
end
|
|
lua.Debug(strLuaDEID, debug.getinfo(1), 'GetSysDataJson:', objs)
|
|
for n = 1, #objs do
|
|
local deliv_order = m3.KeyValueAttrsToObjAttr(objs[n].attrs)
|
lua.Debug(strLuaDEID, debug.getinfo(1), "deliv_order:", deliv_order)
|
local area_code = deliv_order.S_AREA_CODE
|
local cntr_code = deliv_order.S_CNTR_CODE
|
local start_loc = deliv_order.S_LOC_CODE
|
|
if (start_loc == "") then
|
start_loc = "S-A"
|
end
|
if (area_code ~= "0001") then
|
lua.Stop(strLuaDEID, "请选择立库区中的托盘")
|
end
|
|
-- 创建指定出库作业
|
|
local operation = m3.AllocObject(strLuaDEID, 'Operation')
|
-- operation.op_def_code = op_code -- 作业定义编码
|
operation.op_type = 2 --出库
|
operation.op_def_name = "指定出库_测试" -- 作业名称
|
operation.bs_state = 0 -- 状态
|
|
operation.op_def_code = "OP012"
|
|
operation.cntr_code = cntr_code
|
|
-- 起点信息
|
operation.start_wh_code = "0001" -- 仓库
|
operation.start_area_code = area_code -- 库区
|
operation.start_loc_code = start_loc -- 起点货位
|
-- 终点信息
|
operation.end_wh_code = "0001" -- 终点仓库
|
operation.end_area_code = area_code -- 终点库区
|
operation.end_loc_code = end_loc -- 终点货位
|
|
|
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
|
end
|