修改为派单只保留1位小数

This commit is contained in:
xiongyi
2026-01-29 17:29:57 +08:00
parent a1a53ac2fa
commit 4897c4fa0b
2 changed files with 13 additions and 13 deletions

View File

@ -185,7 +185,7 @@ def get_task_info():
}), 500 }), 500
@app.route('/api/ext/artifact/not_pour', methods=['GET']) @app.route('/api/ext/mould/not_pour_rfid', methods=['GET'])
def get_not_pour_info(): def get_not_pour_info():
""" """
模拟获取已入模绑定未浇筑的管片信息接口 模拟获取已入模绑定未浇筑的管片信息接口
@ -218,11 +218,11 @@ def get_not_pour_info():
"RingTypeCode": "R22", "RingTypeCode": "R22",
"SizeSpecification": "6900*1500", "SizeSpecification": "6900*1500",
"BuriedDepth": "中埋", "BuriedDepth": "中埋",
"BlockNumber": "F", "BlockNumber": "B3",
"HoleRingMarking": "", "HoleRingMarking": "",
"GroutingPipeMarking": "", "GroutingPipeMarking": "",
"PolypropyleneFiberMarking": "", "PolypropyleneFiberMarking": "",
"BetonVolume": 0.6, "BetonVolume": 1.91,
"BetonTaskID": "20251020-01" "BetonTaskID": "20251020-01"
}, },
{ {
@ -256,7 +256,7 @@ def get_not_pour_info():
"HoleRingMarking": "", "HoleRingMarking": "",
"GroutingPipeMarking": "", "GroutingPipeMarking": "",
"PolypropyleneFiberMarking": "", "PolypropyleneFiberMarking": "",
"BetonVolume": 1.9, "BetonVolume": 1.91,
"BetonTaskID": "20251020-01" "BetonTaskID": "20251020-01"
}, },

View File

@ -52,7 +52,7 @@ class TaskService:
# 更新上一个任务信息 # 更新上一个任务信息
self.task_before = { self.task_before = {
"beton_task_id": current_task["beton_task_id"], "beton_task_id": current_task["beton_task_id"],
"beton_volume": current_task["beton_volume"], "beton_volume": round(current_task["beton_volume"],1),
"artifact_id": current_task["artifact_id"], "artifact_id": current_task["artifact_id"],
"block_number": current_task["block_number"] "block_number": current_task["block_number"]
} }
@ -191,13 +191,13 @@ class TaskService:
f_volume = f_blocks[0].get("BetonVolume") if f_blocks else 0 f_volume = f_blocks[0].get("BetonVolume") if f_blocks else 0
self.half_volume[0] = 0.1#round(total_f_volume / 2, 2)#暂时修改为0.1 self.half_volume[0] = 0.1#round(total_f_volume / 2, 2)#暂时修改为0.1
self.half_volume[1] = 0.1#f_volume - self.half_volume[0]#暂时修改 self.half_volume[1] = 0.1#f_volume - self.half_volume[0]#暂时修改
adjusted_volume = current_task["beton_volume"] + self.half_volume[0] adjusted_volume = round(current_task["beton_volume"],1) + self.half_volume[0]
elif f_positions == [1]: elif f_positions == [1]:
adjusted_volume = current_task["beton_volume"] + self.half_volume[1] adjusted_volume = round(current_task["beton_volume"],1) + self.half_volume[1]
elif f_positions == [0]: elif f_positions == [0]:
adjusted_volume = 0 adjusted_volume = 0
else: else:
adjusted_volume = current_task["beton_volume"] adjusted_volume = round(current_task["beton_volume"],1)
block_number = "补方" if f_positions == [0] else current_task["block_number"] block_number = "补方" if f_positions == [0] else current_task["block_number"]
@ -230,14 +230,14 @@ class TaskService:
"""处理无F块的情况""" """处理无F块的情况"""
tasks = [{ tasks = [{
"beton_task_id": current_task["beton_task_id"], "beton_task_id": current_task["beton_task_id"],
"beton_volume": current_task["beton_volume"], "beton_volume": round(current_task["beton_volume"],1),
"artifact_id": current_task["artifact_id"], "artifact_id": current_task["artifact_id"],
"block_number": current_task["block_number"], "block_number": current_task["block_number"],
}] }]
send_list = [{ send_list = [{
"beton_task_id": current_task["beton_task_id"], "beton_task_id": current_task["beton_task_id"],
"beton_volume": current_task["beton_volume"], "beton_volume": round(current_task["beton_volume"],1),
"artifact_id": current_task["artifact_id"], "artifact_id": current_task["artifact_id"],
"block_number": current_task["block_number"], "block_number": current_task["block_number"],
"beton_grade": current_task["task_data"]["BetonGrade"], "beton_grade": current_task["task_data"]["BetonGrade"],
@ -366,7 +366,7 @@ class TaskService:
produce_mix_id=task_info["ProduceMixID"], produce_mix_id=task_info["ProduceMixID"],
project_name=task_info["ProjectName"], project_name=task_info["ProjectName"],
beton_grade=task_info["BetonGrade"], beton_grade=task_info["BetonGrade"],
adjusted_volume=round(beton_volume,2), adjusted_volume=round(beton_volume,1),
artifact_id=artifact_id, artifact_id=artifact_id,
half_volume=half_volume, half_volume=half_volume,
# 已经调整后的方量 # 已经调整后的方量
@ -385,7 +385,7 @@ class TaskService:
"produce_mix_id": task_info["ProduceMixID"], # 配比号 "produce_mix_id": task_info["ProduceMixID"], # 配比号
"project_name": task_info["ProjectName"], # 任务名 "project_name": task_info["ProjectName"], # 任务名
"beton_grade": task_info["BetonGrade"], # 砼强度 "beton_grade": task_info["BetonGrade"], # 砼强度
"adjusted_volume": round(beton_volume,2), # 方量 "adjusted_volume": round(beton_volume,1), # 方量
"flag": "已插入", # 状态 "flag": "已插入", # 状态
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 时间 "timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S") # 时间
} }
@ -405,7 +405,7 @@ class TaskService:
produce_mix_id=task_info["ProduceMixID"], produce_mix_id=task_info["ProduceMixID"],
project_name=task_info["ProjectName"], project_name=task_info["ProjectName"],
beton_grade=task_info["BetonGrade"], beton_grade=task_info["BetonGrade"],
adjusted_volume=round(beton_volume,2), adjusted_volume=round(beton_volume,1),
artifact_id=artifact_id, artifact_id=artifact_id,
half_volume=half_volume, half_volume=half_volume,
) )