--[[
|
编码: WMS-01-12
|
名称: 容器-CountDiffPostProcess
|
作者:HAN
|
日期:2025-1-29
|
级别: 项目
|
|
函数: AfterCountDiff
|
|
功能:
|
-- 这个脚本一般由WPF进行调用
|
-- 根据 CG_Detail 重新设置容器的明细数量,容器、料格空满状态
|
-- 盘点发现容器货品不正确有差异,系统会把容器设置为不可用,如果发现容器相关的差异已经全部处理,容器设置为可用
|
更改记录:
|
|
--]]
|
|
wms_cntr = require( "wms_container" )
|
|
function AfterCountDiff( strLuaDEID )
|
local nRet, strRetInfo
|
local cntr
|
nRet, cntr = m3.GetSysCurEditDataObj( strLuaDEID, "Container" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..task ) end
|
|
-- 判断一下 该容器的 盘点差异是否全部已经移库,如果全部移库需要把 容器 的 C_ENABLE 设置为 Y (启用)
|
local strCondition = "S_CNTR_CODE = '"..cntr.code.."' AND C_DIFF_MOVE = 'N'"
|
nRet, strRetInfo = mobox.getDataObjCount( strLuaDEID, "Count_Diff", strCondition )
|
if ( nRet ~= 0 ) then return nRet, strRetInfo end
|
local num = lua.StrToNumber( strRetInfo )
|
|
if ( num == 0 ) then
|
local strUpdateSql = "C_ENABLE = 'Y'"
|
strCondition = "S_CODE = '"..cntr.code.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Container", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【容器】信息失败!"..strRetInfo ) end
|
|
-- 容器重置
|
local add_wfp = {
|
wfp_type = 1, -- 触发数据对象事件(指定数据对象标识)
|
cls = "Container",
|
obj_id = cntr.id,
|
obj_name = "容器'"..cntr.code.."因盘点差异移库触发容器Reset事件",
|
trigger_event = "Reset"
|
}
|
nRet, strRetInfo = m3.AddSysWFP( strLuaDEID, add_wfp )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "新增WFP信息失败!"..strRetInfo ) end
|
end
|
end
|