diff --git a/blender/fill_dm_code.py b/blender/fill_dm_code.py index 37c12bb..5c6463d 100644 --- a/blender/fill_dm_code.py +++ b/blender/fill_dm_code.py @@ -428,7 +428,7 @@ def getInfoByPrintId(print_id): return res.text #获取订单的坐标信息,判断是否有,没有的话就重新生成坐标信息 -def getQrPosition(print_id): +def getQrPosition(print_id,pid,order_id): #从云端获取qr_position,如果获取为空,调用cal_foot_position.py计算并上传qr_position,再重新读取qr_position.txt res = requests.get(f'{get_qr_position_url}?print_id={print_id}') print('从云端获取的qr_position1:', res.text) @@ -486,7 +486,7 @@ def main(workdir, r, print_id): print('导入obj文件:', filename) #获取该笔订单的坐标 - qr_position = getQrPosition(print_id) + qr_position = getQrPosition(print_id,pid,order_id) if qr_position == False: return @@ -703,6 +703,20 @@ def process_print_ids(workdir, r, pool_size): r = create_redis_connection() continue +def create_redis_connection(): + """创建 Redis 连接,若连接失败则重试""" + while True: + try: + r = redis.Redis(host="106.14.158.208", password="kcV2000", port=6379, db=6) + # 尝试进行一次操作,检查连接是否有效 + r.ping() # ping 操作是一个简单的连接测试 + print("Redis连接成功!") + return r + except ConnectionError: + print("Redis连接失败,正在重试...") + time.sleep(5) + + if __name__ == '__main__': atexit.register(common.notify,"打印工厂-本地虚拟木脚底板处理程序已停止一个") low_y_limit = 25000