--[[
|
编码: WMS-58-10
|
名称: 入库波次-显示前
|
作者:HAN
|
日期: 2025-1-29
|
|
入口函数:BeforeGridShow
|
|
功能说明:
|
显示状态
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function BeforeGridShow ( strLuaDEID )
|
local nRet, strRetInfo
|
local data_objs
|
local n, nCount, b_state
|
local state_name = {"未组盘","已组盘","执行中","完成","暂停中","暂停","关闭中","关闭"}
|
|
|
nRet, data_objs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), data_objs ) end
|
nCount = #data_objs
|
if (nCount == 0) then return end
|
|
local obj
|
local row_data_set = {}
|
|
for n = 1, nCount do
|
local row_item = {}
|
|
obj = data_objs[n]
|
row_item.id = obj.id
|
row_item.attrs = {}
|
row_item.row_button_hidden = ""
|
|
-- 获取 入库波次 对象属性
|
for nIndex = 1, #obj.attrs do
|
local attr_value = {}
|
|
attr_value.attr = obj.attrs[nIndex].attr
|
attr_value.value = obj.attrs[nIndex].value
|
|
if ( attr_value.attr == 'N_B_STATE' ) then
|
b_state = lua.StrToNumber( attr_value.value )
|
attr_value.show_style = "segment_box"
|
attr_value.value = state_name[b_state+1]
|
if ( b_state == 1 ) then
|
-- 已组盘
|
attr_value.bk_color = "#FFFACD"
|
attr_value.text_color = "#000000"
|
elseif ( b_state == 3 ) then
|
-- 完成
|
row_item.row_button_hidden = "强制完成"
|
attr_value.bk_color = "#00FA9A"
|
attr_value.text_color = "#000000"
|
elseif ( b_state == 2 ) then
|
-- 执行
|
attr_value.bk_color = "#FFD700"
|
attr_value.text_color = "#000000"
|
else
|
row_item.row_button_hidden = "强制完成"
|
attr_value.bk_color = "#F8F8FF"
|
attr_value.text_color = "#000000"
|
end
|
end
|
table.insert( row_item.attrs, attr_value )
|
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), "setAction错误: "..strRetInfo)
|
end
|
end
|