fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
--[[
   编码: JX-51-10
   名称: 
   作者:
   日期:2025-1-29
 
   函数: OpenHTMLViewDlg
   功能:
         显示配盘结果
 
   更改记录:
 
--]]
 
jx_base= require( "jx_base" )
 
-- 生成一个容器料格货品显示样式
local function generate_distribution_html_item( strLuaDEID, cntr_code, cell_no, item_code, item_name, qty, bs_no )
    local nRet, img_url
    nRet, img_url = wms_base.Get_sConst2( strLuaDEID, "网站URL" ) 
    if ( nRet ~= 0 ) then return 1, "系统无法获取常量'网站URL'" end
 
    local img = img_url..cell_no..".png"
 
    local content = 
        '<div style="width:560px;height:150px;border:1px solid #ddd;border-radius:6px;padding-left:9px;">'..
            '<div>'..
                '<span style="color:black;">料箱号:</span>'..
                '<span style="color:blue;">'..cntr_code..'</span>'..
            '</div>'..
            '<div style="display:flex;flex-direction:row;">'..
                '<div style="width: 200px;">'..
                    '<img src="'..img..'" '..
                        'style="width: 200px;height: 110px;border: 1px solid #ddd;">'..
                '</div>'..
                '<div style="width: 320px;padding-left:6px;">'..
                    '<div>'..
                        '<span style="color:black;padding-left: 26px;">料格:</span>'..
                        '<span style="color:blue;">'..cell_no..'</span>'..
                    '</div>'..    
                    '<div>'..
                        '<span style="color:black;">货品编码:</span>'..
                        '<span style="color:blue;">'..item_code..'</span>'..
                    '</div>'..
                    '<div style="display:flex;">'..
                        '<span style="color:black;">货品名称:</span>'..
                        '<span style="color:blue;width:calc(100% - 70px);">'..item_name..'</span>'..
                    '</div>'..
                    '<div>'..
                        '<span style="color:black;padding-left: 26px;">数量:</span>'..
                        '<span style="color:blue;font-size:20px;vertical-align:middle;font-weight:bold;">'..qty..'</span>'..
                    '</div>'..
                    '<div style="display:flex;">'..
                        '<span style="color:black;">出库单:</span>'..
                        '<span style="color:blue;width:calc(100% - 70px);">'..bs_no..'</span>'..
                    '</div>'..                    
                '</div>'..
            '</div>'..
        '</div>'
  
    return 0, content
end
 
function OpenHTMLViewDlg( strLuaDEID )
    local nRet, strRetInfo, data_json
    local img_url
    nRet, img_url = wms_base.Get_sConst2( strLuaDEID, "网站URL" ) 
    if ( nRet ~= 0 ) then
        lua.Stop( strLuaDEID, "系统无法获取常量'网站URL'")
        return
    end
 
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), data_json ) end  
 
    local str_html
    if ( data_json.d_cntr_detail_list == nil or #data_json.d_cntr_detail_list == 0 ) then
        str_html= '<img src="'..img_url..'noanything.7364c627.png" style="width: 200px;height: 110px;border: 1px solid #ddd;">'        
    else
        str_html = '<div style="display:flex;flex-direction:row;flex-wrap:wrap;gap:20px;">'
        local str_item
    
        for n = 1, #data_json.d_cntr_detail_list do
            nRet, str_item = generate_distribution_html_item( strLuaDEID,
                                                        data_json.d_cntr_detail_list[n].cntr_code,
                                                        data_json.d_cntr_detail_list[n].cell_no,
                                                        data_json.d_cntr_detail_list[n].item_code,
                                                        data_json.d_cntr_detail_list[n].item_name,
                                                        data_json.d_cntr_detail_list[n].qty,
                                                        data_json.d_cntr_detail_list[n].bs_no )
            if ( nRet ~= 0 ) then
                lua.Stop( strLuaDEID, str_item ) 
                return
            end
            str_html = str_html..str_item
        end
    
        str_html = str_html..'</div>'
    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