--[[
|
编码: WMS-01-15#2
|
名称: 容器-显示前
|
作者: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, color
|
|
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 = row_item.row_button_hidden.."解锁;"
|
end
|
elseif ( attr_value.attr == 'C_ENABLE' ) then
|
if ( attr_value.value == 'Y') then
|
img = "m3-switch-off1"
|
color = "#B0C4DE"
|
else
|
img = "m3-switch-on1"
|
color = "#0000FF"
|
end
|
attr_value.value = ""
|
attr_value.ext_button = {
|
type = "trigger_event",
|
img = img,
|
button_color = color,
|
img_size = 32,
|
set = { cls_name = "Container", event_name = "禁用启用"}
|
}
|
elseif ( attr_value.attr == 'S_POSITION' ) then
|
if ( attr_value.value == '' ) then
|
row_item.row_button_hidden = row_item.row_button_hidden.."解绑;"
|
end
|
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
|
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
|