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
--[[
    编码: WMS-40-02
    名称: 删除后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjDelete
 
    功能:
        1)删除和作业相关的任务
    变更记录:
 
--]]
wms_base = require ("wms_base")
 
function AfterDataObjDelete ( strLuaDEID ) 
    local   nRet, strRetInfo
    -- step1  获取当前删除的作业编码
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_CODE", "S_CNTR_CODE" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前删除的【作业】对象信息失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local op_code = lua.Get_StrAttrValue( obj_attrs[1].value )            -- 作业类型
    local cntr_code = lua.Get_StrAttrValue( obj_attrs[2].value )          -- 容器编码
 
    -- step2  OP
    if ( op_code ~= "" ) then
        -- 删除相关的任务对象
        local strCondition = "S_OP_CODE = '"..op_code.."'"
        nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Task", strCondition )
        if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除作业相关的【任务】失败!  "..strRetInfo ) end  
 
        -- V7.0 
        -- 货位锁
        nRet, strRetInfo = wms.wms_UnlockByOperation( strLuaDEID, op_code )
        if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "通过作业解锁失败!  "..strRetInfo ) end 
        --  容器锁
        nRet, strRetInfo = wms.wms_UnlockCntr ( strLuaDEID, cntr_code )
        if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "容器解锁失败!  "..strRetInfo ) end 
        
    end
end