--[[
|
编码: WMS-17-13
|
名称: 计划盘点容器-子表显示
|
作者:HAN
|
日期:2025-1-29
|
|
级别:固定 (说明本段代码在项目中不太会变化)
|
|
函数: BeforeGridShow
|
|
功能:
|
显示盘点状态、容器的锁状态
|
|
更改记录:
|
--]]
|
|
wms_base = require( "wms_base" )
|
|
function BeforeGridShow ( strLuaDEID )
|
local nRet, strRetInfo
|
local input_datajson
|
|
-- 获取Grid显示数据对象
|
-- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
|
nRet, input_datajson = m3.GetSysDataJson( strLuaDEID )
|
if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "无法获取Grid显示数据包!") end
|
local n, nCount
|
|
nCount = #input_datajson
|
if (nCount == 0) then return end
|
|
local obj, lock_state, strAttr
|
local b_state = 0
|
local row_data_set = {}
|
|
for n = 1, nCount do
|
local row_item = {}
|
|
obj = input_datajson[n]
|
row_item.id = obj.id
|
row_item.attrs = {}
|
|
-- 获取 物料编码 和 库区编码
|
for nIndex = 1, #obj.attrs do
|
local attr_cell = {}
|
|
attr_cell.attr = obj.attrs[nIndex].attr
|
attr_cell.value = obj.attrs[nIndex].value
|
strAttr = attr_cell.attr
|
|
if (strAttr == 'a.N_B_STATE') then
|
b_state = lua.StrToNumber( attr_cell.value )
|
if ( b_state == 0 ) then
|
attr_cell.value = "未盘点"
|
elseif ( b_state == 1 ) then
|
attr_cell.bk_color = "#708090"
|
attr_cell.text_color = "#000000"
|
attr_cell.value = "已锁定"
|
elseif ( b_state == 2 ) then
|
attr_cell.bk_color = "#6495ED"
|
attr_cell.text_color = "#FFFFFF"
|
attr_cell.value = "可盘点"
|
elseif ( b_state == 3 ) then
|
attr_cell.bk_color = "#32CD32"
|
attr_cell.text_color = "#FFFFFF"
|
attr_cell.value = "已盘点"
|
end
|
elseif (strAttr == 'b.N_LOCK_STATE') then
|
attr_cell.show_style = "segment_arcbox"
|
lock_state = lua.StrToNumber( attr_cell.value )
|
if ( lock_state == 0 ) then
|
attr_cell.value = "无"
|
elseif ( lock_state == 1 ) then
|
attr_cell.value = "入库锁"
|
elseif ( lock_state == 2 ) then
|
attr_cell.value = "出库锁"
|
elseif ( lock_state == 4 ) then
|
attr_cell.value = "盘点锁"
|
else
|
attr_cell.value = "其它锁"
|
end
|
end
|
table.insert( row_item.attrs, attr_cell )
|
end
|
table.insert( row_data_set, row_item)
|
end
|
|
local action = {
|
{
|
action_type = "reset_data_attr",
|
value = row_data_set
|
}
|
}
|
|
lua.Debug( strLuaDEID, debug.getinfo(1), "action", action )
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if ( nRet ~= 0 ) then
|
lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo)
|
end
|
|
end
|