1
Jianw
2025-07-09 f6f5e6b632d6649386a380558d84003f3de7ec6c
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
--[[
    编码: WMS-01-10
    名称: 容器-Rest
    作者:HAN  
    日期:2025-1-29
 
    级别: 项目
    
    函数: Reset
 
    功能:
        -- 这个脚本一般有WPF进行调用
        -- 根据 INV_Detail 重新设置容器的明细数量,容器、料格空满状态
 
    更改记录:
 
--]]
wms_cntr = require( "wms_container" )
 
function Reset( strLuaDEID ) 
    local nRet, strRetInfo
    local cntr
    nRet, cntr = m3.GetSysCurEditDataObj( strLuaDEID, "Container" )
    if ( nRet ~= 0 )  then 
        lua.Stop( strLuaDEID, "获取当前编辑属性失败! "..cntr ) 
        return
    end  
    
    -- 先清除一下 INV_Detail 中Qty <=0 的记录
    local strCondition = "S_CNTR_CODE = '" .. cntr.code .."' AND F_QTY <= 0"
    nRet, strRetInfo = mobox.dbdeleteData(strLuaDEID, "INV_Detail", strCondition)
    if (nRet ~= 0) then 
        lua.Stop( strLuaDEID, "删除【INV_Detail】失败!"..strRetInfo )
        return
    end   
    
    -- 重置容器属性
    nRet, strRetInfo = wms_cntr.Reset( strLuaDEID, cntr )
    if ( nRet ~= 0 ) then
        lua.Stop( strLuaDEID, strRetInfo )
        return
    end        
 
end