--[[
|
编码: JX-108-21
|
名称: 巨星任务-巨星出库-输入容器变化
|
作者:HAN
|
日期:2025-1-29
|
级别:项目
|
|
函数: AfterCNTRChange
|
|
功能:
|
-- 根据输入的容器号,判断在当前巨星出库任务是否已经到站台
|
|
更改记录:
|
|
--]]
|
jx_base= require( "jx_base" )
|
|
function AfterCNTRChange ( strLuaDEID )
|
local nRet, strRetInfo
|
|
-- 获取站台编码
|
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 return end
|
|
local station_loc_code = jx_base.Get_Station_Loc( strLuaDEID, station )
|
if ( station_loc_code == '' ) then
|
mobox.setInfo( strLuaDEID, "站台'"..station.."'没有定义货位!")
|
return
|
end
|
|
-- 判断 容器 是否在任务池 N_B_STATE = 0 表示待执行的任务
|
local strCondition = "N_B_STATE = 5 AND S_CNTR_CODE = '"..cntr_code.."' AND S_END_LOC = '"..station_loc_code.."'"
|
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.."'的巨星出库任务还没到站台!")
|
elseif ( #data_objs > 1 ) then
|
mobox.setInfo( strLuaDEID, "容器号等于'"..cntr_code.."'的巨星出库到站任务有多条! 数据不合法请检查!")
|
else
|
return
|
end
|
|
-- 扫码的容器没在当前站台取消容器扫码
|
local action =
|
{
|
{
|
action_type = "set_dlg_attr",
|
value = {
|
{
|
attr = "S_CNTR_CODE",
|
value = ""
|
}
|
}
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end
|
|
end
|