|
|
|
|
@ -24,13 +24,15 @@ def down_obj_fromoss(pid,order_id):
@@ -24,13 +24,15 @@ def down_obj_fromoss(pid,order_id):
|
|
|
|
|
# print_type:// 打印状态 1:正常打印 2:重打 3:加打,4: 样品 |
|
|
|
|
print('开始下载obj文件...' , pid) |
|
|
|
|
#请求接口 获取 对应的 oss 地址 |
|
|
|
|
tempUrl = f'https://mp.gray.api.suwa3d.com/api/order/getOssSuffixByOrderId?order_id={order_id}' |
|
|
|
|
tempUrl = f'https://mp.api.suwa3d.com/api/order/getOssSuffixByOrderId?order_id={order_id}' |
|
|
|
|
print(tempUrl) |
|
|
|
|
#发起请求 |
|
|
|
|
res = requests.get(tempUrl) |
|
|
|
|
ossPath = "" |
|
|
|
|
if res.json()['code'] == 1000: |
|
|
|
|
ossPath = res.json()['data'] |
|
|
|
|
ossPath = ossPath.replace("\\","/") |
|
|
|
|
print("AAAAAAAAA",ossPath) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
path = os.path.join(workdir, 'print', pid) |
|
|
|
|
@ -43,7 +45,6 @@ def down_obj_fromoss(pid,order_id):
@@ -43,7 +45,6 @@ def down_obj_fromoss(pid,order_id):
|
|
|
|
|
prefix = prefix.replace("\\","/") |
|
|
|
|
|
|
|
|
|
print(f'prefix:{prefix}') |
|
|
|
|
print(f'实际有用的地址:objs/print/253312/model/standard_size/88942') |
|
|
|
|
filelist = oss2.ObjectIteratorV2(oss_client, prefix=prefix) |
|
|
|
|
|
|
|
|
|
if len(list(filelist)) == 0: |
|
|
|
|
@ -81,7 +82,7 @@ def down_obj_fromoss(pid,order_id):
@@ -81,7 +82,7 @@ def down_obj_fromoss(pid,order_id):
|
|
|
|
|
# time.sleep(10) |
|
|
|
|
|
|
|
|
|
def getPidFromOrderId(orderId): |
|
|
|
|
getPidFromOrderId_url = 'https://mp.gray.api.suwa3d.com/api/printOrder/info' |
|
|
|
|
getPidFromOrderId_url = 'https://mp.api.suwa3d.com/api/printOrder/info' |
|
|
|
|
print(f'{getPidFromOrderId_url}?id={orderId}') |
|
|
|
|
res = requests.get(f'{getPidFromOrderId_url}?id={orderId}') |
|
|
|
|
resCode = res.json()['code'] |
|
|
|
|
@ -118,9 +119,9 @@ def team_check(r):
@@ -118,9 +119,9 @@ def team_check(r):
|
|
|
|
|
|
|
|
|
|
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} repair_id:{repair_id} 生成团队审核模型 start model:IndependentRepairTeamcheckGLBQueue', ) |
|
|
|
|
ossPath = down_obj_fromoss(pid,orderId) |
|
|
|
|
if ossPath == "": |
|
|
|
|
print("ossPath is null") |
|
|
|
|
return |
|
|
|
|
# if ossPath == "": |
|
|
|
|
# print("ossPath is null") |
|
|
|
|
# return |
|
|
|
|
obj_filename = f'{pid}.obj' |
|
|
|
|
glb_filename = f'{orderId}.glb' |
|
|
|
|
print('开始转换obj文件为glb文件...') |
|
|
|
|
@ -140,10 +141,14 @@ def team_check(r):
@@ -140,10 +141,14 @@ def team_check(r):
|
|
|
|
|
config.oss_bucket_3d_view.put_object_from_file(f'{uuid}/3d_view.png', f'D://print/{pid}/{pid}_pic.png') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ossPath == "model/smsize": |
|
|
|
|
ossPath = "smsize" |
|
|
|
|
|
|
|
|
|
if ossPath == "model/standard_size": |
|
|
|
|
ossPath = "normal" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print('上传glb文件到oss...') |
|
|
|
|
print('上传glb文件到oss...',f'glbs/print/{ossPath}/{glb_filename}',os.path.join(workdir, "print", pid, glb_filename)) |
|
|
|
|
oss_client.put_object_from_file(f'glbs/print/{ossPath}/{glb_filename}', os.path.join(workdir, "print", pid, glb_filename)) |
|
|
|
|
|
|
|
|
|
print(f'{update_repair_status_url}?id={repair_id}') |
|
|
|
|
@ -153,7 +158,7 @@ def team_check(r):
@@ -153,7 +158,7 @@ def team_check(r):
|
|
|
|
|
print(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()), f'pid:{pid} 生成团队审核模型 end') |
|
|
|
|
|
|
|
|
|
def get_p3d_info(pid): |
|
|
|
|
url = "https://mp.gray.api.suwa3d.com/api/customerP3dLog/info?id="+pid |
|
|
|
|
url = "https://mp.api.suwa3d.com/api/customerP3dLog/info?id="+pid |
|
|
|
|
res = requests.get(url) |
|
|
|
|
res = res.json() |
|
|
|
|
if res["code"] == 1000: |
|
|
|
|
@ -165,7 +170,7 @@ def create_redis_connection():
@@ -165,7 +170,7 @@ def create_redis_connection():
|
|
|
|
|
"""创建 Redis 连接,若连接失败则重试""" |
|
|
|
|
while True: |
|
|
|
|
try: |
|
|
|
|
r = redis.Redis(host='mark.api.suwa3d.com', password='kcV2000', port=6379, db=6) |
|
|
|
|
r = redis.Redis(host='106.14.158.208', password='kcV2000', port=6379, db=6) |
|
|
|
|
# 尝试进行一次操作,检查连接是否有效 |
|
|
|
|
r.ping() # ping 操作是一个简单的连接测试 |
|
|
|
|
print("Redis连接成功!") |
|
|
|
|
@ -193,12 +198,12 @@ if __name__ == '__main__':
@@ -193,12 +198,12 @@ if __name__ == '__main__':
|
|
|
|
|
Endpoint = 'oss-cn-shanghai.aliyuncs.com' |
|
|
|
|
Bucket = 'suwa3d-securedata' |
|
|
|
|
oss_client = oss2.Bucket(oss2.Auth(AccessKeyId, AccessKeySecret), Endpoint, Bucket) |
|
|
|
|
update_check_url = 'https://mp.gray.api.suwa3d.com/api/customerP3dLog/updateStatusToWaitingPlatformCheckingStatus' |
|
|
|
|
update_team_check_url = 'https://mp.gray.api.suwa3d.com/api/customerP3dLog/updateStatusToWaitingTeamCheckingStatus' |
|
|
|
|
update_status_printstatus_url = 'https://mp.gray.api.suwa3d.com/api/customerP3dLog/updateBuildPrintModelStatus' |
|
|
|
|
update_makeprintobj_status_url = 'https://mp.gray.api.suwa3d.com/api/printOrder/updateMakePrintObjSucceed' |
|
|
|
|
getRepairInfo_url = 'https://repair.gray.api.suwa3d.com/api/modelRepairOrder/teamCheckGLBInfo' |
|
|
|
|
update_repair_status_url = 'https://repair.gray.api.suwa3d.com/api/modelRepairOrder/updateStatusToWaitingTeamCheckingStatus' |
|
|
|
|
update_check_url = 'https://mp.api.suwa3d.com/api/customerP3dLog/updateStatusToWaitingPlatformCheckingStatus' |
|
|
|
|
update_team_check_url = 'https://mp.api.suwa3d.com/api/customerP3dLog/updateStatusToWaitingTeamCheckingStatus' |
|
|
|
|
update_status_printstatus_url = 'https://mp.api.suwa3d.com/api/customerP3dLog/updateBuildPrintModelStatus' |
|
|
|
|
update_makeprintobj_status_url = 'https://mp.api.suwa3d.com/api/printOrder/updateMakePrintObjSucceed' |
|
|
|
|
getRepairInfo_url = 'https://repair.api.suwa3d.com/api/modelRepairOrder/teamCheckGLBInfo' |
|
|
|
|
update_repair_status_url = 'https://repair.api.suwa3d.com/api/modelRepairOrder/updateStatusToWaitingTeamCheckingStatus' |
|
|
|
|
if platform.system() == 'Windows': |
|
|
|
|
workdir = 'D:\\' |
|
|
|
|
else: |
|
|
|
|
|