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
--[[
    编码: WMS-57-14
    名称: 预分配容器-批量预分配容器取消.
    作者:HAN  
    日期:2025-1-29
 
    级别:项目
    
    函数: CancelNoOperation_ORGC
 
    功能:
        -- 批量取消哪些已经出库作业都不存在的入库组盘(这是巨星测试的时候留下的错误数据)
    更改记录:
 
--]]
wms_op = require( "wms_operation" )
wms_in = require( "wms_inbound" )
 
function CancelNoOperation_ORGC( strLuaDEID )
    local nRet, strRetInfo
 
    -- step1: 找到状态=0、1
    local strCondition = "N_B_STATE = 0 OR N_B_STATE = 1"
    nRet, data_objs = m3.QueryDataObject(strLuaDEID, "Pre_Alloc_Container", strCondition, "S_PAC_NO" )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1),"QueryDataObject失败!"..data_objs ) end
    if ( data_objs == '' ) then return  end
    
    lua.Debug( strLuaDEID, debug.getinfo(1), "Pre_Alloc_Container", data_objs )
 
    local n, can_cancel
    local obj_attrs, pac_obj, operation
 
    for n = 1, #data_objs do
        -- 判断作业是否此存在
        can_cancel = true
        nRet, pac_obj = m3.GetDataObject( strLuaDEID, "Pre_Alloc_Container", lua.trim_guid_str(data_objs[n].id) ) 
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), pac_obj ) end  
 
        nRet, operation = wms_op.GetInfo( strLuaDEID, pac_obj.out_op_no )
        if ( nRet == 1 ) then 
            -- 作业不存在
            nRet, strRetInfo = wms_in.Pre_Alloc_CNTR_Cancel( strLuaDEID, pac_obj )
            if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), can_cancel ) end  
            -- 增加一个后台进程对组盘进行处理,触发配盘明细中的入库波次是否可以完成
            local add_wfp = {
                wfp_type = 1,
                cls = "Pre_Alloc_Container",
                obj_id = pac_obj.id,
                obj_name = "组盘'"..pac_obj.pac_no.."'-->入库后处理",
                trigger_event = "入库后处理"
            }
            nRet, strRetInfo = m3.AddSysWFP( strLuaDEID, add_wfp )
            if ( nRet ~= 0 ) then 
                lua.Error( strLuaDEID, debug.getinfo(1), "AddSysWFP失败!"..strRetInfo )  
            end  
        end      
    end  
end