--[[
|
编码: JX-35-16
|
名称: 出库容器明细-3055 TOP-VIEW - 点回库按钮
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: ClickGoBack
|
|
功能:
|
-- 创建‘指定回库’作业
|
|
更改记录:
|
--]]
|
|
wms_op = require( "wms_operation" )
|
wms_cntr= require( "wms_container" )
|
wms_wh = require( "wms_wh" )
|
|
function ClickGoBack ( strLuaDEID )
|
local nRet, strRetInfo
|
local strUserLogin, strUserName
|
nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前操作人员信息失败! "..strUserLogin ) end
|
|
-- 获取TOPVIEW的输入信息
|
nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_STATION_NO","S_CNTR_CODE" )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end
|
local obj_attrs = json.decode( strRetInfo )
|
local station = lua.Get_StrAttrValue( obj_attrs[1].value )
|
local cntr_code = lua.Get_StrAttrValue( obj_attrs[2].value )
|
|
if ( station == '' or cntr_code == '' ) then
|
mobox.setInfo( strLuaDEID, "输入参数不完整,无法执行入库作业!")
|
return
|
end
|
|
-- N_B_STATE = 2 表示容器出库到了站台
|
local strCondition = "N_B_STATE = 2 AND S_CNTR_CODE = '"..cntr_code.."'"
|
local data_objs
|
nRet, data_objs = m3.QueryDataObject(strLuaDEID, "Specify_Outbound_CNTR", strCondition )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1),"QueryDataObject失败!"..data_objs ) end
|
if ( data_objs == '' ) then
|
mobox.setInfo( strLuaDEID, "站台没有料箱号 = '"..cntr_code.."'的指派出库任务,无法做回库!")
|
return
|
elseif ( #data_objs > 1 ) then
|
mobox.setInfo( strLuaDEID, "料箱号 = '"..cntr_code.."'的指派出库任务有多条! 数据不合法请检查!")
|
return
|
end
|
local obj_attrs = m3.KeyValueAttrsToObjAttr(data_objs[1].attrs)
|
|
local operation
|
-- ***
|
local ext_info = {
|
bs_type = "Specify_Outbound",
|
bs_no = obj_attrs.S_SO_NO,
|
op_def_name = "指定回库"
|
}
|
local container
|
nRet, container = wms_cntr.GetInfo( strLuaDEID, cntr_code )
|
if (nRet ~= 0) then
|
return 2, "获取【容器】信息失败! " .. container
|
end
|
nRet, operation = wms_op.Create_Inbound_Operation( strLuaDEID, station, container, ext_info )
|
if ( nRet ~= 0 ) then
|
mobox.setInfo( strLuaDEID, operation )
|
return
|
end
|
-- 【指定出库容器】开始回库作业
|
strUpdateSql = "N_B_STATE = 3 "
|
strCondition = "S_SOC_NO = '"..obj_attrs.S_SOC_NO.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Specify_Outbound_CNTR", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【指定出库容器】信息失败!"..strRetInfo ) end
|
|
-- 2 已经完成检查
|
strUpdateSql = "N_B_STATE = 2 "
|
strCondition = "S_SOC_NO = '"..obj_attrs.S_SOC_NO.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "SO_CNTR_Detail", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【指定出库容器明细】信息失败!"..strRetInfo ) end
|
|
mobox.setInfo( strLuaDEID, "系统已经成功创建了一个指定回库作业'"..operation.code.."'")
|
local action =
|
{
|
{
|
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
|
|
-- 【注意】如果上面的程序有入库作业产生需要对入库作业的终点获取加入库锁
|
nRet, strRetInfo = wms.wms_LockLocation(strLuaDEID, operation.end_loc_code, wms_base.Get_nConst( strLuaDEID, "锁类型-入库锁" ),
|
"", operation.code, operation.op_def_name )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "wms_LockLocation 失败!"..strRetInfo ) end
|
end
|