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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--[[
    编码: WMS-20-15
    名称: 空料箱呼出取消
    作者:HAN  
    日期:2025-1-29
 
    级别:项目
    
    函数: ResetBSState
 
    功能:
        把入库单的状态设置为 0 
 
    更改记录:
 
--]]
 
wms_base= require( "wms_base" )
 
function ResetBSState ( strLuaDEID ) 
    local   nRet, strRetInfo
 
    -- step1  获取当前点中的任务
    nRet, objs = m3.GetSysDataJson( strLuaDEID )
    if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end  
   
    local n
    local obj_attrs, strCondition
 
    for n = 1, #objs do
        obj_attrs = m3.KeyValueAttrsToObjAttr( objs[n].attrs )
        if ( lua.StrToNumber( obj_attrs.N_B_STATE ) == 1 ) then
            strOpNo = obj_attrs.S_NO
            if ( strOpNo == nil or strOpNo == '' ) then
            else
                -- 删除预分配容器
                strCondition = "S_BS_NO = '"..strOpNo.."'"
                nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "Pre_Alloc_Container", strCondition )
                if ( nRet ~= 0) then return lua.Error( strLuaDEID, debug.getinfo(1), "删除相关的【Pre_Alloc_Container】失败!  "..strRetInfo ) end 
                -- 容器解锁 
                wms.wms_UnlockCntrByTrans( strLuaDEID, strOpNo ) 
 
                -- 设置业务状态为0
                local strUpdateSql = "N_B_STATE = 0"
                local strCondition = "S_NO = '"..strOpNo.."'"
                nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Inbound_Order", strCondition, strUpdateSql )
                if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "更新【入库单】信息失败!"..strRetInfo ) end                                
            end
        end
    end
 
 
    local action = {
        {
            action_type = "refresh_cur_row",
            value = ""
        }
    }
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
    if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end  
end