--[[
|
编码: JX-65-12
|
名称:
|
作者:
|
日期:2025-04-11
|
|
函数: BeforeGridShow
|
功能:
|
|
更改记录:
|
|
--]]
|
json = require("json")
|
mobox = require("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function BeforeGridShow(strLuaDEID)
|
local nRet, strRetInfo
|
local data_objs
|
local nCount
|
|
-- 获取网格数据
|
nRet, data_objs = m3.GetSysDataJson(strLuaDEID)
|
if nRet ~= 0 then
|
lua.Error(strLuaDEID, debug.getinfo(1), "获取网格数据失败: " .. tostring(data_objs))
|
return
|
end
|
|
nCount = #data_objs
|
if nCount == 0 then return end
|
|
local row_data_set = {}
|
|
for i = 1, nCount do
|
local row_item = {
|
id = data_objs[i].id,
|
attrs = {}
|
}
|
|
-- 处理每个属性
|
for j = 1, #data_objs[i].attrs do
|
local attr = {
|
attr = data_objs[i].attrs[j].attr,
|
value = data_objs[i].attrs[j].value
|
}
|
|
-- 特殊处理S_ACTION字段
|
if attr.attr == "S_ACTION" then
|
if attr.value == "+" then
|
attr.value = "入库"
|
elseif attr.value == "-" then
|
attr.value = "出库"
|
end
|
end
|
|
table.insert(row_item.attrs, attr)
|
end
|
|
table.insert(row_data_set, row_item)
|
end
|
|
-- 更新界面数据
|
local action = {
|
{
|
action_type = "reset_data_attr",
|
value = row_data_set
|
}
|
}
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if nRet ~= 0 then
|
lua.Error(strLuaDEID, debug.getinfo(1), "更新数据失败: " .. tostring(strRetInfo))
|
end
|
end
|