lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
ÿþ--[[
    x: WMS-19-08
     Tðy: ¹[hV'ÁTfÆ~-îO9eT
    \O€ÿHANXU  
    åegÿ2023-12-05
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
    
    ýQpeÿ AfterDataObjModify
 
    ŸRý€:
        -- ·ƒÖSîO9eT„vN_'ÁT¶r` ÿegîO9eS_'ÁT¶r`
        -- ‚Yœg C_ITEM_MERGE = Y „vöeP ÿ‰$R­eN N/f&T    gîO9epeϑ ÿ‚YœgpeϑîO9e‰îO9e Container_Good -N„vpeϑ
 
    ôf9e°‹U_:
        V2.0 HAN 20240107
             -- žX Rù[ cg_detail.item_merge == 'Y' „vYt
             -- 9eb(u S_ID \O:NagöN
--]]
require ("WMS-BASE")
 
function AfterDataObjModify ( strLuaDEID ) 
    local cg_detail
    local nRet, strRetInfo
 
    nRet, cg_detail = m3.GetSysCurEditDataObj( strLuaDEID, "CG_Detail" )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖSS_MR‘^\'`1Y%! "..cg_detail ) end
 
    local n_item_state = lua.StrToNumber(cg_detail.item_state)
    local s_item_state = wms_base.GetDictItemName( strLuaDEID, "WMS_ItemState", n_item_state )
 
    --·ƒÖSS_MR‘„vpencù[aŒhƋ
    --V2.0
    local strClsID, strObjID
    nRet, strClsID, strObjID = mobox.getCurEditDataObjID( strLuaDEID )
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "getCurEditDataObjID1Y%! " ) end
    local strCondition = "S_ID = '"..strObjID.."'"
    local strSetSQL = "S_ITEM_STATE = '" ..s_item_state .."'"
    nRet, strRetInfo = mobox.updateDataAttrByCondition(strLuaDEID, "CG_Detail", strCondition, strSetSQL)
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), strRetInfo) end
 
    --V2.0
    if ( cg_detail.item_merge == 'Y') then
        local cg_id = cg_detail.cg_id 
        local qty = cg_detail.qty
        local old_cg_detail
        local qty
 
        nRet, old_cg_detail = m3.GetSysCurEditOldDataObj( strLuaDEID, "CG_Detail" )
        if ( cg_detail.qty ~= old_cg_detail.qty ) then
            -- ôf°e Container_Good
            local strSetAttr
            strCondition = "S_ID = '"..cg_detail.cg_id.."'"
            if ( cg_detail.qty > old_cg_detail.qty ) then
                qty = cg_detail.qty - old_cg_detail.qty
                strSetAttr = "F_QTY = F_QTY + "..qty
            else
                qty = old_cg_detail.qty - cg_detail.qty
                strSetAttr = "F_QTY = F_QTY - "..qty
            end
            nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Container_Good", strCondition, strSetAttr )
            if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "ôf°e0¹[hV'ÁT0peϑ1Y%!"..strRetInfo ) end 
        end
    end    
end