--[[
|
编码: WMS-56-11
|
名称: 组盘明细-3055顶部窗口容器输入变化后
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: AfterCNTRChange
|
|
功能:
|
-- 根据输入的容器号,判断在当前工作台是否有该容器号的 组盘明细 ,有显示在 当前任务 页签
|
-- 如果当前到站台的入库任务中的容器号和扫码输入的容器号不相等报错
|
|
|
更改记录:
|
V2.0 KUN 20250107
|
需要判断料箱的属性
|
--]]
|
|
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 = 3/组盘完成,4/回库)
|
local strConditionReturning = "S_STATION_NO = '"..station.."' AND ( N_B_STATE = 3 OR N_B_STATE = 4 ) AND S_CNTR_CODE = '"..cntr_code.."'"
|
nRet, strRetInfo = mobox.existThisData( strLuaDEID, "Pre_Alloc_Container", strConditionReturning )
|
if ( nRet ~= 0 ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "查询回库中状态失败: "..strRetInfo )
|
end
|
if ( strRetInfo == "yes" ) then
|
mobox.setInfo( strLuaDEID, "料箱'"..cntr_code.."'处于回库中状态,请按放行按钮" )
|
return
|
end
|
|
-- 判断 容器 是否已经搬运到入库站台
|
-- Organize_Container中的 N_B_STATE = 2:空料箱到入库口,可以进行入库货品组盘作业
|
local strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = 2 AND S_CNTR_CODE = '"..cntr_code.."'"
|
nRet, strRetInfo = mobox.existThisData( strLuaDEID, "Pre_Alloc_Container", 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_SET_CODE",
|
page_name = "当前任务"
|
}
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo ) end
|
|
end
|