--[[
|
编码: WMS-28-15
|
名称: 盘点单-显示前
|
作者:HAN
|
日期: 2025-3-20
|
|
入口函数:BeforeGridShow
|
|
功能说明:
|
|
--]]
|
|
json = require ("json")
|
mobox = require ("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function BeforeGridShow ( strLuaDEID )
|
local nRet, strRetInfo
|
local count_order_objs
|
local n, nCount
|
local type_name = {"货品盘点","货位盘点","容器盘点"} -- 盘点单类型名称
|
local state_name = {"执行中","完成","关闭"}
|
local cr_state_name = {"","成功","失败","错误"} -- 完工回报状态
|
local dr_state_name = {"","成功","失败","错误"} -- 差异回报状态
|
|
m3.PrintLuaDEInfo( strLuaDEID )
|
|
nRet, count_order_objs = m3.GetSysDataJson( strLuaDEID )
|
if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), count_order_objs ) end
|
nCount = #count_order_objs
|
if (nCount == 0) then return end
|
|
local obj
|
local row_data_set = {}
|
local co_type, emptyfull_state, cntr_type
|
local m
|
strDataJson = '['
|
for n = 1, nCount do
|
local row_item = {}
|
|
obj = count_order_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_TYPE' ) then
|
attr_value.value = type_name[lua.StrToNumber( attr_value.value )]
|
elseif ( attr_value.attr == 'N_B_STATE' ) then
|
attr_value.value = state_name[lua.StrToNumber( attr_value.value )]
|
elseif ( attr_value.attr == 'N_CR_STATE' ) then
|
attr_value.value = cr_state_name[lua.StrToNumber( attr_value.value )+1]
|
elseif ( attr_value.attr == 'N_DR_STATE' ) then
|
attr_value.value = dr_state_name[lua.StrToNumber( attr_value.value )+1]
|
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
|