Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--[[
   编码: JX-52-15
   名称: HTML界面-拣料箱显示
   作者:
   日期:2025-1-29
 
   函数: main
   功能:
        生成一条HTML页面,显示配盘明细中货品需要在哪个拣料箱
 
   更改记录:
        V2.0 HAN 20241103
        -- 改成直接获取拣料箱号
--]]
 
wms_base = require ("wms_base")
 
local function generate_picking_box_html( picking_box_code )
    local content = 
    '<div style="display: grid;place-items: center;"><div style="position: absolute;top: 40%;background-color: #EFE4B1;border: 2px solid #000;padding: 10px;border-radius: 5px;text-align: center;font-size: 19px;font-weight: 600;width: 160px;">'..
    picking_box_code..'</div></div>'
    return content
end
 
function main( strLuaDEID )
    local nRet, strRetInfo, data_json
 
    local runtime_parameter
    nRet, runtime_parameter = m3.GetRuntimeParam(strLuaDEID)
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetRuntimeParam失败! "..runtime_parameter ) end
    
    -- 获取【料格显示】面板的参数
    local parameter
    nRet, parameter = m3.GetRuntimePanel_InputParamter( strLuaDEID, runtime_parameter.panel, "拣料箱显示" )
    if ( nRet == 1 ) then return end
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), parameter ) end 
    if ( parameter == nil ) then return end    
    local pick_box_code = parameter.pick_box_code
    local str_html = ''
 
    if ( pick_box_code == nil or pick_box_code == '') then
        local img_url
        nRet, img_url = wms_base.Get_sConst2( strLuaDEID, "网站URL" ) 
        if ( nRet ~= 0 ) then
            lua.Stop( strLuaDEID, "系统无法获取常量'网站URL'")
            return
        end
 
        if (img_url == '') then
            mobox.setInfo( strLuaDEID, "常量'网站URL'不能为空!")
            return
        end
        local img = img_url.."nothing.png"    
        str_html = '<img src="'..img..'" '..'style="width: 400px;height: 220px;border: 1px solid #ddd;">'
    else
        str_html = str_html..generate_picking_box_html( pick_box_code )
    end
     
    local action = {
        {
            action_type = "set_panel_html",
            value = str_html
        }
    }
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end          
end