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
93
94
95
96
--[[
    编码: GK-56-24
    名称: 预分配容器明细-入库任务界面-任务取消
    作者:HAN  
    日期:2025-6-26
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: TaskCancel
 
    功能:
        -- 清除站台中的缓存,这些是入库任务留下的后台缓存
        -- 灭灯
        -- 清除入库界面
 
    更改记录:
 
 
--]]
wms_base = require( "wms_base" )
wms_ptl = require( "wms_ptl" )
 
function TaskCancel ( strLuaDEID ) 
    local nRet, strRetInfo
    local parameter
    nRet, parameter = m3.Get_3053_PanelParameter( strLuaDEID, "组盘输入" )
    if nRet ~= 0 then
        wms_base.Notice_Audio( strLuaDEID, parameter, "error.mp3" ) 
        return        
    end
    station = parameter.station
 
    if station == '' then return end
    local groupID = "Station:"..station
 
    nRet, strRetInfo = mobox.getCacheValue( "CurInboundTask", groupID )
    local cur_in_task = {}
    if ( nRet == 0 ) then 
        local success 
        success, cur_in_task = pcall( json.decode, strRetInfo )
        if ( success == false ) then
            wms_base.Notice_Audio( strLuaDEID, "获取当前入库任务缓存信息失败!", "error.mp3" ) 
            return   
        end
    end
 
    -- 清除站台的入库任务操作缓存
    mobox.removeCacheGroup( groupID )
 
    if not lua.isTableEmpty( cur_in_task ) then
        -- 灭灯
        nRet, strRetInfo = wms_ptl.TurnOff( cur_in_task.loc_code )
        if nRet ~= 0 then
            wms_base.Notice_Audio( strLuaDEID, "灭灯失败!", "error.mp3" ) 
        end   
    end
 
    local action = {
        {
        action_type = "refresh_related_panel",
        value = {  
                    {
                        panel_name = "料格显示",
                        input_parameter = {
                            cell_no =""
                        }
                    }  
                }       
        },
        {
            action_type = "set_panel_dlg_attr",
            value = {
                    panel_name = "组盘输入",
                    attrs = {
                                { attr = "BarCode", prompt = "请扫周转箱号" },
                                { attr = "Prompt", value = "请扫周转箱号" },                                
                                { attr = "S_ITEM_CODE", value = "" },
                                { attr = "S_ITEM_NAME", value = "" },
                                { attr = "S_BATCH_NO", value = "" },
                                { attr = "F_QTY", value = "" },
                                { attr = "ExpDate", value = "" },
                                { attr = "TrayCode", value = "" },
                                { attr = "F_ACT_QTY", value = "", enable = false }
                            }
                    }
            
        },        
    }   
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo ) 
        return
    end         
 
end