--[[
|
编码: WMS-56-27
|
名称: 预分配容器明细-装箱数量变化
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: AfterQtyChange
|
|
功能:
|
-- 装箱数量输入变化后
|
|
更改记录:
|
|
--]]
|
|
prj_base = require( "prj_base" )
|
|
function AfterQtyChange ( strLuaDEID )
|
local nRet, strRetInfo
|
|
m3.PrintLuaDEInfo( strLuaDEID )
|
|
local runtime_parameter
|
nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "GetRuntimeParam失败! "..runtime_parameter )
|
return
|
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 pac_no = parameter.pac_no -- 当前点中的入库任务所属组盘号
|
if ( pac_no == nil or pac_no == "") then
|
mobox.setInfo( strLuaDEID, "'组盘输入'面板必须有orgc_no参数!")
|
return
|
end
|
-- 获取UPC
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "F_QTY","F_ACT_QTY" )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo )
|
return
|
end
|
local obj_attrs = json.decode( strRetInfo )
|
local qty = lua.Get_NumAttrValue( obj_attrs[1].value )
|
local act_qty = lua.Get_NumAttrValue( obj_attrs[2].value )
|
|
if ( qty == 0 ) then return end
|
|
if ( lua.equation( act_qty, qty ) ) then
|
|
-- 设置【预分配容器明细】状态 = 2/PalletizingOK(组盘完成)
|
local strCondition = "S_ID = '"..id.."'"
|
local strUpdateSql = "N_B_STATE = "..PAC_DETAIL_STATE.PalletizingOK..", F_ACT_QTY = "..act_qty
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Pre_Alloc_CNTR_Detail", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "更新【预分配容器明细】信息失败!"..strRetInfo )
|
return
|
end
|
|
local action
|
nRet, action = prj_base.Pre_Alloc_CNTR_PostProcess( strLuaDEID, pac_no, parameter.station, parameter.cntr_code )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "Pre_Alloc_CNTR_PostProcess 失败!"..action )
|
return
|
end
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction )
|
return
|
end
|
else
|
if ( act_qty > qty ) then
|
parameter.qty = qty
|
local action = {
|
{
|
action_type = "open_prompt_dlg",
|
value = {
|
prompt = "输入的装箱数量超过计划数量,点确定按计划数量完成装箱!",
|
ok_button = {
|
name = "确定",
|
click_event = {
|
cls_name = "Pre_Alloc_CNTR_Detail",
|
event_name = "按计划数量完成装箱",
|
data = parameter
|
}
|
},
|
cancel_button = {
|
name = "取消"
|
}
|
}
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo..' action = '..strAction )
|
return
|
end
|
end
|
end
|
|
end
|