--[[
|
编码: JX-01-18
|
名称: 容器-全部清除编码从头开始
|
作者:HAN
|
日期:2025-01-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: ResetContainer
|
|
功能:
|
清除所有容器和容器料格,并且编码从0001开始
|
|
更改记录:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function ResetContainer( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 把容器编码 FB- 开始的顺序号设置为 0001
|
nRet, strRetInfo = mobox.removeSerialNumber( "容器", "FB-" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "removeSerialNumber() 失败! "..strRetInfo ) end
|
|
-- 把容器编码 Z- 开始的顺序号设置为 0001
|
nRet, strRetInfo = mobox.removeSerialNumber( "容器", "Z-" )
|
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, "Organize_Container")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Organize_Container】失败!"..strRetInfo) end
|
nRet, strRetInfo = mobox.dbClearData(strLuaDEID, "Organize_CNTR_Detail")
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Organize_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
|
|
local action = {}
|
action[1] = {
|
action_type = "refresh",
|
value = ""
|
}
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str( action ))
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end
|
end
|