--[[
|
编码: JX-28-15
|
名称: 回报失败后再次回报
|
作者:KUN
|
日期:2025-03-18
|
|
函数: CompletionReturn
|
功能:
|
|
更改记录:
|
|
--]]
|
|
jx_base = require("jx_base")
|
jx_api = require("jx_external_api")
|
|
function CompletionReturn(strLuaDEID)
|
local nRet, strRetInfo
|
local data_json, obj_attrs
|
nRet, data_json = m3.GetSysDataJson(strLuaDEID)
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), data_json) end
|
-- [{"id":"","attrs":[{"attr":"","value":""},..]},..]
|
local nCount = #data_json
|
if (nCount == 0) then return end
|
lua.Debug( strLuaDEID, debug.getinfo(1), "data_json", data_json )
|
local id
|
local strCondition, strSetAttr
|
local jx_task
|
local curTime = os.date("%Y-%m-%d %H:%M:%S")
|
local refresh = false
|
|
for n = 1, #data_json do
|
id = lua.trim_guid_str(data_json[n].id)
|
strCondition = "S_ID = '" .. lua.trim_guid_str(data_json[n].id) .. "'"
|
nRet, count_obj = m3.GetDataObjByCondition(strLuaDEID, "Count_Order", strCondition)
|
lua.Debug(strLuaDEID, debug.getinfo(1), "count_obj", count_obj)
|
|
|
nRet, strRetInfo = jx_api.JW_WMS_API_newOffShelfs( strLuaDEID, count_obj.count_no )
|
|
-- 更新盘点单的差异回报属性
|
local curTime = os.date("%Y-%m-%d %H:%M:%S")
|
strCondition = "S_COUNT_NO = '"..count_obj.count_no.."'"
|
local strSetAttr
|
if ( nRet == 0 ) then
|
strSetAttr = "N_DR_STATE = 1, S_DR_ERR = '', T_CR = '"..curTime.."'"
|
else
|
lua.Debug( strLuaDEID, debug.getinfo(1), "JW-WMS SetPLCJobStatus 接口错误", strRetInfo )
|
strSetAttr = "N_DR_STATE = 2, S_DR_ERR = 'JW-WMS SetPLCJobStatus 接口错误, 详细信息看日志!', T_CR = '"..curTime.."'"
|
end
|
nRet, strRetInfo = mobox.updateDataAttrByCondition( strLuaDEID, "Count_Order", strCondition, strSetAttr )
|
if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "更新盘点单差异回报失败!"..strRetInfo ) end
|
|
|
end
|
|
if (refresh == false) then return end
|
|
local action = {
|
{
|
action_type = "refresh",
|
value = ""
|
}
|
}
|
nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
|
if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "setAction错误: " .. strRetInfo) end
|
end
|