ENH:add confirmation pop-up window

jira:[STUDIO-12237]

Change-Id: I255e074f5f4eba4a6d7fdbf8f3a6c1c3751a951c
This commit is contained in:
tao wang 2025-05-19 17:21:20 +08:00 committed by lane.wei
parent c2d00f147a
commit 6c3e57dd3d
2 changed files with 14 additions and 38 deletions

View File

@ -2090,7 +2090,7 @@ int MachineObject::command_task_pause()
int MachineObject::command_task_resume() int MachineObject::command_task_resume()
{ {
if (jobState_ > 1) return 0; if(check_resume_condition()) return 0;
json j; json j;
j["print"]["command"] = "resume"; j["print"]["command"] = "resume";
@ -2102,7 +2102,7 @@ int MachineObject::command_task_resume()
int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type) int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type)
{ {
if (jobState_ > 1) return 0; if(check_resume_condition()) return 0;
json j; json j;
j["print"]["command"] = "idle_ignore"; j["print"]["command"] = "idle_ignore";
@ -2114,7 +2114,7 @@ int MachineObject::command_hms_idle_ignore(const std::string &error_str, int typ
int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id) int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id)
{ {
if (jobState_ > 1) return 0; if(check_resume_condition()) return 0;
json j; json j;
j["print"]["command"] = "resume"; j["print"]["command"] = "resume";
@ -2128,7 +2128,7 @@ int MachineObject::command_hms_resume(const std::string& error_str, const std::s
int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id) int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id)
{ {
if (jobState_ > 1) return 0; if(check_resume_condition()) return 0;
json j; json j;
j["print"]["command"] = "ignore"; j["print"]["command"] = "ignore";
@ -2215,39 +2215,14 @@ int MachineObject::command_set_chamber(int temp)
return this->publish_json(j.dump(), 1); return this->publish_json(j.dump(), 1);
} }
//int MachineObject::command_ams_switch(int tray_index, int old_temp, int new_temp) int MachineObject::check_resume_condition()
//{ {
// assert(!is_enable_np); if (jobState_ > 1) {
// GUI::wxGetApp().show_dialog(_L("To ensure your safety, certain processing tasks (such as laser) can only be resumed on printer."));
// BOOST_LOG_TRIVIAL(trace) << "ams_switch to " << tray_index << " with temp: " << old_temp << ", " << new_temp; return 1;
// }
// if (old_temp < 0) old_temp = FILAMENT_DEF_TEMP; return 0;
// if (new_temp < 0) new_temp = FILAMENT_DEF_TEMP; }
// int result = 0;
//
//
// //command
// if (is_support_command_ams_switch) {
// command_ams_change_filament(tray_index, old_temp, new_temp);
// }
// //gcode
// else {
// std::string gcode = "";
// if (tray_index == 255) {
// gcode = DeviceManager::load_gcode(printer_type, "ams_unload.gcode");
// }
// else {
// // include VIRTUAL_TRAY_MAIN_ID
// gcode = DeviceManager::load_gcode(printer_type, "ams_load.gcode");
// boost::replace_all(gcode, "[next_extruder]", std::to_string(tray_index));
// boost::replace_all(gcode, "[new_filament_temp]", std::to_string(new_temp));
// }
//
// result = this->publish_gcode(gcode);
// }
//
// return result;
//}
int MachineObject::command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp, int new_temp) int MachineObject::command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp, int new_temp)
{ {
@ -2368,7 +2343,7 @@ int MachineObject::command_ams_select_tray(std::string tray_id)
int MachineObject::command_ams_control(std::string action) int MachineObject::command_ams_control(std::string action)
{ {
if (action == "resume" && jobState_ > 1 ) return 0; if (action == "resume" && check_resume_condition()) return 0;
//valid actions //valid actions
if (action == "resume" || action == "reset" || action == "pause" || action == "done" || action == "abort") { if (action == "resume" || action == "reset" || action == "pause" || action == "done" || action == "abort") {

View File

@ -1208,6 +1208,7 @@ public:
int command_set_nozzle(int temp); int command_set_nozzle(int temp);
int command_set_nozzle_new(int nozzle_id, int temp); int command_set_nozzle_new(int nozzle_id, int temp);
int command_set_chamber(int temp); int command_set_chamber(int temp);
int check_resume_condition();
// ams controls // ams controls
//int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210); //int command_ams_switch(int tray_index, int old_temp = 210, int new_temp = 210);
int command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp = 210, int new_temp = 210); int command_ams_change_filament(bool load, std::string ams_id, std::string slot_id, int old_temp = 210, int new_temp = 210);