diff --git a/inventory-backend/app/services/outbound_service.py b/inventory-backend/app/services/outbound_service.py index 35d81a5..9e971f1 100644 --- a/inventory-backend/app/services/outbound_service.py +++ b/inventory-backend/app/services/outbound_service.py @@ -459,8 +459,15 @@ class OutboundService: 'request_no': approval.request_no, 'consumer_name': common_data['consumer_name'], 'applicant_name': approval._get_user_name(approval.applicant_id), - # naive datetime 必须先转字符串,JSON 序列化不了 - 'outbound_time': current_time.isoformat(), + # ⚠️ 必须带 +08:00 偏移,不能直接发 current_time。 + # current_time 是 datetime.now(beijing_tz) 去掉 tzinfo 后的 + # **北京墙上时间**(MOM 自己的库是 naive 的 timestamp,所以 + # 本地这么存没问题)。但它一旦以无偏移的形式发出去, + # Track 的 timestamptz 列会按 **UTC** 解释,实测整整差 8 + # 小时(发 15:00 存成 15:00+00,前端在北京渲染成 23:00)。 + # 这里把 tzinfo 装回去还原真实时刻,发出去就是明确的 + # "2026-09-23T15:00:00+08:00"。 + 'outbound_time': current_time.replace(tzinfo=beijing_tz).isoformat(), 'remark': common_data['remark'], }) except Exception as e: