--[[
|
编码: AMS-101-11
|
名称: 料箱编码变化后
|
作者:LZH
|
日期:2025-05-14
|
|
函数: AfterCntrCodeInput
|
功能:
|
|
更改记录:
|
|
--]]
|
|
json = require("json")
|
mobox = require("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function AfterCntrCodeInput(strLuaDEID)
|
local nRet, strRetInfo
|
local cntr_detail_array
|
local attrs
|
|
nRet, attrs = m3.GetSysInputParameter(strLuaDEID)
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "获取当前输入面板里的属性失败! " .. attrs)
|
return
|
end
|
-- lua.Debug(strLuaDEID, debug.getinfo(1), "attrs", attrs)
|
|
local input_attr = m3.KeyValueAttrsToObjAttr(attrs)
|
local cntr_code = input_attr.S_CNTR_CODE -- 料箱编码
|
|
if (cntr_code == nil or cntr_code == '') then
|
mobox.setInfo(strLuaDEID, "料箱编码不能为空!")
|
return
|
end
|
|
-- 查询安全库存明细
|
nRet, cntr_detail_array = m3.QueryDataObject(strLuaDEID, "SAF_Inventory", "S_CNTR_CODE = '" .. cntr_code .. "'")
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "获取【安全库存量表】信息失败!" .. cntr_detail_array)
|
return
|
end
|
lua.Debug(strLuaDEID, debug.getinfo(1), "cntr_detail_array", cntr_detail_array)
|
|
local action_array = {}
|
-- 如果有该料箱的安全库存记录则显示在已码盘页面
|
if (#cntr_detail_array > 0) then
|
-- local date_list = m3.KeyValueAttrsToObjAttr(cntr_detail_array[1].attrs)
|
|
action_array[1] = {
|
action_type = "set_subtable_page_content",
|
value = {
|
page_name = "已码盘",
|
content = cntr_detail_array,
|
clear = true,
|
clear_confirm = false,
|
checkbox = false
|
}
|
}
|
|
-- 将光标放在货位编码框
|
action_array[2] = {
|
action_type = "set_dlg_current_edit_attr",
|
value = "S_LOC_CODE"
|
}
|
lua.Debug(strLuaDEID, debug.getinfo(1), "action_array", action_array)
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "setAction失败! " .. strRetInfo)
|
return
|
end
|
else
|
-- 将光标放在货位编码框
|
action_array[1] = {
|
action_type = "set_dlg_current_edit_attr",
|
value = "S_LOC_CODE"
|
}
|
lua.Debug(strLuaDEID, debug.getinfo(1), "action_array", action_array)
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action_array))
|
if (nRet ~= 0) then
|
mobox.setInfo(strLuaDEID, "setAction失败! " .. strRetInfo)
|
return
|
end
|
end
|
end
|