--[[
|
编码: JX-01-25
|
名称: 空料箱入库确定后
|
作者:KUN
|
日期:2025-03-06
|
|
函数: ClickOK
|
功能:
|
-- 获取输入参数,查询移库单是否有记录,再查询任务池是否有记录
|
-- 创建任务池
|
|
更改记录:
|
|
--]]
|
|
wms_cntr = require( "wms_container" )
|
jx_base = require( "jx_base" )
|
wms_wh = require( "wms_wh" )
|
|
function ClickOK( strLuaDEID )
|
local attrs
|
-- 获取输入参数
|
nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "获取当前输入面板里的属性失败! " .. attrs)
|
return
|
end
|
lua.Debug(strLuaDEID, debug.getinfo(1), "attrs", attrs)
|
|
local input_attr = m3.KeyValueAttrsToObjAttr(attrs)
|
|
local cntr_code = input_attr.S_CODE
|
local spec = input_attr.S_SPEC
|
local cell_code = input_attr.cell_code
|
|
|
if (cntr_code == nil or cntr_code == '') then
|
mobox.setInfo(strLuaDEID, "容器编码不能为空!")
|
return
|
end
|
|
-- 创建 JX_Task 任务池
|
-- 查询该料箱是否有任务池,有则不创建
|
local strCondition = "S_CNTR_CODE = '" .. cntr_code .. "' AND N_B_STATE = 0 "
|
local nRet, data_objs = m3.QueryDataObject(strLuaDEID, "JX_Task", strCondition)
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, debug.getinfo(1), "查询任务池失败! " .. data_objs)
|
return
|
end
|
if (data_objs == '') then
|
|
local now = os.date("%Y%m%d%H%M%S")
|
local randomNum = math.random(1, 99999)
|
local strHeader = 'RK'..os.date("%y%m%d")..'-'
|
local str_no
|
|
-- 获取码盘单号
|
nRet, str_no = mobox.getSerialNumber( "巨星任务", strHeader, 4 )
|
if (nRet ~= 0) then
|
lua.Error( strLuaDEID, debug.getinfo(1),'申请码盘单编码失败!'..str_no)
|
end
|
local jx_task = m3.AllocObject(strLuaDEID, "JX_Task")
|
jx_task.cntr_code = cntr_code -- 托盘号
|
jx_task.source_sys = "巨沃入库" -- 来源系统
|
jx_task.sour_no = str_no -- 上游任务号
|
jx_task.end_area_code = wms_base.Get_sConst(strLuaDEID, "料箱库存储区")
|
jx_task.task_type = "入库" -- 作业类型
|
jx_task.create_method = "JW-WMS"
|
jx_task.start_wh_code = wms_base.Get_sConst(strLuaDEID, "默认仓库标识")
|
|
nRet, jx_task = m3.CreateDataObj(strLuaDEID, jx_task)
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "创建 JX_Task 任务池记录失败! " .. jx_task)
|
end
|
mobox.setInfo(strLuaDEID, "创建成功!")
|
else
|
mobox.setInfo(strLuaDEID, "料箱: " .. cntr_code.. "已经有任务池,不能再创建")
|
end
|
-- 清空"料格转换"页面
|
local action = {}
|
action[1] = {
|
action_type = "clear_subpage_rows",
|
value = {
|
page_name = "料箱信息"
|
}
|
}
|
action[2] = {
|
action_type = "set_dlg_attr",
|
value = {
|
{
|
attr = "S_CODE",
|
value = ""
|
}
|
}
|
}
|
|
action[3] = {
|
action_type = "set_dlg_current_edit_attr",
|
value = "S_CODE"
|
}
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "清空页面失败! " .. strRetInfo)
|
return
|
end
|
|
|
|
end
|