|
@@ -1,4 +1,5 @@
|
|
|
import asyncio
|
|
import asyncio
|
|
|
|
|
+import datetime
|
|
|
import serial.tools.list_ports
|
|
import serial.tools.list_ports
|
|
|
import time, json
|
|
import time, json
|
|
|
from .SerialIns import SerialIns
|
|
from .SerialIns import SerialIns
|
|
@@ -1150,13 +1151,13 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
return
|
|
return
|
|
|
image_counts = 0
|
|
image_counts = 0
|
|
|
if config_list:
|
|
if config_list:
|
|
|
- for _, item in enumerate(config_list):
|
|
|
|
|
|
|
+ for idx, item in enumerate(config_list):
|
|
|
is_take_picture = item["take_picture"]
|
|
is_take_picture = item["take_picture"]
|
|
|
if is_take_picture:
|
|
if is_take_picture:
|
|
|
image_counts += 1
|
|
image_counts += 1
|
|
|
# 批量插入
|
|
# 批量插入
|
|
|
image_deal_mode = 0 if action_info == "执行左脚程序" else 1
|
|
image_deal_mode = 0 if action_info == "执行左脚程序" else 1
|
|
|
- insert_photo_records(image_deal_mode, goods_art_no)
|
|
|
|
|
|
|
+ insert_photo_records(image_deal_mode=image_deal_mode, goods_art_no=goods_art_no, image_index=idx)
|
|
|
total_len = len(config_list)
|
|
total_len = len(config_list)
|
|
|
self.action_state = 1
|
|
self.action_state = 1
|
|
|
self.msg_type = "image_process"
|
|
self.msg_type = "image_process"
|
|
@@ -1167,22 +1168,29 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
data={
|
|
data={
|
|
|
"goods_art_no": goods_art_no,
|
|
"goods_art_no": goods_art_no,
|
|
|
"image_counts": image_counts,
|
|
"image_counts": image_counts,
|
|
|
|
|
+ "current_time":datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
self.msg_type = "mcu"
|
|
self.msg_type = "mcu"
|
|
|
for index, action in enumerate(config_list):
|
|
for index, action in enumerate(config_list):
|
|
|
await asyncio.sleep(0.1)
|
|
await asyncio.sleep(0.1)
|
|
|
|
|
+ action_is_take_picture = action["take_picture"]
|
|
|
|
|
+ image_index = -1
|
|
|
|
|
+ if action_is_take_picture:
|
|
|
|
|
+ image_index = index
|
|
|
program_item = ProgramItem(
|
|
program_item = ProgramItem(
|
|
|
websocket_manager=self.websocket_manager,
|
|
websocket_manager=self.websocket_manager,
|
|
|
action_data=action,
|
|
action_data=action,
|
|
|
mcu=self,
|
|
mcu=self,
|
|
|
goods_art_no=goods_art_no,
|
|
goods_art_no=goods_art_no,
|
|
|
|
|
+ image_index=image_index,
|
|
|
)
|
|
)
|
|
|
print("self.action_state===>", self.action_state)
|
|
print("self.action_state===>", self.action_state)
|
|
|
if self.action_state != 1:
|
|
if self.action_state != 1:
|
|
|
# 异常终止
|
|
# 异常终止
|
|
|
print("action异常终止")
|
|
print("action异常终止")
|
|
|
break
|
|
break
|
|
|
|
|
+ self.msg_type = "photo_take"
|
|
|
if not program_item.run(total_len):
|
|
if not program_item.run(total_len):
|
|
|
self.sendSocketMessage(
|
|
self.sendSocketMessage(
|
|
|
code=1,
|
|
code=1,
|
|
@@ -1198,7 +1206,7 @@ class DeviceControl(BaseClass, metaclass=SingletonType):
|
|
|
msg="{} 执行完成~".format(program_item.action_name),
|
|
msg="{} 执行完成~".format(program_item.action_name),
|
|
|
device_status=2,
|
|
device_status=2,
|
|
|
)
|
|
)
|
|
|
-
|
|
|
|
|
|
|
+ self.msg_type = "mcu"
|
|
|
# 在第三张图时检查是否有对应图片生成
|
|
# 在第三张图时检查是否有对应图片生成
|
|
|
# if index == 3:
|
|
# if index == 3:
|
|
|
# # if not self.image_process_data.check_photo_is_get():
|
|
# # if not self.image_process_data.check_photo_is_get():
|