|
|
@@ -1239,6 +1239,54 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
)
|
|
|
self.msg_type = "mcu"
|
|
|
|
|
|
+ async def run_mcu_config_single(self, config_info, goods_art_no):
|
|
|
+ '''独立拍照 仅作测试用'''
|
|
|
+ if self.checkDevice() == False:
|
|
|
+ return
|
|
|
+ if config_info:
|
|
|
+ self.action_state = 1
|
|
|
+ self.msg_type = "mcu"
|
|
|
+ await asyncio.sleep(0.1)
|
|
|
+ image_index = -1
|
|
|
+ program_item = ProgramItem(
|
|
|
+ websocket_manager=self.websocket_manager,
|
|
|
+ action_data=config_info,
|
|
|
+ mcu=self,
|
|
|
+ goods_art_no=goods_art_no,
|
|
|
+ image_index=image_index,
|
|
|
+ )
|
|
|
+ print("self.action_state===>", self.action_state)
|
|
|
+ if self.action_state != 1:
|
|
|
+ # 异常终止
|
|
|
+ print("action异常终止")
|
|
|
+ return
|
|
|
+ self.msg_type = "photo_take"
|
|
|
+ if not program_item.run(1):
|
|
|
+ self.sendSocketMessage(
|
|
|
+ code=1,
|
|
|
+ msg="{} 执行失败~".format(program_item.action_name),
|
|
|
+ device_status=0,
|
|
|
+ )
|
|
|
+ self.to_deal_device(device_name="buzzer", times=3)
|
|
|
+ return
|
|
|
+ else:
|
|
|
+ # self.show_info("{}执行完成~".format(action.action_name))
|
|
|
+ self.sendSocketMessage(
|
|
|
+ code=0,
|
|
|
+ msg="{} 执行完成~".format(program_item.action_name),
|
|
|
+ data={"goods_art_no": goods_art_no},
|
|
|
+ device_status=2,
|
|
|
+ )
|
|
|
+ self.msg_type = "mcu"
|
|
|
+ self.action_state = 2
|
|
|
+ self.msg_type = "run_mcu_single_finish"
|
|
|
+ self.sendSocketMessage(
|
|
|
+ code=0,
|
|
|
+ msg=f"执行完成",
|
|
|
+ device_status=2,
|
|
|
+ )
|
|
|
+ self.msg_type = "mcu"
|
|
|
+
|
|
|
|
|
|
async def checkMcuConnection(device_ctrl: DeviceControl):
|
|
|
if device_ctrl.is_running == True:
|