Jianw
2025-05-13 3b39fe3810c3ee2ec9ec97236c1769c5c85e062c
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-19-07
    名称: 容器货品明细-创建后
    作者:HAN  
    日期:2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjCreate
 
    功能:
        -- 调用 wms_CGBinding 容器货品绑定操作,并加上架单明细中绑定数量
    更改记录:
 
--]]
 
wms_base = require( "wms_base" )
 
function AfterDataObjCreate ( 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 ~= '' and cg_detail.bs_no ~= nil) then
        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.incDataObjAccQty( strLuaDEID, "Inbound_Detail", strCondition, "F_QTY", "F_ACC_B_QTY", cg_detail.qty )
            if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "incDataObjAccQty(Inbound_Detail)失败! "..strRetInfo ) end  
            if ( strRetInfo ~= '') then
                lua.Error( strLuaDEID, debug.getinfo(1),  "在设置入库单明细累计组盘数量时失败!")
            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