--[[
|
编码: WMS-24-20
|
名称: 删除
|
作者:HAN
|
日期:2025-6-5
|
|
入口函数: ResetState
|
|
功能说明:
|
把错误状态设置为 错误前的状态
|
|
更改记录:
|
|
--]]
|
wms_op = require( "wms_operation" )
|
|
function ResetState ( strLuaDEID )
|
local nRet, strRetInfo
|
local objs
|
|
-- step1 获取当前点中的作业
|
nRet, objs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then
|
lua.Stop( strLuaDEID, objs )
|
return
|
end
|
local nCount = #objs
|
if (nCount == 0) then return end
|
local outbound_order = {}
|
|
nRet, outbound_order = m3.GetDataObject( strLuaDEID, "Outbound_Order", objs[1].id )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "objAttrsToLuaJson (Outbound_Order) 返回的的JSON格式不合法 !"..outbound_order )
|
return
|
end
|
|
lua.DebugEx( strLuaDEID, "outbound_order", outbound_order )
|
|
-- 如果是错误状态进行重置
|
local b_state
|
if ( outbound_order.b_state == OUTBOUND_ORDER_STATE.Error ) then
|
local strCondition = "S_NO = '"..outbound_order.no.."'"
|
if outbound_order.per_b_state == OUTBOUND_ORDER_STATE.InAlloc then
|
b_state = OUTBOUND_ORDER_STATE.Unalloc
|
else
|
b_state = outbound_order.per_b_state
|
end
|
local strUpdateSql = "N_B_STATE = "..b_state..", S_ERR_MSG = ''"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Outbound_Order", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then
|
return 2, "更新【出库单】信息失败!"..strRetInfo
|
end
|
|
local action = {
|
{
|
action_type = "refresh_cur_row",
|
value = ""
|
}
|
}
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "setAction错误: "..strRetInfo)
|
return
|
end
|
end
|
|
end
|