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
ÿþ--[[
    x: WMS-01-01
     Tðy: ¹[hV-ã‰Ñ~
    \O€ÿHAN  
    åegÿ2023-9-14
 
    §~+RÿúVš[ (ô‹f,gµkãNx(Wy˜îv-N N*YOØSS)
    
    ýQpeÿ Unbinding
 
    ŸRý€:
        1    ÿ Rd–¹[hV-N@b    g'ÁTŒT¹[hV„vÑ~š[sQû| ÿُ*N N/fNag'ÁT„vã‰Ñ~/fhQèã‰Ñ~
    ôf9e°‹U_:
        V2.0 HAN 20240102  wms_CGUnbinding bcb wms_Putaway_DecAccBindingQty
--]]
 
json  = require ("json")
mobox = require ("OILua_JavelinExt")
wms   = require("OILua_WMS")
m3 = require( "oi_base_mobox" )
 
function Unbinding ( strLuaDEID ) 
    local nRet, strRetInfo
    local row_data
    -- step1  ·ƒÖSS_MR¹[hV÷S
    nRet, row_data = m3.GetSysInputParameter( strLuaDEID ) 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS¹[hVù[aŒ^\'`1Y%! "..row_data ) end 
    -- Šb [{"attr":"a1","value":"xxx"},..] „vjsonù[aŒlb {"a1":"xxx","b1":"xxx"}
    
    local obj_attrs = m3.KeyValueAttrsToObjAttr( row_data.attrs )
    local cntr_code = lua.Get_StrAttrValue( obj_attrs.S_CODE )            -- ¹[hVx
    if ( cntr_code == '' or cntr_code == nil ) then lua.Error( strLuaDEID, debug.getinfo(1), "¹[hVx Ný€:Nzz! " ) end 
 
    -- step2  ·ƒÖS¹[hV'ÁTfÆ~°‹U_
    local strCondition = "S_CNTR_CODE = '"..cntr_code.."'"
    local strOrder = ""
 
    
    nRet, strRetInfo = mobox.queryDataObjAttr( strLuaDEID, "CG_Detail", strCondition, strOrder, "S_ITEM_CODE" )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "·ƒÖS0„˜6e'USfÆ~01Y%! "..strRetInfo ) end
    if ( strRetInfo == '' ) then return end
    local retObjs = json.decode( strRetInfo )
    local nCount = #retObjs
    local n
    
    for n = 1, nCount do
        nRet, strRetInfo = wms.wms_Putaway_DecAccBindingQty( strLuaDEID, retObjs[n].id, "serial" )
        if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "wms_Putaway_DecAccBindingQty 1Y%! "..strRetInfo ) end
    end
    
end