增加了项目侧关于steps的处理。允许保存和提取steps信息。
This commit is contained in:
@@ -171,7 +171,9 @@ class ProjectDetailApiHandler(BaseApiHandler):
|
||||
if origin_payload is None:
|
||||
origin_payload = {}
|
||||
|
||||
if not force_execute and not self._payload_changed(schema, new_payload, origin_payload):
|
||||
force_steps_update = self._steps_changed(node)
|
||||
steps_payload = self._get_request_steps(node)
|
||||
if not force_execute and not force_steps_update and not self._payload_changed(schema, new_payload, origin_payload):
|
||||
reason = f"No physical diff found for project_detail {key} despite strategy update request (Normalization Discrepancy)."
|
||||
print(f" [WARNING] {reason}")
|
||||
# 记录为跳过
|
||||
@@ -192,7 +194,7 @@ class ProjectDetailApiHandler(BaseApiHandler):
|
||||
}
|
||||
|
||||
try:
|
||||
await api_func(self.api_client, new_payload, push_id, biz_id)
|
||||
await api_func(self.api_client, new_payload, push_id, biz_id, steps=steps_payload)
|
||||
results.append(
|
||||
TaskResult.in_progress(
|
||||
node_id=node.node_id,
|
||||
@@ -202,6 +204,7 @@ class ProjectDetailApiHandler(BaseApiHandler):
|
||||
key=str(key),
|
||||
)
|
||||
)
|
||||
self._mark_approval_snapshot_synced(node)
|
||||
except Exception as e:
|
||||
self._pending_push_context.pop(push_id, None)
|
||||
results.append(TaskResult.failed(node_id=node.node_id, error=str(e)))
|
||||
@@ -501,55 +504,55 @@ class ProjectDetailApiHandler(BaseApiHandler):
|
||||
|
||||
# ========== 静态 API 函数(可抽成 SDK) ==========
|
||||
|
||||
async def api_update_project_plan_construction(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_plan_construction(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/plan_construction - 更新计划施工"""
|
||||
ProjectPlanConstruction.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/plan_construction", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
|
||||
async def api_update_project_actual_construction(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_actual_construction(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/actual_construction - 更新实际施工"""
|
||||
ProjectActualConstruction.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/actual_construction", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
|
||||
async def api_update_project_ensure_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_ensure_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/ensure_capacity - 更新确保产能"""
|
||||
ProjectEnsureCapacity.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/ensure_capacity", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
|
||||
async def api_update_project_climb_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_climb_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/climb_capacity - 更新登高产能"""
|
||||
ProjectClimbCapacity.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/climb_capacity", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
|
||||
async def api_update_project_challenge_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_challenge_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/challenge_capacity - 更新揭榜产能"""
|
||||
ProjectChallengeCapacity.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/challenge_capacity", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
|
||||
async def api_update_project_production_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str) -> None:
|
||||
async def api_update_project_production_capacity(client, data: Dict[str, Any], push_id: str, biz_id: str, *, steps: List[Dict[str, Any]] | None = None) -> None:
|
||||
"""PUT /project/production_capacity - 更新投产数据"""
|
||||
ProjectProductionCapacity.model_validate(data)
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data}
|
||||
request_data = {"push_id": push_id, "biz_id": biz_id, "data": data, "steps": steps or []}
|
||||
response = await client.request(method="PUT", endpoint="/project/production_capacity", data=request_data)
|
||||
if response.get("code") != 200:
|
||||
raise Exception(f"API error: {response.get('message', 'Unknown error')}")
|
||||
|
||||
Reference in New Issue
Block a user