--[[
|
编码: GK-52-15#2
|
|
名称: 显示播种墙
|
作者:
|
日期:2025-7-5
|
|
函数: ShowHTMLPage
|
功能:
|
|
更改记录:
|
|
--]]
|
|
wms_base = require("wms_base")
|
wms_wh = require("wms_wh")
|
|
local function selectjh(tbData, v)
|
local borderColor = "#ddd"
|
local backgroundColor = "f5f5f5"
|
for _, data in ipairs(tbData) do
|
if v == data.value then
|
-- borderColor = data.color
|
backgroundColor = data.color
|
end
|
end
|
return borderColor, backgroundColor
|
end
|
|
function ShowHTMLPage(strLuaDEID)
|
local nRet, strRetInfo, data_json
|
local runtime_parameter
|
nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID, "GetRuntimeParam失败! " .. runtime_parameter)
|
return
|
end
|
|
-- 获取【播种墙显示】面板的参数
|
-- 参数格式: { cell_no, loc_code, light_color }
|
|
local parameter
|
nRet, parameter = m3.GetRuntimePanel_InputParamter(strLuaDEID, runtime_parameter.panel, "播种墙显示")
|
if (nRet == 1) then
|
return
|
end
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID, parameter)
|
return
|
end
|
if (parameter == nil) then
|
return
|
end
|
|
local img_url -- 浏览图片要用到
|
nRet, img_url = wms_base.Get_ImgUrl()
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID, img_url)
|
return
|
end
|
|
local cell_no = parameter.cell_no
|
local loc_code = parameter.loc_code or ''
|
local to_loc = {}
|
local row = 0
|
local col = 0
|
local layer = 0
|
|
if loc_code ~= '' then
|
nRet, to_loc = wms_wh.GetLocInfo(loc_code)
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID, '获取货位信息失败! ' .. to_loc)
|
return
|
end
|
row = to_loc.row
|
col = to_loc.col
|
layer = to_loc.layer
|
end
|
|
-- 生成播种位
|
--[[ 拣货信息 ]]
|
local tbJh = {
|
Row = 1,
|
Col = 4,
|
Layer = 3,
|
Title = "博种墙"
|
}
|
|
--[[ 代表要选中的格子 ]]
|
--[[ value=row - layer - col 组成]]
|
local show_point = row .. "-" .. col .. "-" .. layer
|
local color = parameter.light_color or "#7CFC00"
|
local tbData = {{
|
value = show_point,
|
color = color
|
}}
|
--[[ 格子高宽 ]]
|
local strJhWH = "30px"
|
local strHtml =
|
'<div class="view-jh" style="display: flex;justify-content: center;align-items: center;height: 100%;"><div style=" display: flex;justify-content: center;align-items: center;text-align: center;gap: 100px;">'
|
|
local strLayerHtml = ""
|
local nlayer = tbJh.Layer
|
local nCol = tbJh.Col
|
local strTitle = tbJh.Title
|
local nRow = tbJh.Row
|
|
for j = 1, nlayer do
|
local strColHtml = ""
|
for index = 1, nCol do
|
--[[ row - layer - col ]]
|
local coordinate = nRow .. "-" .. j .. "-" .. index
|
--[[ 拿当前坐标到 tbData中查是否存在 返回对应的颜色]]
|
local borderColor, backgroundColor = selectjh(tbData, coordinate)
|
|
strColHtml = strColHtml .. '<td style="padding: 2px 3px;"><a title="GKS' .. coordinate ..
|
'" style="background:' .. backgroundColor .. ';border: 1px solid ' .. borderColor ..
|
'; width: ' .. strJhWH .. ';height: ' .. strJhWH ..
|
';display: inline-block;vertical-align: sub;"></a></td>'
|
|
end
|
if (strColHtml ~= "") then
|
strLayerHtml = '<tr>' .. strColHtml .. '</tr>' .. strLayerHtml
|
end
|
end
|
|
strHtml = strHtml .. '<div class="view-jh01"> <label class="lb_row">' .. strTitle .. '</label><table> <tbody>' ..
|
strLayerHtml .. ' </tbody></table></div>';
|
|
strHtml = strHtml .. '</div></div>'
|
|
local action = {{
|
action_type = "set_panel_html",
|
value = strHtml
|
}}
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, json.encode(action))
|
if (nRet ~= 0) then
|
lua.Stop(strLuaDEID, "setAction失败! " .. strRetInfo .. ' action = ' .. action)
|
return
|
end
|
end
|