--[[
|
编码: WMS-69-01
|
名称: 清除和容器相关的所有数据对象
|
作者:HAN
|
日期:2025-04-25
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: ClearAll
|
|
功能:
|
注意这些脚本一般只用于在实施过程中,清理测试过程中的垃圾数据,不能用于正式环境
|
清除所有容器和容器料格,并且编码从0001开始
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function ClearAll( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 把容器编码 FB- 开始的顺序号设置为 0001
|
nRet, strRetInfo = mobox.removeSerialNumber( "容器", "FB-" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "removeSerialNumber() 失败! "..strRetInfo ) end
|
|
-- 把容器编码 ZB- 开始的顺序号设置为 0001
|
nRet, strRetInfo = mobox.removeSerialNumber( "容器", "ZB-" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "removeSerialNumber() 失败! "..strRetInfo ) end
|
|
|
local strCondition = ""
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Container")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Container】失败!"..strRetInfo) end
|
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Container_Cell")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Container_Cell】失败!"..strRetInfo) end
|
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Container_Good")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Container_Good】失败!"..strRetInfo) end
|
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "CG_Detail")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【CG_Detail】失败!"..strRetInfo) end
|
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Loc_Container")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Loc_Container】失败!"..strRetInfo) end
|
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Lock")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Lock】失败!"..strRetInfo) end
|
|
-- 和配盘相关
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Distribution_CNTR")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Distribution_CNTR】失败!"..strRetInfo) end
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Distribution_CNTR_Detail")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Distribution_CNTR_Detail】失败!"..strRetInfo) end
|
|
-- 和组盘相关
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Pre_Alloc_Container")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Pre_Alloc_Container】失败!"..strRetInfo) end
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Pre_Alloc_CNTR_Detail")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Pre_Alloc_CNTR_Detail】失败!"..strRetInfo) end
|
|
local strUpdateSql = "N_CURRENT_NUM = 0, N_LOCK_STATE = 0, S_LOCK_OP = '', S_LOCK_STATE = ''"
|
local strCondition = "S_WH_CODE = 'WH01'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Location", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【货位】信息失败!"..strRetInfo ) end
|
end
|