feat: 报工保存后刷新归属明细
This commit is contained in:
@@ -18,6 +18,7 @@ from app.models import (
|
||||
from app.services.metrics import calculate_report_metrics, minutes_between, release_at_caps_work_time
|
||||
from app.services.misc_work import is_misc_product
|
||||
from app.services.mold_locks import release_session_locks
|
||||
from app.services.report_allocations import refresh_report_allocations
|
||||
from app.services.work_schedule import DEFAULT_AUTO_SUBMIT_HOURS, get_work_schedule, get_work_schedule_config
|
||||
from app.timezone import now
|
||||
|
||||
@@ -171,6 +172,8 @@ def auto_submit_session(db: Session, session: WorkSession, submitted_at: datetim
|
||||
items=items,
|
||||
)
|
||||
db.add(report)
|
||||
db.flush()
|
||||
refresh_report_allocations(db, report, schedule=schedule, commit=False)
|
||||
return report
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from app.models import (
|
||||
MoldLockFeedback,
|
||||
Personnel,
|
||||
ProductionReport,
|
||||
ProductionReportAllocation,
|
||||
ProductionReportItem,
|
||||
ReportAuditLog,
|
||||
WorkSession,
|
||||
@@ -86,6 +87,7 @@ def purge_expired_voided_reports(db: Session) -> int:
|
||||
)
|
||||
)
|
||||
db.execute(delete(ReportAuditLog).where(ReportAuditLog.report_id == report.id))
|
||||
db.execute(delete(ProductionReportAllocation).where(ProductionReportAllocation.report_id == report.id))
|
||||
db.execute(delete(ProductionReportItem).where(ProductionReportItem.report_id == report.id))
|
||||
db.delete(report)
|
||||
if session is not None:
|
||||
|
||||
Reference in New Issue
Block a user