--[[
|
编码: WMS-20-22
|
名称: 预分配料箱取消1#
|
作者:
|
日期:2025-1-29
|
|
函数: ClickCancel
|
|
功能:
|
-- 适合入库波次在领用入库单后创建的情况
|
|
-- 在呼出空料箱后操作者可以点取消,这个时候会删除新创建的入库波次
|
-- 并且取消呼出容器的预分配数量,及料格的状态
|
|
更改记录:
|
V2.0 HAN 20250317 增加对超重呼出料箱功能点的处理,取消后要把【站台货品明细】的N_B_STATE状态设置为 0
|
--]]
|
|
wms_pac = require( "wms_pac_cbg" )
|
|
function ClickCancel( strLuaDEID )
|
local nRet, strRetInfo, parameter
|
|
-- 这里的 paramter 是在点击领用按钮后,传入的 入库波次对象或入库单对象,如果取消就是删除波次对象
|
nRet, parameter = m3.GetSysInputParameter( strLuaDEID )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取input parameter 失败! "..parameter ) end
|
|
local from = parameter.from or ''
|
if ( from == "Overweight_call" ) then
|
-- 呼出空料箱来自 站台的超重货品入库呼出,需要把【站台货品明细】中相关的记录更新状态
|
local station = lua.Get_StrAttrValue( parameter.station )
|
local bs_type = lua.Get_StrAttrValue( parameter.bs_type )
|
local bs_no = lua.Get_StrAttrValue( parameter.bs_no )
|
if ( station == '' or bs_type == '' or bs_no == '' ) then
|
mobox.stopProgram( strLuaDEID, "paramter 参数中 属性 station, bs_type, bs_no 不能为空!")
|
return
|
end
|
strCondition = "S_STATION_NO = '"..station.."' AND S_BS_TYPE = '"..bs_type.."' AND S_BS_NO = '"..bs_no.."'"
|
strSetAttr = "N_B_STATE = 0" -- 0 待处理
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Station_Goods_Detail", strCondition, strSetAttr )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "更新【站台货品明细】信息失败!"..strRetInfo )
|
return
|
end
|
end
|
|
if parameter.cls_id == "Inbound_Wave" then
|
-- 如果是入库波次,系统通过删除波次会删除预分配容器
|
local strCondition = "S_ID = '"..parameter.obj_id.."'"
|
nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, parameter.cls_id, strCondition )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "删除【parameter.cls_id】失败! "..strRetInfo )
|
return
|
end
|
elseif parameter.cls_id == "Inbound_Order" then
|
local data_obj
|
nRet, data_obj = m3.GetDataObject( strLuaDEID, parameter.cls_id, parameter.obj_id )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, data_obj )
|
return
|
end
|
nRet, strRetInfo = wms_pac.Release_Pre_Alloc_Cntr( strLuaDEID, "Inbound_Order", data_obj.no )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, strRetInfo )
|
return
|
end
|
-- 更新入库单的状态
|
local strUpdateSql = "N_B_STATE = "..INBOUND_STATE.Unalloc
|
local strCondition = "S_ID = '"..lua.trim_guid_str( parameter.obj_id ).."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Inbound_Order", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then
|
lua.Stop( strLuaDEID, "更新【入库单】信息失败!"..strRetInfo )
|
return
|
end
|
-- 删除[预分配容器/Pre_Alloc_Container]
|
strCondition = "S_BS_TYPE = 'Inbound_Order' AND S_BS_NO = '"..data_obj.no.."'"
|
nRet, strRetInfo = mobox.dbdeleteData(strLuaDEID, "Pre_Alloc_Container", strCondition)
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "删除【Pre_Alloc_Container】失败!"..strRetInfo)
|
return
|
end
|
|
-- 删除[预分配容器明细/Pre_Alloc_CNTR_Detail]
|
nRet, strRetInfo = mobox.dbdeleteData(strLuaDEID, "Pre_Alloc_CNTR_Detail", strCondition)
|
if (nRet ~= 0) then
|
lua.Stop( strLuaDEID, "删除【Pre_Alloc_CNTR_Detail】失败!"..strRetInfo)
|
return
|
end
|
|
else
|
lua.Stop( strLuaDEID, "parameter 中的 cls_id 非法!" )
|
return
|
end
|
local action = {
|
{
|
action_type = "close_dlg",
|
value = ""
|
}
|
}
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end
|
|
end
|