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
--[[
    编码: WMS-01-09
    名称: 容器-解绑
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: Unbinding
 
    用在: 容器对象3000系列页面中,点中容器进行解绑
          用于实施辅助,在实施阶段用该功能构建数据用
    功能:
        容器货位进行解绑,释放库存,库存量会减少
        
    更改记录:
     
--]]
 
wms_cntr = require( "wms_container" )
 
function Unbinding ( strLuaDEID ) 
    local nRet, strRetInfo
    local cntr_code, data_json
 
    nRet, data_json = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then 
        lua.Stop( strLuaDEID, data_json )
        return 
    end  
    local nCount = #data_json
    if ( nCount == 0 ) then  return end
    local cntr
 
    nRet, cntr = m3.ObjAttrStrToLuaObj( "Container", data_json[1].attrs )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, cntr )
        return 
    end  
    local cntr_code = cntr.code or ''
    if ( cntr_code ~= '' ) then
        local action_src = ''
        local login_info
        nRet, login_info = wms_base.Get_CurLoginUserInfo( strLuaDEID )
        if ( nRet == 0 ) then 
            action_src = "'"..login_info.user_name.."'手动解绑容器和货位之间关系" 
        end
    
        nRet, strRetInfo = wms_cntr.Unbinding( strLuaDEID, cntr_code, action_src )
        if ( nRet ~= 0 ) then 
            lua.Stop( strLuaDEID, "解绑容器'"..cntr.code.."'失败!"..strRetInfo )
            return
        end
 
        local action = {
            {
                action_type = "refresh_cur_row",
                value = ""
            }
        }
        nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
        if ( nRet ~= 0 ) then 
            lua.Stop( strLuaDEID, "setAction错误: "..strRetInfo)
            return
        end         
    end
    
end