--[[
|
编码: JX-52-18
|
名称: 出库分拣-分拣任务强制完成
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: SetPickingTaskFinish
|
功能:
|
分拣出库的时候出库数量不足时点 该 按钮可以完成分拣出库任务
|
|
更改记录:
|
|
--]]
|
wms_out = require( "wms_outbound" )
|
jx_base= require( "jx_base" )
|
|
function SetPickingTaskFinish ( strLuaDEID )
|
local nRet, strRetInfo
|
local runtime_parameter
|
|
nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter ) end
|
-- 获取【组盘输入】面板的参数
|
local parameter
|
nRet, parameter = m3.GetRuntimePanel_InputParamter( strLuaDEID, runtime_parameter.panel, "出库分拣" )
|
if ( nRet == 1 ) then
|
mobox.setInfo( strLuaDEID, "没有定义'出库分拣'面板参数!")
|
return
|
end
|
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), parameter ) end
|
if ( parameter == nil ) then return end
|
local id = parameter.id -- 当前点中的入库任务标识
|
local dc_no = parameter.dc_no -- 当前点中的入库任务所属配盘号
|
if ( dc_no == nil or dc_no == "") then
|
mobox.setInfo( strLuaDEID, "'出库分拣'面板必须有配盘号参数!")
|
return
|
end
|
-- 获取UPC
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "F_QTY","F_ACC_P_QTY" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end
|
local obj_attrs = json.decode( strRetInfo )
|
local qty = lua.Get_NumAttrValue( obj_attrs[1].value )
|
local acc_p_qty = lua.Get_NumAttrValue( obj_attrs[2].value )
|
|
if ( qty == 0 ) then return end
|
if ( acc_p_qty < 0 ) then
|
mobox.setInfo( strLuaDEID, "分拣数量不能为负数!")
|
return
|
end
|
|
if ( acc_p_qty > qty ) then
|
mobox.setInfo( strLuaDEID, "分拣数量不能大于计划数量!")
|
return
|
end
|
|
-- 如果 acc_p_qty = 0 不需要拣货箱,直接就完成任务
|
|
local action =
|
{
|
{
|
action_type = "set_panel_dlg_attr",
|
value = {
|
panel_name = "出库分拣",
|
attrs = {
|
{
|
attr = "TaskFinish",
|
value = "1",
|
enable = false
|
},
|
{
|
attr = "UPC",
|
value = "",
|
prompt = "请扫拣货箱编码..."
|
},
|
{
|
attr = "Prompt",
|
value = "请扫拣货箱编码..."
|
}
|
}
|
}
|
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end
|
|
end
|