修改时间时区问题
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
from app.extensions import db
|
||||
from app.models.base import MaterialBase
|
||||
from app.models.outbound import TransOutbound
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta, timezone # [修改]
|
||||
from sqlalchemy import or_, func, text, and_
|
||||
import traceback
|
||||
import json
|
||||
@ -52,8 +52,10 @@ class SemiInboundService:
|
||||
if not material:
|
||||
raise ValueError(f"ID为 {base_id} 的基础物料不存在")
|
||||
|
||||
# [核心修改] 处理入库日期(production_date),包含时分秒
|
||||
current_time = datetime.now()
|
||||
# [核心修改] 强制北京时间
|
||||
beijing_tz = timezone(timedelta(hours=8))
|
||||
current_time = datetime.now(beijing_tz).replace(tzinfo=None)
|
||||
|
||||
in_date_val = current_time
|
||||
|
||||
if data.get('in_date'):
|
||||
|
||||
Reference in New Issue
Block a user