--[[
|
编码: WMS-01-15
|
名称: 容器-显示前
|
作者:HAN
|
日期: 2025-01-29
|
|
入口函数:BeforeGridShow
|
|
功能说明:
|
把锁、空满等显示成文字
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function BeforeGridShow ( strLuaDEID )
|
local nRet, strRetInfo
|
local cntr_objs
|
local n, nCount
|
local lock_state_name = {"","入库锁","出库锁","其它","盘点锁"}
|
local emptyfull_state_name = {"","有货","满"}
|
|
nRet, cntr_objs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), cntr_objs ) end
|
nCount = #cntr_objs
|
if (nCount == 0) then return end
|
|
local obj
|
local row_data_set = {}
|
local lock_state, emptyfull_state, cntr_type
|
|
strDataJson = '['
|
for n = 1, nCount do
|
local row_item = {}
|
|
obj = cntr_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_LOCK_STATE' ) then
|
lock_state = lua.StrToNumber( attr_value.value )
|
attr_value.value = lock_state_name[lock_state+1]
|
if ( lock_state > 0 ) then
|
attr_value.bk_color = "#FFFACD"
|
attr_value.text_color = "#000000"
|
else
|
row_item.row_button_hidden = "解锁"
|
end
|
elseif ( attr_value.attr == 'C_ENABLE' ) then
|
if ( attr_value.value == 'Y') then
|
img = "mobox-normal-disable"
|
else
|
img = "mobox-normal-circle-arrow2"
|
end
|
|
attr_value.ext_button = {
|
type = "trigger_event",
|
img = img,
|
set = { cls_name = "Container", event_name = "禁用启用"}
|
}
|
|
elseif ( attr_value.attr == 'N_EMPTY_FULL' ) then
|
emptyfull_state = lua.StrToNumber( attr_value.value )
|
attr_value.value = emptyfull_state_name[emptyfull_state+1]
|
if ( emptyfull_state == 1 ) then
|
attr_value.bk_color = "#6495ED"
|
attr_value.text_color = "#000000"
|
elseif ( emptyfull_state == 2 ) then
|
attr_value.bk_color = "#FFA500"
|
attr_value.text_color = "#000000"
|
end
|
elseif ( attr_value.attr == 'N_TYPE' ) then
|
cntr_type = lua.StrToNumber( attr_value.value )
|
if ( cntr_type == 3 ) then
|
attr_value.value = '料箱'
|
elseif ( cntr_type == 4 ) then
|
attr_value.value = '拣料箱'
|
elseif ( cntr_type == 2 ) then
|
attr_value.value = '容器'
|
else
|
attr_value.value = '托盘'
|
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
|