1
Jianw
2025-07-09 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
--[[
    编码:  WMS-56-29
    名称:  预分配容器明细-超重处理-呼出空料箱
    作者: HAN  
    日期: 2025-3-9
 
    级别: 项目
    
    函数: Overweight_CallEmptyBox
    功能:
        -- 获取当前站台信息,根据站台从数据【】中获取 S_FROM_OP=""的站台货品明细
        -- 根据
 
    更改记录:
--]]
jx_base= require( "jx_base" )
 
function Overweight_CallEmptyBox ( strLuaDEID ) 
    local nRet, strRetInfo
    local station_no
 
    -- 获取当前选中的站台号
    nRet, station_no = m3.GetSysCurEditDataOneAttr( strLuaDEID, "S_STATION_NO" )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "GetSysCurEditDataOneAttr失败! "..station_no ) end
    if ( staion_no == '' ) then
        mobox.setInfo( strLuaDEID, "站台号不能为空!")
        return
    end
    
    -- 查找站台货品明细表中存在哪结果出库波次需要补空料箱
    local strCondition = "N_B_STATE = 0 AND S_STATION_NO = '"..station_no.."'"
    nRet, strRetInfo = mobox.groupDataObjAttrs( strLuaDEID, "Station_Goods_Detail", strCondition, "", "S_BS_TYPE", "S_BS_NO" )
    if ( nRet ~= 0 ) then
        lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo )
    end
    if ( strRetInfo == '' ) then
        mobox.setInfo( strLuaDEID, "站台"..station_no.."没有超重检查货品!")
        return
    end
 
    local strUserLogin, strUserName
    nRet, strUserLogin, strUserName = mobox.getCurUserInfo( strLuaDEID )
    if ( nRet ~= 0 ) then 
        mobox.stopProgram( strLuaDEID, "获取当前操作人员信息失败! "..strUserLogin ) 
        return
    end
 
 
    local area_group = json.decode( strRetInfo ) 
    local bs_type = area_group[1][1].value
    local bs_no = area_group[1][2].value
 
    -- 组织后台脚本执行的输入参数
    local paramter = {
        station = station_no,
        login = strUserLogin,
        user_name = strUserName,
        bs_type = bs_type,
        bs_no = bs_no
    }  
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "paramter",  paramter )
 
    nRet, strRetInfo = mobox.addBackendScriptProc( "Station_Goods_Detail","呼出空料箱", lua.table2str( paramter ) )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo ) end
 
    -- proc_id 是后台处理进程标识,可以通过这个值获取进程是否处理完成
    local data_json = {
        proc_id = strRetInfo,       -- 后台处理进程标识
        from = "Overweight_call",
        station  = station_no,
        bs_type = bs_type,
        bs_no = bs_no        
    }
    local action = 
    {
        {
            action_type = "wait",
            value = {
                time = 1,                   -- 1 秒中刷新一次
                event = {
                    cls_name = "Pre_Alloc_CNTR_Detail",
                    event_name = "获取入库空料箱计算结果",
                    data_json = data_json
                }
            }
        },
    }
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action) )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction失败! "..strRetInfo..' action = '..strAction ) end        
 
end