--[[
|
编码: WMS-82-11
|
名称: 批量入库测试-显示前
|
作者:HAN
|
日期:2025-1-29
|
|
入口函数:BeforeGridShow
|
|
功能说明:
|
如果作有错误信息显示红色
|
更改记录:
|
|
--]]
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function BeforeGridShow ( strLuaDEID )
|
local nRet, strRetInfo
|
local arobjs, attrs
|
local n, nCount
|
|
nRet, arobjs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), arobjs ) end
|
-- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
|
nCount = #arobjs
|
if (nCount == 0) then return end
|
|
local obj, attrs, id
|
local strCellBkground, strDataJson
|
local strRowCtrl = ''
|
|
|
strDataJson = '['
|
for n = 1, nCount do
|
obj = arobjs[n]
|
attrs = obj.attrs
|
nattr_count = #attrs
|
id = obj.id
|
|
strAttrs = ''
|
-- 默认情况是不需要 "重置" 这个行按钮的, 只有错误的时候需要
|
strRowCtrl = ',"row_button_hidden":"错误重置"'
|
-- 获取 物料编码 和 库区编码
|
for nIndex = 1, nattr_count do
|
strAttr = attrs[nIndex].attr
|
strValue = attrs[nIndex].value
|
strCellBkground = ''
|
if (strAttr == 'S_ERR') then
|
if ( strValue ~= '' ) then
|
strRowCtrl = ''
|
strCellBkground = ', "bk_color":"#FF0000","text_color":"#FFFFFF"'
|
end
|
end
|
strItem = '{"attr":"' .. strAttr .. '","value":"' .. strValue .. '"'..strCellBkground..'},'
|
strAttrs = strAttrs .. strItem
|
end
|
strAttrs = lua.trim_laster_char(strAttrs)
|
strRow = '{"id":"'..id..'"'..strRowCtrl..',"attrs":['..strAttrs..']},'
|
strDataJson = strDataJson .. strRow
|
end
|
-- 取消最后一个,号
|
strDataJson = lua.trim_laster_char(strDataJson)
|
strDataJson = strDataJson .. ']'
|
|
strAction = '[{"action_type":"reset_data_attr","value":' .. strDataJson .. '}]'
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, strAction)
|
if ( nRet ~= 0 ) then
|
lua.Warning( strLuaDEID, debug.getinfo(1), strAction )
|
lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo)
|
end
|
end
|