--[[
|
编码: JX-52-11
|
名称: 配盘明细-3055顶部窗口容器输入变化后
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: AfterCNTRChange
|
|
功能:
|
-- 根据输入的容器号,判断在当前工作台是否有该容器号的 配盘明细 ,有显示在 当前任务 页签
|
-- 如果当前到站台的入库任务中的容器号和扫码输入的容器号不相等报错
|
|
|
更改记录:
|
|
--]]
|
wms_cntr= require( "wms_container" )
|
|
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
|
|
-- 判断料箱属性
|
-- MDY BY KUN 20250107
|
local cntr_obj
|
nRet, cntr_obj = wms_cntr.GetInfo( strLuaDEID, cntr_code )
|
if ( nRet ~= 0 ) then
|
mobox.setInfo( strLuaDEID, debug.getinfo(1), "获取容器对象失败! "..cntr_obj )
|
return
|
end
|
if ( cntr_obj == '' ) then
|
mobox.setInfo( strLuaDEID, "编码 = '"..cntr_code.."'的拣料箱不存在!")
|
return
|
end
|
if ( cntr_obj.source ~= "巨沃" ) then
|
mobox.setInfo( strLuaDEID, "编码 = '"..cntr_code.."'的拣料箱不是巨沃的")
|
return
|
end
|
-- 判断容器是否处于回库中状态N_B_STATE = 4/拣货完成 5/回库
|
local strCondition = "S_STATION_NO = '"..station.."' AND ( N_B_STATE = 4 or N_B_STATE = 5 ) AND S_CNTR_CODE = '"..cntr_code.."'"
|
nRet, strRetInfo = mobox.existThisData( strLuaDEID, "Distribution_CNTR", strCondition )
|
if ( nRet ~= 0 ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "查询回库中状态失败: "..strRetInfo )
|
end
|
-- 如果容器处于回库中状态,并终止流程
|
if ( strRetInfo == "yes" ) then
|
mobox.setInfo( strLuaDEID, "料箱'"..cntr_code.."'处于回库中状态,请按放行按钮" )
|
return
|
end
|
|
-- 判断 容器 是否已经搬运到入库站台
|
-- Distribution_CNTR 中 N_B_STATE = 3(出库完成)
|
strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 3 AND S_CNTR_CODE = '"..cntr_code.."'"
|
nRet, strRetInfo = mobox.existThisData( strLuaDEID, "Distribution_CNTR", strCondition )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
|
-- 如果该车辆编码的动作已经在队列,返回,不做处理
|
if ( strRetInfo ~= "yes" ) then
|
mobox.setInfo( strLuaDEID, "料箱'"..cntr_code.."'没有到达站台"..station)
|
return
|
end
|
|
strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 1 AND S_CNTR_CODE = '"..cntr_code.."'"
|
local action =
|
{
|
{
|
action_type = "set_query_condition",
|
value = {
|
condition = strCondition,
|
order = "S_SOT_CODE",
|
page_name = "当前任务"
|
}
|
}
|
}
|
lua.Debug( strLuaDEID, debug.getinfo(1), "action", action )
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end
|
|
end
|