修改尾数控制和状态监控逻辑
This commit is contained in:
@ -14,7 +14,7 @@ BASE_URL = "https://www.shnthy.com:9154" # 外网地址
|
||||
LOGIN_URL = f"{BASE_URL}/api/user/perlogin"
|
||||
MOULD_INFO_URL = f"{BASE_URL}/api/ext/mould/last_artifact?mouldCode=SHR2B1-9"
|
||||
TASK_INFO_URL = f"{BASE_URL}/api/ext/artifact/task"
|
||||
NOT_POUR_INFO_URL = f"{BASE_URL}/api/ext/artifact/not_pour" # 新增接口
|
||||
NOT_POUR_INFO_URL = f"{BASE_URL}/api/ext/artifact/not_pour"
|
||||
|
||||
# 登录参数
|
||||
LOGIN_DATA = {
|
||||
@ -93,6 +93,7 @@ def get_task_info(app_id, task_id):
|
||||
|
||||
|
||||
# 获取所有未浇筑信息
|
||||
# 修改 get_all_not_pour_info 函数
|
||||
def get_all_not_pour_info(app_id):
|
||||
headers = {"AppID": app_id}
|
||||
response = requests.get(NOT_POUR_INFO_URL, headers=headers)
|
||||
@ -106,47 +107,44 @@ def get_all_not_pour_info(app_id):
|
||||
if not artifact_list:
|
||||
return tasks
|
||||
|
||||
# 检查最后一条数据的BlockNumber是否为"F"
|
||||
last_has_F = False
|
||||
if len(artifact_list) > 0:
|
||||
last_block_number = artifact_list[-1].get("BlockNumber", "")
|
||||
if last_block_number == "F":
|
||||
last_has_F = True
|
||||
# 获取最新的管片信息(最上面一条)
|
||||
latest_artifact = artifact_list[0] # 只处理最上面一条
|
||||
|
||||
# 处理每条数据
|
||||
for i, artifact in enumerate(artifact_list):
|
||||
beton_task_id = artifact["BetonTaskID"]
|
||||
beton_volume = artifact["BetonVolume"]
|
||||
artifact_id = artifact["ArtifactActionID"]
|
||||
block_number = artifact.get("BlockNumber", "")
|
||||
# 检查是否进入尾数控制阶段(有F块)
|
||||
has_f_block = any(artifact.get("BlockNumber") == "F" for artifact in artifact_list)
|
||||
|
||||
# 根据BlockNumber调整方量
|
||||
# 处理最新管片
|
||||
beton_task_id = latest_artifact["BetonTaskID"]
|
||||
beton_volume = latest_artifact["BetonVolume"]
|
||||
artifact_id = latest_artifact["ArtifactActionID"]
|
||||
block_number = latest_artifact.get("BlockNumber", "")
|
||||
|
||||
# 根据是否进入尾数控制阶段调整方量
|
||||
adjusted_volume = beton_volume
|
||||
|
||||
# 如果最后一条是"F",则调整前面两片的方量
|
||||
if last_has_F and i < len(artifact_list) - 1: # 不处理最后一条"F"
|
||||
if i == 0: # 第一片
|
||||
adjusted_volume = beton_volume + 0.25
|
||||
print(f" BlockNumber: {block_number}, 第一片方量调整后 (+0.25): {adjusted_volume}")
|
||||
elif i == 1: # 第二片
|
||||
adjusted_volume = beton_volume + 0.3
|
||||
print(f" BlockNumber: {block_number}, 第二片方量调整后 (+0.3): {adjusted_volume}")
|
||||
# 如果是L1或L2且处于尾数控制阶段,需要补方
|
||||
if has_f_block and block_number in ["L1", "L2", "B1", "B2", "B3"]:
|
||||
if block_number in ["L1", "B1"]:
|
||||
adjusted_volume += 0.25
|
||||
elif block_number in ["L2", "B2"]:
|
||||
adjusted_volume += 0.3
|
||||
print(f" BlockNumber: {block_number}, 尾数控制阶段方量调整后: {adjusted_volume}")
|
||||
else:
|
||||
# 原有的方量调整逻辑
|
||||
# 正常情况下的方量调整
|
||||
if block_number == "L2":
|
||||
adjusted_volume = beton_volume + 0.25
|
||||
adjusted_volume += 0.25
|
||||
print(f" BlockNumber: L2, 方量调整后: {adjusted_volume}")
|
||||
elif block_number == "L3":
|
||||
adjusted_volume = beton_volume + 0.3
|
||||
adjusted_volume += 0.3
|
||||
print(f" BlockNumber: L3, 方量调整后: {adjusted_volume}")
|
||||
else:
|
||||
print(f" BlockNumber: {block_number}, 方量未调整")
|
||||
|
||||
# 只添加最上面一条任务
|
||||
tasks.append({
|
||||
"beton_task_id": beton_task_id,
|
||||
"beton_volume": adjusted_volume,
|
||||
"artifact_id": artifact_id,
|
||||
"block_number": block_number
|
||||
"block_number": block_number,
|
||||
"is_latest": True # 标记为最新任务
|
||||
})
|
||||
|
||||
return tasks
|
||||
@ -333,7 +331,6 @@ def monitor_access_flag_changes(access_db_path, access_password):
|
||||
beton_volume = task_data["beton_volume"]
|
||||
artifact_id = task_data["artifact_id"]
|
||||
|
||||
# 调用同事提供的保存函数,将数据保存到自定义数据表
|
||||
save_to_custom_table(
|
||||
misid=erp_id,
|
||||
flag="1", # 初始Flag值
|
||||
@ -384,7 +381,7 @@ def main():
|
||||
|
||||
# Access数据库路径和密码
|
||||
access_db_path = "D:\\Janeoo-B12-DB\\Janeoo.2.mdb" # 替换为实际路径
|
||||
access_password = "BCS7.2_SDBS" # Access数据库密码
|
||||
access_password = "1" # Access数据库密码
|
||||
|
||||
# 启动监控线程
|
||||
access_monitor_thread = threading.Thread(target=monitor_access_flag_changes,
|
||||
|
||||
@ -14,7 +14,7 @@ BASE_URL = "https://www.shnthy.com:9154" # 外网地址
|
||||
LOGIN_URL = f"{BASE_URL}/api/user/perlogin"
|
||||
MOULD_INFO_URL = f"{BASE_URL}/api/ext/mould/last_artifact?mouldCode=SHR2B1-9"
|
||||
TASK_INFO_URL = f"{BASE_URL}/api/ext/artifact/task"
|
||||
NOT_POUR_INFO_URL = f"{BASE_URL}/api/ext/artifact/not_pour" # 新增接口
|
||||
NOT_POUR_INFO_URL = f"{BASE_URL}/api/ext/artifact/not_pour"
|
||||
|
||||
# 登录参数
|
||||
LOGIN_DATA = {
|
||||
|
||||
Submodule zjsh_ui_sysytem updated: cfcf47c82a...30d00b8aef
Reference in New Issue
Block a user