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
--[[
    编码: WMS-38-25
    名称: 任务-PDA-任务显列表HTML页面
    作者:HAN  
    日期:2025-1-29
 
    级别:项目
    
    函数: GenerateItemListHTML
 
    功能:
        生产一个任务对象属性显示页面的HTML
        <div class="dv_panel_content">
              <div class="dv_panel_attr">
                <label>No:</label>
                <span>TA240129-00001</span>
              </div>
              <div class="dv_panel_attr">
                <div class="dv_box_node">
                  <p>毛料线边</p>
                  <label>L002-1</label>
                </div>
                <i class="mobox-normal-right"></i>
                <div class="dv_box_node">
                  <p>毛料线边</p>
                  <label>L003-3</label>
                </div>
              </div>
        </div>
 
 
    更改记录:
 
--]]
wms_wh = require( "wms_wh" )
 
local function gen_item_html( attrs )
    local item = m3.KeyValueAttrsToObjAttr(attrs)
 
    local str_html = '<div class="dv_panel_content"><div class="dv_panel_attr"><label>No:</label>'
    str_html = str_html.."<span>"..item.S_CODE..'</span> <div class="dv_panel_attr">'
 
    -- 获取起点库区名称
    local area
    nRet, area = wms_wh.GetAreaInfo( item.S_START_AREA )
    if (nRet ~= 0) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "从内存获取编码'"..item.S_START_AREA.."'的库区信息失败!" )
    end
    str_html = str_html..'<div class="dv_box_node"><p>'..area.name.."</p>"
    str_html = str_html..'<label>'..item.S_START_LOC..'</label></div><i class="mobox-normal-right"></i>'
 
    -- 获取终点库区名称
    nRet, area = wms_wh.GetAreaInfo( item.S_END_AREA )
    if (nRet ~= 0) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "从内存获取编码'"..item.S_END_AREA.."'的库区信息失败!" )
    end    
    str_html = str_html..'<div class="dv_box_node"><p>'..area.name.."</p>"
    str_html = str_html..'<label>'..item.S_END_LOC..'</label></div></div></div>'
 
    return str_html
end
 
function GenerateItemListHTML ( strLuaDEID ) 
    local nRet, strRetInfo, strErr
    local html_array = {}
 
    local data_json
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), data_json ) end
    for n = 1, #data_json do
        local str_html
        str_html = gen_item_html( data_json[n].attrs )
        html_array[n] = str_html
    end
 
    local action = {}
 
    action.action_type = "set_panel_html"
    action.value = html_array
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "action! ", action )
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, '['..lua.table2str(action)..']'  )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end 
 
end