FIX: access the ext

jira: [STUDIO-10970]
Change-Id: I65889835a4ced2d0d3547cacc505d6e1d874497e
This commit is contained in:
xin.zhang 2025-03-24 10:00:00 +08:00 committed by lane.wei
parent cc5b696d8d
commit 7bc1108a2e
3 changed files with 46 additions and 8 deletions

View File

@ -5951,6 +5951,42 @@ AmsTray MachineObject::parse_vt_tray(json vtray)
return vt_tray;
}
bool MachineObject::contains_tray(const std::string &ams_id, const std::string &tray_id) const
{
if (ams_id != VIRTUAL_AMS_MAIN_ID_STR && ams_id != VIRTUAL_AMS_DEPUTY_ID_STR) {
auto ams_iter = amsList.find(ams_id);
if (ams_iter != amsList.end()) {
auto tray_iter = ams_iter->second->trayList.find(tray_id);
if (tray_iter != ams_iter->second->trayList.end()) { return true;}
}
} else {
for (const auto& tray : vt_slot) {
if (tray.id == tray_id) { return true; }
}
}
return false;
}
AmsTray MachineObject::get_tray(const std::string &ams_id, const std::string &tray_id) const
{
if (ams_id != VIRTUAL_AMS_MAIN_ID_STR && ams_id != VIRTUAL_AMS_DEPUTY_ID_STR) {
auto ams_iter = amsList.find(ams_id);
if (ams_iter != amsList.end()) {
auto tray_iter = ams_iter->second->trayList.find(tray_id);
if (tray_iter != ams_iter->second->trayList.end()) { return *tray_iter->second; }
}
}
else {
for (const auto &tray : vt_slot) {
if (tray.id == tray_id) { return tray; }
}
}
assert(0);/*use contains_tray() check first*/
return AmsTray(tray_id);
}
bool MachineObject::check_enable_np(const json& print) const
{
if (print.contains("cfg") && print.contains("fun") && print.contains("aux") && print.contains("stat"))

View File

@ -52,6 +52,10 @@
#define VIRTUAL_TRAY_MAIN_ID 255
#define VIRTUAL_TRAY_DEPUTY_ID 254
#define VIRTUAL_AMS_MAIN_ID_STR "255"
#define VIRTUAL_AMS_DEPUTY_ID_STR "254"
#define START_SEQ_ID 20000
#define END_SEQ_ID 30000
#define SUBSCRIBE_RETRY_COUNT 5
@ -1314,6 +1318,10 @@ public:
std::vector<AmsTray> vt_slot;
AmsTray parse_vt_tray(json vtray);
/*get ams slot info*/
bool contains_tray(const std::string &ams_id, const std::string &tray_id) const;
AmsTray get_tray(const std::string &ams_id, const std::string &tray_id) const;/*use contains_tray() check first*/
/*for parse new info*/
bool check_enable_np(const json& print) const;
void parse_new_info(json print);

View File

@ -3255,14 +3255,8 @@ static wxString _check_kval_not_default(const MachineObject* obj, const std::vec
wxString ams_names;
for (const auto& info : mapping_result) {
auto ams_iter = obj->amsList.find(info.ams_id);
if (ams_iter == obj->amsList.end()) { continue; }
auto tray_iter = ams_iter->second->trayList.find(std::to_string(info.tray_id));
if (tray_iter == ams_iter->second->trayList.end()) { continue; }
if (tray_iter->second->cali_idx == -1) { continue; } /*-1 means default*/
if (!obj->contains_tray(info.ams_id, std::to_string(info.tray_id))) { continue; }
if (obj->get_tray(info.ams_id, std::to_string(info.tray_id)).cali_idx == -1) { continue; } /*-1 means default*/
wxString ams_name;
if (info.tray_id == VIRTUAL_TRAY_MAIN_ID) {