--[[
|
编码: hh-mobox-007
|
名称: 获取装箱工位A
|
作者:LZH
|
日期:2025-4-28
|
|
函数: GenerateViewHTML1
|
功能:
|
|
更改记录:
|
|
--]]
|
json = require("json")
|
mobox = require("OILua_JavelinExt")
|
m3 = require("oi_base_mobox")
|
|
function GenerateViewHTML1(strLuaDEID)
|
local nRet, strRetInfo
|
local autoplay = false
|
local strHtmlTitle = "";
|
local strHtmlRow = "";
|
--[[ 获取样式 ]]
|
local strHtmlStyle = GetHtmlStyle();
|
--[[ 列明 ]]
|
local tabTitleList = { "工位", "状态", "物料编码", "物料名称", "批次号", "装箱件数" }
|
|
--[[ 组织列名 ]]
|
--[[ class 处理样式 这里 组成(table-col' .. i .. ') table-col1,table-col2,table-col3 ]]
|
for i = 1, #tabTitleList do
|
strHtmlTitle = strHtmlTitle .. '<div class="table-col' .. i .. '">' .. tabTitleList[i] .. '</div>'
|
end
|
-- 获取执行中的作业数据
|
local tabDataList = {}
|
local packing_list
|
local orderBy = "T_CREATE DESC"
|
local strAttrInfo = '["S_STATE","S_ITEM_CODE","S_ITEM_NAME","S_STATION","S_BATCH_NO","N_PACK_QTY"]'
|
local strCondition = "S_STATE IN ('新建','启用') AND S_STATION = 'A'"
|
nRet, packing_list = mobox.queryTable(strLuaDEID, "TN_GT_Packing_Order", strAttrInfo, 100, strCondition, orderBy)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), packing_list) end
|
if (packing_list == '') then return end
|
packing_list = json.decode(packing_list)
|
-- 添加作业信息
|
for i = 1, #packing_list do
|
local back = "#ffc107"
|
if(packing_list[i].S_STATION == '启用')then
|
back = "#2196F3"
|
end
|
tabDataList[i] = {
|
item_code = packing_list[i].S_ITEM_CODE,
|
item_name = packing_list[i].S_ITEM_NAME,
|
batch_no = packing_list[i].S_BATCH_NO,
|
station_no = packing_list[i].S_STATION,
|
state = packing_list[i].S_STATE,
|
qty = packing_list[i].N_PACK_QTY,
|
back = back
|
}
|
end
|
|
if (#tabDataList > 4) then
|
autoplay = true
|
end
|
|
--[[ 组织行数据html ]]
|
for i = 1, #tabDataList do
|
strHtmlRow = strHtmlRow .. '<div class="swiper-slide"><div class="table-row-data">' ..
|
'<div class="table-col1">' .. '<div style=" background: ' .. tabDataList[i].back .. ';">' ..
|
tabDataList[i].station_no .. '</div>' .. '</div>' .. '<div class="table-col2">' ..
|
tabDataList[i].state .. '</div>' .. '<div class="table-col3">' .. tabDataList[i].item_code ..
|
'</div>' .. '<div class="table-col4">' .. tabDataList[i].item_name .. '</div>' ..
|
'<div class="table-col5">' .. tabDataList[i].batch_no .. '</div>' ..
|
'<div class="table-col6">' .. tabDataList[i].qty .. '</div>' .. '</div></div>'
|
end
|
|
--[[ 总html ]]
|
local strHtml = ' <div class="table91">' .. '<div class="table-head">' .. strHtmlTitle .. '</div>' ..
|
'<div class="table-body" style="overflow: hidden;"> <div class="swiper-container zxgw1"><div class="swiper-wrapper">' ..
|
strHtmlRow .. '</div></div></div>' .. '</div>'
|
|
local action = {}
|
action[1] = {
|
action_type = "chart",
|
value = {
|
graphicType = "html",
|
title = {
|
text = "当前入库任务",
|
align = "left",
|
color = "#fff",
|
font = "微软雅黑",
|
fontSize = 18
|
},
|
swiper = {
|
--[[ 容器名称不能重复 不能为空 swiper-container class 需要指定 ]]
|
containerName = "zxgw1",
|
--[[ 强制Swiper的宽度(px),"undefined" 或 整数, 当你的Swiper在隐藏状态下初始化时用得上。这个参数会使自适应失效。可设置为undefined使这个参数无效。 ]]
|
width = "undefined",
|
--[[ 强制Swiper的高度(px),当你的Swiper在隐藏状态下初始化时且切换方向为垂直才用得上。这个参数会使自适应失效。 ]]
|
height = 500,
|
--[[ 排列方向 vertical , horizontal ]]
|
direction = "vertical",
|
--[[ 切换速度,即slider自动滑动开始到结束的时间(单位ms) ]]
|
speed = 2000,
|
--[[ loop 模式如果与 slidesPerView: 'auto' 一起使用,需要设置 loopedSlides 指定要循环(重复)的幻灯片数量。 ]]
|
loop = true,
|
-- loopedSlides=10,
|
--[[ 设置slider容器能够同时显示的slides数量,整数或auto ]]
|
slidesPerView = 'auto',
|
--[[ 在slide之间设置距离(单位px)。 ]]
|
spaceBetween = 10,
|
--[[ 默认情况下Swiper 每次滑动时只滑动一个Slide,并且会自动贴合Wrapper。开启自由模式后,Swiper 会根据惯性滑动可能不止一格且不会贴合。 ]]
|
freeMode = false,
|
--[[ 设定slide与左边框的预设偏移量(单位px)。 垂直就行与上方距离 ]]
|
slidesOffsetBefore = 10,
|
--[[ 设定slide与右边框的预设偏移量(单位px)。 垂直就行与下方距离 ]]
|
slidesOffsetAfter = 10,
|
--[[是否自动播放,true 需要指定 autoplayDelay ]]
|
autoplay = autoplay,
|
--[[ 播放间隔时间,单位ms ]]
|
autoplayDelay = 100
|
},
|
html = strHtmlStyle .. strHtml
|
}
|
}
|
|
-- Debug( strLuaDEID, debug.getinfo(1), "action! ", action )
|
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, json.encode(action))
|
if (nRet ~= 0) then
|
lua.Error(strLuaDEID, debug.getinfo(1), "setAction失败! " .. strRetInfo)
|
end
|
end
|
|
function GetHtmlStyle()
|
return
|
'<style>' .. '.table91 {' .. ' border: 2px solid #fff;' .. ' width: 100%;' .. ' height: 100%;' .. '}' ..
|
'.table-head {' .. ' border-bottom: 2px solid #fff; color: #fff;' .. '}' .. '.table-head>div {' ..
|
' text-align: center;' .. ' display: inline-block;' .. ' padding: 5px 0px;' ..
|
' font-size: 17px;' .. ' font-weight: 600;' .. '}' .. '.table-head .table-col1 {' .. ' width: 10%;' ..
|
' border-right: 2px solid;' ..
|
'}' .. '.table-head .table-col2 {' .. ' width: 15%;border-right: 2px solid;' ..
|
' border-right: 2px solid;' ..
|
'}' .. '.table-head .table-col3 {' .. ' width: 15%;border-right: 2px solid;' .. '}' ..
|
'.table-head .table-col4 {' .. ' width: 45%;border-right: 2px solid;' .. '}' ..
|
'.table-head .table-col5 {' .. ' width: 15%;border-right: 2px solid;' .. '}' ..
|
'.table-head .table-col6 {' .. ' width: 10%;' .. '}' ..
|
'.table-body .table-row-data{ margin-top: 10px; width: 100%;} .table-body .table-row-data>div {' ..
|
' text-align: center;' .. ' display: inline-block;' .. ' padding: 5px 0px;' .. ' color: #fff;' ..
|
'}' .. '.table-row-data .table-col1 {' .. ' width: 10%;' .. '}' .. '.table-row-data .table-col1>div {' ..
|
' border-radius: 50px;' .. ' width: 92%;' .. ' display: inline-block;' .. ' padding: 5px 1px;' ..
|
' font-size: 12px;' .. '}' .. '.table-row-data .table-col2 {' .. ' width: 15%;' .. '}' ..
|
'.table-row-data .table-col3 {' .. ' width: 15%;' .. '}' ..
|
'.table-row-data .table-col4 {' .. ' width: 45%;' .. '}' ..
|
'.table-row-data .table-col5 {' .. ' width: 15%;' .. '}' ..
|
'.table-row-data .table-col6 {' .. ' width: 10%;' .. '}' ..
|
|
'</style>'
|
end
|