1
Jianw
9 天以前 70f29da38121b9a467841253e3268feb5df02902
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
62
63
--[[
   编码: JX-12-10
   名称: 状态回报
   作者:
   日期:2025-1-29
 
   函数: StatusReturn
   功能:
 
   更改记录:
 
--]]
jx_base= require( "jx_base" )
jx_api = require ( "jx_external_api")
 
function StatusReturn( strLuaDEID )
    local nRet, strRetInfo,strRetInfop,strRetInfocode
    local jx_task = {}
    local jx_date = {}
    local model
    nRet, jx_date = m3.GetSysCurEditDataObj( strLuaDEID, "Task_Action" )
    if (nRet ~= 0) then 
        lua.Error( strLuaDEID, debug.getinfo(1), "获取【巨星任务】对象属性失败!"..jx_task ) 
    end
    if ( jx_date.data == '' ) then 
        return 
    end
    
    local success, jx_task = pcall(json.decode, jx_date.data)
    if (success == false) then
        lua.Error(strLuaDEID, debug.getinfo(1), "返回值为非法的JSON格式!" .. jx_task)
    end
    
    lua.Debug(strLuaDEID, debug.getinfo(1), "jx_task", jx_task)
    
    -- model, 异动回报,O:出库,I:入库,M:站台搬运
    if (jx_task.task_type == "巨星出库") then  
        model = "O"  
    elseif (jx_task.task_type == "站台搬运") then  
        model = "M"  
    else  
        model = "I"  
    end
 
    nRet, strRetInfo = jx_api.WMS_API_SetPLCJobStatus( strLuaDEID, jx_task , "9")--已下发已执行
    if ( nRet == 0 ) then  
        nRet, strRetInfo = jx_api.WMS_API_SetLocation(strLuaDEID, jx_task, model)--异动
    end
        
    -- 更新出库单的完工回报属性
    local curTime = os.date("%Y-%m-%d %H:%M:%S")
    strCondition = "S_BS_NO = '"..jx_task.sour_no.."'"
    local strSetAttr
    if ( nRet == 0 ) then
        strSetAttr = "N_CR_STATE = 1, S_CR_ERR = '', T_CR = '"..curTime.."'"
    else
        lua.Debug( strLuaDEID, debug.getinfo(1), "JW-WMS SetPLCJobStatus 接口错误", strRetInfo )
        strSetAttr = "N_CR_STATE = 2, S_CR_ERR = 'JW-WMS SetPLCJobStatus 接口错误, 详细信息看日志!', T_CR = '"..curTime.."'"
    end
    nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Task_Action", strCondition, strSetAttr )
    if ( nRet ~= 0 ) then  lua.Error( strLuaDEID, debug.getinfo(1), "更新【巨星任务】完工回报信息失败!"..strRetInfo ) end  
 
end