rambo 4 miesięcy temu
rodzic
commit
e6e4d83122
1 zmienionych plików z 9 dodań i 2 usunięć
  1. 9 2
      python/mcu/DeviceControl.py

+ 9 - 2
python/mcu/DeviceControl.py

@@ -28,7 +28,6 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
         self.mcu_deviation_set = McuDeviationSet(self)
         self.mcu_other_set = OtherSet(self)
         self.debug_uart = DebugUart(self)
-        self.debug_uart = DebugUart(self)
         self.line_control = LineControl(websocket_manager)
         self.m_t = 1
         # 0未开始  1进行中 2已结束  99异常
@@ -1504,7 +1503,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
             for index, action in enumerate(config_list):
                 await asyncio.sleep(0.1)
                 if self.is_stop_action == True:
-                    self.is_stop_action = False
+                    print("停止命令接收,立即终止")
                     break
                 # action_is_take_picture = action["take_picture"]
                 record_id = action["record_id"]
@@ -1558,6 +1557,14 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
                     #  最后一个初始化处理
                     pass
                 # self.action_state = 2
+            if self.is_stop_action==True:
+                self.msg_type = "run_mcu_stop"
+                self.sendSocketMessage(
+                    code=0,
+                    msg=f"货号:{goods_art_no},执行终止",
+                    device_status=2,
+                )
+                self.is_stop_action = False
             self.action_state = 2
             self.is_runn_action = False
             self.msg_type = "photo_take_finish"