--[[
|
编码: WMS-52-24
|
名称:
|
作者:
|
日期:2025-07-03
|
|
函数: TaskFinish
|
功能:
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require ("oi_base_mobox")
|
prj_base = require("prj_base")
|
|
function TaskFinish( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 1. 获取当前编辑属性(UPC、货品编码、分拣数量等)
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr(strLuaDEID, "UPC", "S_ITEM_CODE", "F_ACC_P_QTY", "F_QTY", "TaskFinish")
|
if nRet ~= 0 then
|
lua.Stop(strLuaDEID, "获取当前编辑属性失败! " .. strRetInfo)
|
return
|
end
|
|
local obj_attrs = json.decode(strRetInfo)
|
local upc = lua.Get_StrAttrValue(obj_attrs[1].value) -- 当前扫描的UPC
|
local item_code = lua.Get_StrAttrValue(obj_attrs[2].value) -- 货品编码
|
local acc_p_qty = lua.Get_NumAttrValue(obj_attrs[3].value) -- 已分拣累计数量
|
local qty = lua.Get_NumAttrValue(obj_attrs[4].value) -- 分拣数量
|
local task_finish = lua.Get_NumAttrValue(obj_attrs[5].value) -- 任务强制完成标志
|
local str_prompt = "请扫拣货箱编码..."
|
local qty_input_enable = false -- 分拣数量输入框是否可以输入
|
|
|
-- 2. 获取运行时参数
|
local runtime_parameter
|
nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
|
if nRet ~= 0 then
|
mobox.setInfo(strLuaDEID, "GetRuntimeParam失败! " .. runtime_parameter)
|
return
|
end
|
|
-- 3. 获取面板参数
|
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.Stop(strLuaDEID, parameter)
|
return
|
end
|
if parameter == nil then return end
|
|
|
local id
|
local dc_no
|
local strCondition
|
local strUpdateSql
|
local action
|
|
-- 7. 校验通过后的业务逻辑
|
id = parameter.id -- 当前点中的入库任务标识
|
dc_no = parameter.dc_no -- 当前点中的入库任务所属配盘号
|
if dc_no == nil or dc_no == "" then
|
mobox.setInfo(strLuaDEID, "'出库分拣'面板必须有配盘号参数!")
|
return
|
end
|
|
-- 8. 更新配盘明细状态为"分拣完成"
|
strCondition = "S_ID = '" .. id .. "'"
|
strUpdateSql = "N_B_STATE = " .. DC_DETAIL_STATE.PickingOK .. ", F_ACC_P_QTY = " .. acc_p_qty
|
nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "Distribution_CNTR_Detail", strCondition, strUpdateSql)
|
if nRet ~= 0 then
|
lua.Stop(strLuaDEID, "更新【配盘明细】信息失败!" .. strRetInfo)
|
return
|
end
|
|
-- 10. 执行后续处理
|
nRet, action = prj_base.Distribution_CNTR_PostProcess(strLuaDEID, parameter)
|
if nRet ~= 0 then
|
lua.Stop(strLuaDEID, action)
|
return
|
end
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if nRet ~= 0 then
|
lua.Stop(strLuaDEID, "setAction失败! " .. strRetInfo)
|
return
|
end
|
return
|
|
|
|
end
|