FIX: is_ams_need_update for vt slots

Change-Id: Iddf3aa9da6c0c4b434d91439828ec0223ecea9d5
Jira: STUDIO-7822
This commit is contained in:
chunmao.guo 2024-08-08 12:11:02 +08:00 committed by lane.wei
parent 53d066a2b6
commit 7df6f6c986
2 changed files with 12 additions and 0 deletions

View File

@ -4289,18 +4289,22 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (vslot.id == std::to_string(VIRTUAL_TRAY_MAIN_ID)) {
auto it = std::next(vt_slot.begin(), 0);
if (it != vt_slot.end()) {
is_ams_need_update |= vt_slot[0] != vslot;
vt_slot[0] = vslot;
}
else {
is_ams_need_update = true;
vt_slot.push_back(vslot);
}
}
else if (vslot.id == std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) {
auto it = std::next(vt_slot.begin(), 1);
if (it != vt_slot.end()) {
is_ams_need_update |= vt_slot[1] != vslot;
vt_slot[1] = vslot;
}
else {
is_ams_need_update = true;
vt_slot.push_back(vslot);
}
}
@ -4314,9 +4318,11 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
auto it = std::next(vt_slot.begin(), 0);
if (it != vt_slot.end()) {
is_ams_need_update |= vt_slot[0] != main_slot;
vt_slot[0] = main_slot;
}
else {
is_ams_need_update = true;
vt_slot.push_back(main_slot);
}
}

View File

@ -211,6 +211,12 @@ public:
return wxColour(ret[0], ret[1], ret[2], ret[3]);
}
bool operator==(AmsTray const &o) const
{
return id == o.id && type == o.type && filament_setting_id == o.filament_setting_id && color == o.color;
}
bool operator!=(AmsTray const &o) const { return !operator==(o); }
std::string id;
std::string tag_uid; // tag_uid
std::string setting_id; // tray_info_idx