1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
110
111
112
113
114
115
116
--[[
    编码: GK-56-12
    来源: WMS-56-12
    名称: 预分配容器明细 3053-点中入库任务
    作者:HAN  
    日期:2025-6-25
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: ClickItem
    功能:
        -- 3053 中的功能,点中入库任务后把入库信息 加到自定义表单的{3053-组盘界面}
 
    更改记录:
 
--]]
wms_cntr = require( "wms_container" )
 
function ClickItem ( strLuaDEID ) 
    local nRet, strRetInfo
    local data_json
 
    -- 获取点中的【预分配容器明细】
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if (nRet ~= 0) then 
        lua.Stop( strLuaDEID, data_json ) 
        return
    end     
    if ( #data_json ~= 1 ) then 
        lua.Stop( strLuaDEID, " datajson数据输入不正确 !" ) 
        return
    end 
    local id = lua.trim_guid_str( data_json[1].id )
    local action_array = {}
    local obj_attrs = m3.KeyValueAttrsToObjAttr( data_json[1].attrs )
 
    if ( obj_attrs.S_BS_NO == nil ) then
        mobox.setInfo( strLuaDEID, "当前任务列表中必须有来源单号列")
        return
    end
    if ( obj_attrs.S_BS_TYPE == nil ) then
        mobox.setInfo( strLuaDEID, "当前任务列表中必须有来源单类型列")
        return
    end    
    local cntr_code = obj_attrs.S_CNTR_CODE or ''
    if ( cntr_code == '' ) then
        mobox.setInfo( strLuaDEID, "当前任务列表中必须有料箱编号列")
        return
    end   
    local loc_code
    nRet, loc_code = wms_cntr.Get_Container_Loc( strLuaDEID, cntr_code )
    if nRet ~= 0 then
        lua.Stop( strLuaDEID, " Get_Container_Loc 失败!"..loc_code ) 
        return
    end   
    if loc_code == '' then
        mobox.setInfo( strLuaDEID, "料箱'"..cntr_code.."'没有和货位进行绑定!")
        return
    end    
    local station = obj_attrs.S_STATION_NO or ''
    if ( station == '' ) then
        mobox.setInfo( strLuaDEID, "当前任务列表中必须有站台列")
        return
    end  
    local groupID = "Station:"..station
 
    -- 如果当前的 入库任务 页面已经亮点,点中的【Pre_Alloc_CNTR_Detail】不是当前正在入库的任务,不能点中
    -- 获取周转箱缓存中的货品编码去匹配输入的条码
    nRet, strRetInfo = mobox.getCacheValue( "CurInboundTask", groupID )
    --  cur_in_task =  { tray_code,pac_detail_id }
    local cur_in_task = {}
    if nRet == 0 then
        mobox.setInfo( strLuaDEID, "当前入库任务还在执行中!")
        return
    end 
 
    -- 设置面板【3053-组盘界面】中的输入信息
    local action = {
        {
        action_type = "refresh_related_panel",
        value = {  
                    {
                        panel_name = "组盘输入",
                        input_parameter = {
                            id = id,
                            pac_no = obj_attrs.S_PAC_NO,                  -- 组盘号
                            item_code = obj_attrs.S_ITEM_CODE,
                            item_name = obj_attrs.S_ITEM_NAME,
                            cntr_code = cntr_code,
                            cell_no = obj_attrs.S_CELL_NO,
                            station = obj_attrs.S_STATION_NO,
                            batch_no = obj_attrs.S_BATCH_NO,
                            bs_no = obj_attrs.S_BS_NO,                      -- 来源业务单号
                            bs_type = obj_attrs.S_BS_TYPE,
                            bs_row_no = obj_attrs.N_BS_ROW_NO,
                            qty = lua.StrToNumber(obj_attrs.F_QTY)
                        }
                    },
                    {
                        panel_name = "料格显示",
                        input_parameter = {
                            cell_no = obj_attrs.S_CELL_NO,
                            loc_code = loc_code,
                            light_color = "#FFD700"                         -- 显示黄色
                        }
                    }  
                 }       
        }
    }   
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo ) 
        return
    end 
end