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
--[[
    编码: GK-52-11
    来源: WMS-56-14
    名称: 顶部窗口站台变化后
    作者:HAN  
    日期:2025-7-5
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterStationChange
 
    功能:
 
 
    更改记录:
 
--]]
wms_base = require("wms_base")
 
function AfterStationChange ( strLuaDEID ) 
    local nRet, strRetInfo
 
    -- 获取站台编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_STATION_NO" ) 
    if ( nRet ~= 0 )  then 
        lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..strRetInfo ) 
        return
    end 
    local obj_attrs = json.decode( strRetInfo ) 
    local station = lua.Get_StrAttrValue( obj_attrs[1].value )  
    if ( station == '' ) then return end
 
    local strCondition
    local cntr_list = {} -- 已经到站台的 预分配料箱
    local cntr_objs, obj_attrs
    
    strCondition = "N_B_STATE = "..DIST_CNTR_STATE.OutOK.." AND S_STATION_NO = '"..station.."'"
    nRet, cntr_objs = m3.QueryDataObject( strLuaDEID, "Distribution_CNTR", strCondition, "S_CNTR_CODE" )
    if nRet ~= 0 then 
        lua.Stop( strLuaDEID, "获取【Distribution_CNTR】信息失败! " .. station_objs ) 
        return
    end
 
    for _, obj in ipairs( cntr_objs ) do
        obj_attrs = m3.KeyValueAttrsToObjAttr(obj.attrs)  
        table.insert( cntr_list, obj_attrs.S_CNTR_CODE )  
    end  
 
    strCondition = "S_STATION_NO = '"..station.."' AND N_B_STATE = "..DC_DETAIL_STATE.CanDoPicking
    if lua.isTableEmpty( cntr_list ) then
        cntr_list = nil
    end
    local action =  {
        {
            action_type = "set_dlg_attr",
            value = {
                { attr = "S_CNTR_CODE", value = cntr_code, choice_list = cntr_list }
            }
        },
        {
            action_type = "set_query_condition",
            value = {
                condition = strCondition,
                order = "S_SOT_CODE",
                page_name = "当前任务"
            }            
        }
    }
 
 
    nRet, strRetInfo = mobox.setAction( strLuaDEID, lua.table2str(action)  )
    if ( nRet ~= 0 ) then 
        lua.Stop( strLuaDEID, "setAction失败! "..strRetInfo ) 
        return
    end 
 
end