|
|
@@ -30,7 +30,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异常
|
|
|
@@ -975,6 +974,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
print("关闭串口:{}".format(port_name))
|
|
|
serial_handle.close()
|
|
|
loop = asyncio.get_event_loop()
|
|
|
+ print("device_id============>>>", device_id)
|
|
|
if device_id > 0:
|
|
|
if device_id == 1:
|
|
|
await self.to_connect_com(port_name)
|
|
|
@@ -1510,7 +1510,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
for index, action in enumerate(config_list):
|
|
|
# await asyncio.sleep(0.01)
|
|
|
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"]
|
|
|
@@ -1554,6 +1554,27 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
)
|
|
|
self.msg_type = "mcu"
|
|
|
# 在第三张图时检查是否有对应图片生成
|
|
|
+ # if index == 3:
|
|
|
+ # # if not self.image_process_data.check_photo_is_get():
|
|
|
+ # self.sendSocketMessage(
|
|
|
+ # code=1,
|
|
|
+ # msg="未获取到图片数据",
|
|
|
+ # device_status=0,
|
|
|
+ # )
|
|
|
+ # self.action_state = 2
|
|
|
+ # return
|
|
|
+ if index == total_len - 1:
|
|
|
+ # 最后一个初始化处理
|
|
|
+ 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"
|
|
|
@@ -1610,6 +1631,26 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
code=1, msg="未查询到重拍记录得配置信息,请确认", device_status=0
|
|
|
)
|
|
|
|
|
|
+ async def only_take_photo(self, goods_art_no, image_index, record_id):
|
|
|
+ await asyncio.sleep(0.1)
|
|
|
+ print("only_take_photo=====>",goods_art_no, image_index, record_id)
|
|
|
+ if goods_art_no == "":
|
|
|
+ print("only_take_photo 数据查询异常")
|
|
|
+ return
|
|
|
+ # 关闭led
|
|
|
+ self.controlDevice("laser_position", 0)
|
|
|
+ program_item = ProgramItem(
|
|
|
+ websocket_manager=self.websocket_manager,
|
|
|
+ action_data={},
|
|
|
+ mcu=self,
|
|
|
+ goods_art_no=goods_art_no,
|
|
|
+ image_index=image_index,
|
|
|
+ record_id=record_id,
|
|
|
+ )
|
|
|
+ program_item.digicam_take_picture()
|
|
|
+ # 打开led
|
|
|
+ self.controlDevice("laser_position", 1)
|
|
|
+
|
|
|
|
|
|
async def checkMcuConnection(device_ctrl: DeviceControl):
|
|
|
if device_ctrl.is_running == True:
|