fy36
2025-05-14 a37aca60ff9914b0abb710f04118b22420f4f398
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
--[[
    编码: WMS-82-03
    名称: 批量入库测试-删除后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjDelete
 
    功能:
        删除容器,如果有和货位绑定解绑
    变更记录:
 
--]]
wms_wh = require( "wms_wh" )
 
function AfterDataObjDelete ( strLuaDEID ) 
    local   nRet, strRetInfo
    -- step1  获取当前删除的作业编码
    local test
    nRet, test = m3.GetSysCurEditDataObj( strLuaDEID, "TEST_Inbound" )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..test ) end 
    if ( test.cntr_code ~= '' and test.cntr_code ~= nil ) then
 
    end
 
    -- step2  如果没有错误信息,并且S_LOC_CODE有值,需要解绑容器和货位
    if ( test.loc_code ~= '' and test.err == '') then
        local loc
        bRet, loc = wms_wh.GetLocInfo( test.loc_code)
        if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "WMS_GetLocInfo失败! "..loc ) end
 
        nRet, strRetInfo = wms_wh.Loc_Container_Unbinding( strLuaDEID, loc.code, test.cntr_code, "绑定解绑方法-人工",  "测试数据用例" )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), '货位容器绑定失败!'..strRetInfo ) end       
            
        -- 减库区/仓库量表 (通过CG_Detail)
        nRet, strRetInfo = wms_base.Reduce_WHAreaQty_ByCGDetail(strLuaDEID, loc.wh_code, loc.area_code, test.cntr_code )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), 'wms_base.Reduce_WHAreaQty_ByCGDetail失败!'..strRetInfo ) end     
    end 
 
    local strCondition = "S_CODE = '"..test.cntr_code.."'"
    nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Container", strCondition )
    if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除【Container】失败!  "..strRetInfo ) end  
 
end