|  | @@ -408,6 +408,82 @@ bool FromWebAPI::getExecPlanData(int chnID, QList<OnePlanItemInfo>& list)
 | 
	
		
			
				|  |  |      return true;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +bool FromWebAPI::getExecPlanData(QMap<int, QList<OnePlanItemInfo>>& mapPlan)
 | 
	
		
			
				|  |  | +{
 | 
	
		
			
				|  |  | +    if(m_httpApi == nullptr)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        LH_WRITE_ERROR("WebAPI is nullptr");
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    nJson json0;
 | 
	
		
			
				|  |  | +    json0["opName"] = "ESM8C_GetExecPlan";
 | 
	
		
			
				|  |  | +    nJson json1;
 | 
	
		
			
				|  |  | +    json0["paramList"] = json1;
 | 
	
		
			
				|  |  | +    QString strCmd = QString::fromStdString(json0.dump());
 | 
	
		
			
				|  |  | +    QString strRet;
 | 
	
		
			
				|  |  | +    auto ret = m_httpApi->DBDoInterface(enDBOperatorType::EDBOT_Select, strCmd, strRet, true);
 | 
	
		
			
				|  |  | +    if(ret != 0)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        LH_WRITE_ERROR(QString("从EQM获取tExecPlan表格数据失败:%1, 错误信息:%2").arg(ret).arg(m_httpApi->DoGetLastError(&ret)));
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    /* 解析获取到的JSON数据 */
 | 
	
		
			
				|  |  | +    // SPDLOG_LOGGER_DEBUG(m_logger,"获取执行计划:\n{}",strRet.toStdString());
 | 
	
		
			
				|  |  | +    try 
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        nJson json2 = nJson::parse(strRet.toStdString());
 | 
	
		
			
				|  |  | +        int retCode = json2["code"].get<int>();
 | 
	
		
			
				|  |  | +        if(retCode != 0)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            LH_WRITE_ERROR("获取tExecPlan表格数据失败");
 | 
	
		
			
				|  |  | +            return false;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        nJson result = json2["result"];
 | 
	
		
			
				|  |  | +        for(auto& it : result)
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            OnePlanItemInfo info;
 | 
	
		
			
				|  |  | +            info.ChannelID = it["channelID"].is_null() ? -1 : it["channelID"].get<int>();
 | 
	
		
			
				|  |  | +            info.ChannelName = QString::fromStdString(it["channelName"].get<std::string>());
 | 
	
		
			
				|  |  | +            info.onWeekDay = static_cast<enum_WeekDay>(it["onWeekDay"].get<int>());
 | 
	
		
			
				|  |  | +            info.onDateTime.setDate(QDate::fromString(QString::fromStdString(it["onDate"].get<std::string>()), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | +            info.onDateTime.setTime(QTime::fromString(QString::fromStdString(it["onTime"].get<std::string>()), "hh:mm:ss"));
 | 
	
		
			
				|  |  | +            info.offWeekDay = static_cast<enum_WeekDay>(it["offWeekDay"].get<int>());
 | 
	
		
			
				|  |  | +            info.offDateTime.setDate(QDate::fromString(QString::fromStdString(it["offDate"].get<std::string>()), "yyyy-MM-dd"));
 | 
	
		
			
				|  |  | +            info.offDateTime.setTime(QTime::fromString(QString::fromStdString(it["offTime"].get<std::string>()), "hh:mm:ss"));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            /* 查找对应的设备列表 */
 | 
	
		
			
				|  |  | +            auto list = mapPlan.find(info.ChannelID);
 | 
	
		
			
				|  |  | +            if(list == mapPlan.end())
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                /* 创建一个新的列表 */
 | 
	
		
			
				|  |  | +                QList<OnePlanItemInfo> listPlan;
 | 
	
		
			
				|  |  | +                listPlan.append(info);
 | 
	
		
			
				|  |  | +                mapPlan.insert(info.ChannelID, listPlan);
 | 
	
		
			
				|  |  | +            }else {
 | 
	
		
			
				|  |  | +                /* 找到对应的列表 */
 | 
	
		
			
				|  |  | +                list->append(info);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    } catch (const nJson::parse_error& e) {
 | 
	
		
			
				|  |  | +        LH_WRITE_ERROR(QString("解析 tExecPlan 表格数据失败:%1").arg(e.what()));
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    catch (const nJson::exception& e)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        LH_WRITE_ERROR(QString("解析 tExecPlan 表格数据失败:%1").arg(e.what()));
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    catch(...)
 | 
	
		
			
				|  |  | +    {
 | 
	
		
			
				|  |  | +        LH_WRITE_ERROR("解析 tExecPlan 表格数据失败");
 | 
	
		
			
				|  |  | +        return false;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    return true;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  /* 删除所有行 */
 | 
	
		
			
				|  |  |  bool FromWebAPI::deleteAllRow()
 |