--[[
|
编码: WMS-01-19
|
名称: 容器-Rest
|
作者:HAN
|
日期:2025-1-29
|
|
级别: 项目
|
|
函数: Reset
|
|
功能:
|
-- 这个脚本用于 Grid 中选中行点 重置 后触发
|
-- 根据 INV_Detail 重新设置容器的明细数量,容器、料格空满状态
|
|
更改记录:
|
|
--]]
|
wms_cntr = require( "wms_container" )
|
|
function Reset( strLuaDEID )
|
local nRet, strRetInfo
|
local data_json
|
|
m3.PrintLuaDEInfo( strLuaDEID )
|
|
nRet, data_json = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then
|
lua.Stop( strLuaDEID, data_json )
|
return
|
end
|
local nCount = #data_json
|
if ( nCount == 0 ) then return end
|
local cntr
|
|
nRet, cntr = m3.ObjAttrStrToLuaObj( "Container", data_json[1].attrs )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, cntr )
|
return
|
end
|
local cntr_code = cntr.code or ''
|
|
-- 先清除一下 INV_Detail 中Qty <=0 的记录
|
local strCondition = "S_CNTR_CODE = '" .. cntr_code .."' AND F_QTY <= 0"
|
nRet, strRetInfo = mobox.dbdeleteData(strLuaDEID, "INV_Detail", strCondition)
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "删除【INV_Detail】失败!"..strRetInfo )
|
return
|
end
|
nRet, cntr = wms_cntr.GetInfo( strLuaDEID, cntr_code )
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "wms_cntr.GetInfo 失败!"..cntr )
|
return
|
end
|
|
-- 重置容器属性
|
nRet, strRetInfo = wms_cntr.Reset( strLuaDEID, cntr )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, strRetInfo )
|
return
|
end
|
|
end
|