设备占用提示
parent
72b3f05f58
commit
9012b447a0
|
|
@ -11,6 +11,24 @@ namespace zsy
|
|||
{
|
||||
const std::string &sn = data->sn;
|
||||
const std::string &license = data->license;
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(tasks_mutex);
|
||||
if (tasks.contains(sn))
|
||||
{
|
||||
if (auto oldLicense = tasks.at(sn); oldLicense == license)
|
||||
{
|
||||
LOGGER_INFO("重复识别:{}、{}", sn, oldLicense);
|
||||
} else
|
||||
{
|
||||
Application::deviceHolder->getSoundColumn(sn)->play("请等待前车业务完成后重新识别");
|
||||
LOGGER_INFO("当前道闸正在处理:{}、{}", sn, oldLicense);
|
||||
}
|
||||
return;
|
||||
} else
|
||||
{
|
||||
tasks[sn] = license;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
std::jthread t;
|
||||
|
|
@ -31,11 +49,23 @@ namespace zsy
|
|||
return;
|
||||
}
|
||||
addition_process(reportPassResult.data.orderNo, data);
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(tasks_mutex);
|
||||
tasks.erase(sn);
|
||||
}
|
||||
} catch (std::exception &e)
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(tasks_mutex);
|
||||
tasks.erase(sn);
|
||||
}
|
||||
LOGGER_ERROR("车牌识别结果处理失败: {}", e.what());
|
||||
} catch (...)
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(tasks_mutex);
|
||||
tasks.erase(sn);
|
||||
}
|
||||
LOGGER_ERROR("未知异常,车牌识别结果处理失败");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef RECOGNIZE_PROCESSOR_H
|
||||
#define RECOGNIZE_PROCESSOR_H
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "barrier/barrier.h"
|
||||
|
||||
|
|
@ -11,9 +13,12 @@ namespace zsy
|
|||
class RecognizeProcessor
|
||||
{
|
||||
public:
|
||||
static void process(std::shared_ptr<RecognizeData> data);
|
||||
inline static std::unordered_map<std::string, std::string> tasks;
|
||||
inline static std::mutex tasks_mutex;
|
||||
|
||||
static void addition_process(const std::string &orderNo,std::shared_ptr<RecognizeData> data);
|
||||
static void process(std::shared_ptr<RecognizeData> data);
|
||||
|
||||
static void addition_process(const std::string &orderNo, std::shared_ptr<RecognizeData> data);
|
||||
};
|
||||
} // zsy
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue