Jianw
2025-05-14 29f8b36ebb718d2051bf0e7e701973ec4419ee80
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
--[[
    编码: WMS-22-21
    名称: 发货单-按钮-报表
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: Report
    功能:
        -- 检查一下库存是否可以进行分拣
        -- 如果缺件显示缺件信息
        -- 如果可以进行分拣要锁定当前发货单的出库量,仓库加 分配量
        
    更改记录:
 
--]]
 
wms_base = require ("wms_base")
 
function Report( strLuaDEID )
    local nRet, strRetInfo
    local shipping_order = {}     -- 发货单
 
    -- step1  获取当前点中的数据对象
    nRet, objs = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end  
    -- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
    local nCount = #objs
    if (nCount == 0) then  return end
 
    nRet, shipping_order = m3.ObjAttrStrToLuaObj( "Shipping_Order", lua.table2str(objs[1].attrs) )
    local strUserLogin, strUserName
    nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
    if ( nRet ~= 0 ) then strUserName = "??" end
 
    local action = {}
    action[1] = {
        action_type = "open_report_dlg",
        value  = {
            report_def_name = "大元发货单",
            page_row = 20,
            parameter = {
                operator = strUserName,
                operation_time = os.date("%Y-%m-%d %H:%M")
            },
            data = {
                master_data = {
                    cls = "Shipping_Order",
                    attr_values = { S_NO = shipping_order.no }
                },
                sub_data = {
                    table_name = "发货单明细",
                    condition = "S_SHIPPING_NO = '"..shipping_order.no.."'" ,
                    order = "N_ROW_NO"
                }
            }
        }
    }
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "report", action)
 
    -- 告诉前端弹出一个报表界面
    --local strAction = '[{"action_type":"open_report_dlg","value":'..lua.table2str(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