feat: 经理看板展示报工超额信息
This commit is contained in:
@@ -264,6 +264,11 @@ def _dashboard_rows_from_allocations(allocations: list) -> list[DashboardRow]:
|
||||
"is_voided": False,
|
||||
"review_remarks": [],
|
||||
"review_remark_keys": set(),
|
||||
"has_over_limit": False,
|
||||
"over_limit_exceeded_keys": set(),
|
||||
"over_limit_uncheckable_keys": set(),
|
||||
"over_limit_reasons": [],
|
||||
"over_limit_reason_keys": set(),
|
||||
"correction_pairs": [],
|
||||
"correction_pair_keys": set(),
|
||||
},
|
||||
@@ -303,6 +308,17 @@ def _dashboard_rows_from_allocations(allocations: list) -> list[DashboardRow]:
|
||||
group["is_multi_person_assistant"] = (
|
||||
group["is_multi_person_assistant"] or bool(report.is_multi_person_assistant)
|
||||
)
|
||||
over_limit_status = str(getattr(item, "over_limit_status", "") or "")
|
||||
over_limit_reason = str(getattr(item, "over_limit_reason", "") or "").strip()
|
||||
over_limit_item_key = getattr(item, "id", None) or id(item)
|
||||
if over_limit_status == "exceeded":
|
||||
group["has_over_limit"] = True
|
||||
group["over_limit_exceeded_keys"].add(over_limit_item_key)
|
||||
elif over_limit_status == "uncheckable":
|
||||
group["over_limit_uncheckable_keys"].add(over_limit_item_key)
|
||||
if over_limit_reason and over_limit_reason not in group["over_limit_reason_keys"]:
|
||||
group["over_limit_reason_keys"].add(over_limit_reason)
|
||||
group["over_limit_reasons"].append(over_limit_reason)
|
||||
if report.review_remark:
|
||||
review_remark = str(report.review_remark).strip()
|
||||
if review_remark and review_remark not in group["review_remark_keys"]:
|
||||
@@ -333,6 +349,16 @@ def _dashboard_rows_from_allocations(allocations: list) -> list[DashboardRow]:
|
||||
"night": group["shift_night_minutes"],
|
||||
}
|
||||
source_report_dates = sorted(group["source_report_dates"])
|
||||
exceeded_count = len(group["over_limit_exceeded_keys"])
|
||||
uncheckable_count = len(group["over_limit_uncheckable_keys"])
|
||||
if exceeded_count and uncheckable_count:
|
||||
over_limit_summary = f"{exceeded_count}项超额,{uncheckable_count}项无法校验"
|
||||
elif exceeded_count:
|
||||
over_limit_summary = f"{exceeded_count}项超额"
|
||||
elif uncheckable_count:
|
||||
over_limit_summary = f"{uncheckable_count}项无法校验"
|
||||
else:
|
||||
over_limit_summary = None
|
||||
rows.append(
|
||||
DashboardRow(
|
||||
id=group["id"],
|
||||
@@ -380,6 +406,9 @@ def _dashboard_rows_from_allocations(allocations: list) -> list[DashboardRow]:
|
||||
is_system_auto_submitted=group["is_system_auto_submitted"],
|
||||
is_voided=group["is_voided"],
|
||||
review_remark=";".join(group["review_remarks"]) or None,
|
||||
has_over_limit=group["has_over_limit"],
|
||||
over_limit_summary=over_limit_summary,
|
||||
over_limit_reasons=";".join(group["over_limit_reasons"]) or None,
|
||||
correction_pairs=group["correction_pairs"],
|
||||
)
|
||||
)
|
||||
|
||||
@@ -658,6 +658,9 @@ class DashboardRow(BaseModel):
|
||||
is_system_auto_submitted: bool = False
|
||||
is_voided: bool = False
|
||||
review_remark: str | None = None
|
||||
has_over_limit: bool = False
|
||||
over_limit_summary: str | None = None
|
||||
over_limit_reasons: str | None = None
|
||||
correction_pairs: list[dict[str, Any]] = Field(default_factory=list)
|
||||
|
||||
|
||||
|
||||
@@ -133,6 +133,9 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
"操作人数",
|
||||
"工序单价",
|
||||
"参考工资",
|
||||
"是否超额",
|
||||
"超额摘要",
|
||||
"超额原因",
|
||||
"报工标记",
|
||||
"校正项",
|
||||
"备注",
|
||||
@@ -184,6 +187,9 @@ def export_dashboard_rows(rows: list) -> bytes:
|
||||
row.operator_count,
|
||||
row.process_unit_price_yuan,
|
||||
row.reference_wage,
|
||||
"是" if getattr(row, "has_over_limit", False) else "否",
|
||||
getattr(row, "over_limit_summary", None),
|
||||
getattr(row, "over_limit_reasons", None),
|
||||
"、".join(report_flags),
|
||||
correction_text,
|
||||
getattr(row, "review_remark", None),
|
||||
|
||||
Reference in New Issue
Block a user