--[[
|
编码: JX-108-20
|
名称: 巨星任务-巨星出库后料箱解绑
|
作者:HAN
|
日期:2025-1-29
|
|
级别:项目
|
|
函数: ClickUnbind
|
|
功能:
|
-- 巨星出库任务设置=2
|
-- 料箱和货位解绑
|
|
更改记录:
|
--]]
|
jx_base= require( "jx_base" )
|
wms_cntr= require( "wms_container" )
|
wms_wh = require( "wms_wh" )
|
|
function ClickUnbind ( 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
|
-- 检查是否有 巨星出库 任务在本站台
|
local station_loc_code = jx_base.Get_Station_Loc( strLuaDEID, station )
|
if ( station_loc_code == '' ) then
|
mobox.setInfo( strLuaDEID, "站台'"..station.."'没有定义货位!")
|
return
|
end
|
local strCondition = "N_B_STATE = 5 AND S_CNTR_CODE = '"..cntr_code.."' AND S_END_LOC = '"..station_loc_code.."' AND S_TASK_TYPE = '出库'"
|
local data_objs
|
nRet, data_objs = m3.QueryDataObject(strLuaDEID, "JX_Task", strCondition, "S_SOURNO" )
|
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)
|
|
-- 更新巨星出库任务的状态,设置为 2
|
local strUpdateSql = "N_B_STATE = 2"
|
local strCondition = "S_SOURNO = '"..obj_attrs.S_SOURNO.."'"
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "JX_Task", strCondition, strUpdateSql )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新【巨星任务】状态息失败!"..strRetInfo ) end
|
|
-- 容器货位解绑
|
nRet, strRetInfo = wms_wh.Loc_Container_Unbinding( strLuaDEID, station_loc_code, cntr_code, "绑定解绑方法-人工", strUserName )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '货位容器解绑失败!'..strRetInfo ) end
|
|
mobox.setInfo( strLuaDEID, "系统已经成功解绑巨星料箱")
|
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
|
|
end
|