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
47
--[[
    编码: WMS-17-02
    名称: 计划盘点容器-删除后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjDelete
 
    功能:
        -- 删除 【计划盘点容器明细】
 
    更改记录:
    
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
m3 = require("oi_base_mobox")
 
function AfterDataObjDelete ( strLuaDEID )
    local   nRet, strRetInfo, plan_count_no
 
    -- 获取 盘点计划编号
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_COUNT_NO", "S_CNTR_CODE","S_CP_NO" ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
    local obj_attrs = json.decode( strRetInfo ) 
    local count_no = lua.Get_StrAttrValue( obj_attrs[1].value )        -- 盘点单号
    local cntr_code = lua.Get_StrAttrValue( obj_attrs[2].value )       -- 盘点容器
    local cp_no = lua.Get_StrAttrValue( obj_attrs[3].value )           -- 盘点容器
 
    lua.Debug( strLuaDEID, debug.getinfo(1), "计划盘点容器删除后", strRetInfo )
 
    if ( cntr_code ~= "") then
        local strCondition = ''
        if ( count_no ~= '' ) then
            strCondition = "S_COUNT_NO = '"..count_no.."' AND S_CNTR_CODE = '"..cntr_code.."'"
        elseif ( cp_no ~= "" ) then
            strCondition = "S_CNTR_CODE = '"..cntr_code.."' AND S_COUNT_NO IN ( Select S_COUNT_NO From TN_Count_Order with(NOLOCK) Where S_CP_NO = '"..cp_no.."')"
        end
        if ( strCondition ~= '') then
            nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Count_CG_Detail", strCondition )
            if ( nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "删除盘点计划相关的【盘点容器货品明细】失败!  "..strRetInfo ) end  
        end
    end
end