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
--[[
    编码: WMS-33-20
    名称: 指定出库-WFP-状态检查
    作者:HAN  
    日期:2025-1-29
 
    级别:项目
    
    函数: CheckState
 
    功能:
         -- 查询一下【指定出库】是否可以完成(会有多个容器出库)
 
    更改记录:
 
--]]
wms_base = require ("wms_base")
 
function CheckState ( strLuaDEID ) 
    local nRet, strRetInfo
    local specify_outbound = {}
    nRet, specify_outbound = m3.GetCurEditDataObj( strLuaDEID )
    if (nRet ~= 0) then lua.Error( strLuaDEID, debug.getinfo(1), "获取【指定出库】对象属性失败!"..specify_outbound ) end
 
    -- 检查指定出库容器状态
    -- N_B_STATE = 2, 3, 4
    local strCondition = "S_SO_NO = '"..specify_outbound.so_no.."' AND N_B_STATE >= 2"
    nRet, strRetInfo = mobox.getDataObjCount( strLuaDEID, "Specify_Outbound_CNTR", strCondition )
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "getDataObjCount失败!"..strRetInfo ) end
    local nCount = lua.StrToNumber( strRetInfo ) 
 
    -- 更新【指定出库】的状态和已完出库数量
    if ( specify_outbound.cntr_total == nCount ) then
        -- 3 完成
        strSetAttr = "N_B_STATE = 3, N_ACC_FINISH = "..nCount
    else
        strSetAttr = "N_ACC_FINISH = "..nCount
    end
    strCondition = "S_SO_NO = '"..specify_outbound.so_no.."'"
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Specify_Outbound", strCondition, strSetAttr )
    if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "更新【Specify_Outbound】信息失败!"..strRetInfo ) end  
end