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
--[[
    编码: JX-33-02
    名称: 指定出库-创建后
    作者:HAN  
    日期:2025-1-29
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjCreate
 
    功能:
          -- 考虑到物料编码和容器编码允许输入,因此需要判断一下物料编码是否有效
 
    更改记录:
--]]
 
wms_out = require( "wms_outbound" )
wms_station = require( "wms_station" )
 
function AfterDataObjCreate ( strLuaDEID ) 
    local nRet, strRetInfo
    local specify_outbound
 
    nRet, specify_outbound = m3.GetCurEditDataObj( strLuaDEID )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..specify_outbound ) end 
 
    local station = lua.Get_StrAttrValue( specify_outbound.station )
    local to_loc_code = lua.Get_StrAttrValue( specify_outbound.to_loc_code )
    if ( to_loc_code == '' ) then
        nRet, to_loc_code = wms_station.Get_Station_Loc( strLuaDEID, station )
        if ( nRet ~= 0 ) then
            lua.Stop( strLuaDEID, to_loc_code )
            return
        end        
    end
    -- 1 指定货品出库
    if ( specify_outbound.type == 2 ) then
        nRet, strRetInfo = wms_out.Create_SOO_ByMaterial( strLuaDEID, station, specify_outbound.so_no, specify_outbound.area_code, specify_outbound.item_code, to_loc_code, "指定出库", "巨沃" )
        if ( nRet ~= 0 ) then
            mobox.stopProgram( strLuaDEID, "创建指定出库作业失败!"..strRetInfo )
            return
        end
    else
        -- 指定容器出库
        local cntr_code = specify_outbound.cntr_code
        -- 判断容器是否存在
        if ( wms_cntr.Exist( strLuaDEID, cntr_code ) == false ) then 
            mobox.stopProgram( strLuaDEID, "容器'"..cntr_code.."'不存在" )
            return             
        end  
                
        -- 创建指定出库作业
        nRet, strRetInfo = wms_out.Create_SOO_ByContainer( strLuaDEID, station, specify_outbound.so_no, cntr_code, to_loc_code, "指定出库", "巨沃" )
        if ( nRet ~= 0 ) then
            mobox.stopProgram( strLuaDEID, "创建指定出库作业失败!"..strRetInfo )
            return
        end
    end
 
end