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-19-06
    名称: 容器货品明细-删除后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjDelete
 
    功能:
    更改记录:
 
--]]
 
wms_base = require( "wms_base" )
 
function AfterDataObjDelete ( strLuaDEID ) 
    local   nRet, strRetInfo
 
    -- step1: 获取当前【容器货品明细】对象
    local cg_detail
    nRet, cg_detail = m3.GetSysCurEditDataObj( strLuaDEID, "CG_Detail" )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..cg_detail ) end 
  
    -- step3: 容器货品解绑操作
    if (cg_detail.bs_no ~= '') then
        -- V10.0
        local strCondition
        if ( cg_detail.bs_type == "Inbound_Order") then
            --  业务来源是 入库单
            strCondition = "S_IO_NO = '"..cg_detail.bs_no.."' AND N_ROW_NO = "..cg_detail.bs_row_no
            nRet, strRetInfo = mobox.decDataObjAccQty( strLuaDEID, "Inbound_Detail", strCondition, "F_ACC_B_QTY", cg_detail.qty)
            if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "decDataObjAccQty(Inbound_Detail)失败! "..strRetInfo ) end 
        end       
    end
 
    -- V9.1 容器中的 N_DETAIL_COUNT - 1
    local strCondition = "S_CODE = '"..cg_detail.cntr_code.."'"
    local strUpdateSql = "N_DETAIL_COUNT = N_DETAIL_COUNT - 1"
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Container", strCondition, strUpdateSql )
    if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "更新【容器】中的明细条数失败!"..strRetInfo ) end     
end