diff --git a/backend/app/models/pl_models.py b/backend/app/models/pl_models.py index ac0faed6a..4e91a3ce0 100644 --- a/backend/app/models/pl_models.py +++ b/backend/app/models/pl_models.py @@ -105,6 +105,7 @@ class PlPersonnel(Base): ) status = Column(CHAR(1), nullable=False, default="1", comment="状态 1-在职 0-停用") photo_urls = Column(String(2000), nullable=True, comment="人员照片URL,逗号分隔") + sys_user_id = Column(String(64), nullable=True, comment="关联系统用户ID") tenant_no = Column(String(64), nullable=False, default="shanxia2.0", comment="租户编号") order_num = Column(Integer, nullable=True, comment="排序号") remark = Column(String(512), nullable=True, comment="备注") @@ -336,6 +337,9 @@ class PlPlan(Base): trailer_no = Column(String(20), nullable=True, comment="挂车号(安排运输时快照)") driver_id = Column(String(64), nullable=True, comment="司机ID") driver_name = Column(String(100), nullable=True, comment="司机姓名") + escort_id = Column(String(64), nullable=True, comment="押运员人员ID") + escort_name = Column(String(100), nullable=True, comment="押运员姓名") + escort_phone = Column(String(32), nullable=True, comment="押运员电话") personnel_summary = Column(String(500), nullable=True, comment="关联人员摘要(安排运输时快照)") resource_snapshot = Column(Text, nullable=True, comment="车辆/人员/证件整包快照 JSON") @@ -644,6 +648,9 @@ class PlTransport(Base): driver_id = Column(String(64), nullable=True, comment="司机ID") driver_name = Column(String(100), nullable=True, comment="司机姓名") driver_phone = Column(String(32), nullable=True, comment="司机电话") + escort_id = Column(String(64), nullable=True, comment="押运员人员ID") + escort_name = Column(String(100), nullable=True, comment="押运员姓名") + escort_phone = Column(String(32), nullable=True, comment="押运员电话") resource_snapshot = Column(Text, nullable=True, comment="车辆/人员/证件整包快照 JSON") # 承运商 diff --git a/docs/sql/migrations/2026-09-13-pl-driver-plan-schema.sql b/docs/sql/migrations/2026-09-13-pl-driver-plan-schema.sql new file mode 100644 index 000000000..6119ed9a8 --- /dev/null +++ b/docs/sql/migrations/2026-09-13-pl-driver-plan-schema.sql @@ -0,0 +1,18 @@ +-- 司机运输计划:驾押人员关联系统用户 + 运输单/计划押运冗余字段 +SET NAMES utf8mb4; + +-- 驾押人员关联系统用户 +ALTER TABLE `pl_personnel` + ADD COLUMN `sys_user_id` varchar(64) DEFAULT NULL COMMENT '关联系统用户ID' AFTER `photo_urls`; + +-- 运输单押运(与司机对称) +ALTER TABLE `pl_transport` + ADD COLUMN `escort_id` varchar(64) DEFAULT NULL COMMENT '押运员人员ID' AFTER `driver_phone`, + ADD COLUMN `escort_name` varchar(100) DEFAULT NULL COMMENT '押运员姓名' AFTER `escort_id`, + ADD COLUMN `escort_phone` varchar(32) DEFAULT NULL COMMENT '押运员电话' AFTER `escort_name`; + +-- 计划冗余押运(与 driver_id/driver_name 对称) +ALTER TABLE `pl_plan` + ADD COLUMN `escort_id` varchar(64) DEFAULT NULL COMMENT '押运员人员ID' AFTER `driver_name`, + ADD COLUMN `escort_name` varchar(100) DEFAULT NULL COMMENT '押运员姓名' AFTER `escort_id`, + ADD COLUMN `escort_phone` varchar(32) DEFAULT NULL COMMENT '押运员电话' AFTER `escort_name`;