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
87
88
89
90
91
92
--[[
    编码: WMS-09-10
    名称: 显示前
    作者:HAN    
    日期: 2025-1-29
 
    入口函数:BeforeGridShow
 
    功能说明:
        控制行按钮显示
--]]
 
wms_task = require( "wms_task" )
 
function BeforeGridShow ( strLuaDEID ) 
    local nRet, strRetInfo
    local lock_objs
    local n, nCount
    local lock_type = {"","入库锁","出库锁","禁用"}
    local lock_obj_type = {"","货位","逻辑库区"}
 
    nRet, lock_objs = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), lock_objs ) end  
    nCount = #lock_objs
    if (nCount == 0) then  return end
 
    local obj
    local row_data_set = {}
    local bs_state
    local n_obj_type, n_lock_type
    local task_code, op_code
    local task, operation
    local do_check_again = false
    for n = 1, nCount do
        local row_item = {}
 
        obj = lock_objs[n]
        row_item.id = obj.id
        row_item.attrs = {}
        row_item.row_button_hidden = "删除"
        task_code = ''
        op_code = ''
        -- 获取 项目清单 对象属性
        for nIndex = 1, #obj.attrs do
            local attr_value = {}
 
            attr_value.attr  = obj.attrs[nIndex].attr
            attr_value.value = obj.attrs[nIndex].value
 
            if ( attr_value.attr  == 'N_OBJ_TYPE' ) then
                n_obj_type = lua.StrToNumber( attr_value.value )
                attr_value.value = lock_obj_type[n_obj_type+1]
 
            elseif ( attr_value.attr  == 'N_TYPE' ) then
                n_lock_type = lua.StrToNumber( attr_value.value )
                attr_value.value = lock_type[n_lock_type+1]
            elseif ( attr_value.attr == 'S_TASK_CODE' ) then
                task_code = attr_value.value
            elseif ( attr_value.attr == 'S_OP_CODE' ) then
                op_code = attr_value.value                
            end
            table.insert( row_item.attrs, attr_value )
        end
 
        do_check_again = true
        if ( task_code ~= '' ) then
            -- 检查一下任务是否有效,还是激活的任务,任务完成,任务不存在就可以取消这个任务产生的货位锁
            nRet, task = wms_task.GetInfo( strLuaDEID, task_code )
            if ( nRet == 1 ) then
                -- 任务已经不存在
                row_item.row_button_hidden = ""
                row_item.row_bk_color = "#23EF9"
                do_check_again = false
            end
        end    
        if ( do_check_again and op_code ~= '') then
        end    
        table.insert( row_data_set, row_item)
    end
 
    local action = {
        {
            action_type = "reset_data_attr",
            value = row_data_set
        }
    }
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
    if ( nRet ~= 0 ) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) 
    end    
end