wsz
2025-06-20 19898bd66dec87b500b200d5d50961d0fb538ce5
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
--[[
    编码: JX-108-03
    名称: 任务池-删除后
    作者: KUN 
    日期: 2025-1-29
 
    级别:固定 (说明本段代码在项目中不太会变化)
    
    函数: AfterDataObjDelete
 
    功能:
 
    更改记录:
 
--]]
 
jx_api = require ( "jx_external_api")
 
function AfterDataObjDelete ( strLuaDEID )
    local  nRet, strRetInfo
    local nRet, strRetInfocode
 
    nRet, strRetInfo = mobox.getCurEditDataObjAttr( strLuaDEID, "S_CNTR_CODE", "N_B_STATE","S_SOURNO","S_START_WH") 
    if ( nRet ~= 0 )  then lua.Error( strLuaDEID, debug.getinfo(1), "获取当前编辑属性失败! "..strRetInfo ) end 
 
    local obj_attrs = json.decode( strRetInfo ) 
    local cntr_code = obj_attrs[1].value        --料箱号
    local b_state = lua.Get_NumAttrValue( obj_attrs[2].value )          --状态值
    local sour_no = obj_attrs[3].value          --上游任务号
    local start_wh_code = obj_attrs[4].value    --起点仓库
    
    local jx_task = {}
    jx_task = {
                sour_no = sour_no,              -- 来源单号
                cntr_code = cntr_code,          -- 容器号
                end_loc_code = "",              -- 终点点位 
                start_wh_code = start_wh_code   -- 起点仓库
                }
                
    if ( b_state == 0 ) then
        nRet, strRetInfocode = jx_api.WMS_API_SetPLCJobStatus(strLuaDEID, jx_task,"H")
        if (nRet ~= 0) then
            lua.Error(strLuaDEID, debug.getinfo(1), "调用 JX_WMS_API_SetLocation2 失败: " .. strRetInfocode)
        end
    end
    
    local strCondition = "S_SOURNO = '"..sour_no.."'"
    nRet, strRetInfo = mobox.deleteDataObject( strLuaDEID, "JX_Task", strCondition )
    if ( nRet ~= 0) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "删除【任务池】失败!  "..strRetInfo ) 
    end  
    
end