feat(pl): add notes column on transport address library
Persist address-level precautions for later fill into plan load/delivery notes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
86e668920c
commit
22b92ea056
6 files changed
+49
No files matched your search
@@ -135,6 +135,7 @@ ADDRESS_EXPORT_COLUMNS = [
|
||||
ExportColumn(title="详细地址", field="fullAddress"),
|
||||
ExportColumn(title="联系人", field="contactName"),
|
||||
ExportColumn(title="联系电话", field="contactPhone"),
|
||||
ExportColumn(title="注意事项", field="notes"),
|
||||
ExportColumn(title="状态", field="statusLabel"),
|
||||
ExportColumn(title="备注", field="remark"),
|
||||
]
|
||||
@@ -221,6 +222,7 @@ def create_transport_address(
|
||||
lat=payload.lat,
|
||||
contact_name=payload.contact_name,
|
||||
contact_phone=payload.contact_phone,
|
||||
notes=payload.notes,
|
||||
status=payload.status or "1",
|
||||
remark=payload.remark,
|
||||
create_by=user.id,
|
||||
|
||||
@@ -128,6 +128,7 @@ class PlTransportAddress(Base):
|
||||
lat = Column(DECIMAL(10, 6), nullable=False, comment="纬度")
|
||||
contact_name = Column(String(100), nullable=True, comment="联系人")
|
||||
contact_phone = Column(String(32), nullable=True, comment="联系电话")
|
||||
notes = Column(String(500), nullable=True, comment="注意事项")
|
||||
status = Column(CHAR(1), nullable=False, default="1", comment="状态 1-启用 0-停用")
|
||||
tenant_no = Column(String(64), nullable=False, default="shanxia2.0", comment="租户编号")
|
||||
order_num = Column(Integer, nullable=True, comment="排序号")
|
||||
|
||||
@@ -13,6 +13,7 @@ class TransportAddressBase(BaseModel):
|
||||
lat: Decimal = Field(..., description="纬度")
|
||||
contact_name: Optional[str] = Field(default=None, max_length=100, alias="contactName", description="联系人")
|
||||
contact_phone: Optional[str] = Field(default=None, max_length=32, alias="contactPhone", description="联系电话")
|
||||
notes: Optional[str] = Field(default=None, max_length=500, description="注意事项")
|
||||
status: str = Field(default="1", max_length=1, description="状态 1-启用 0-停用")
|
||||
remark: Optional[str] = Field(default=None, description="备注")
|
||||
|
||||
@@ -34,6 +35,7 @@ class TransportAddressUpdate(BaseModel):
|
||||
lat: Optional[Decimal] = None
|
||||
contact_name: Optional[str] = Field(default=None, max_length=100, alias="contactName")
|
||||
contact_phone: Optional[str] = Field(default=None, max_length=32, alias="contactPhone")
|
||||
notes: Optional[str] = Field(default=None, max_length=500)
|
||||
status: Optional[str] = Field(default=None, max_length=1)
|
||||
remark: Optional[str] = None
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""运输地址库 Schema 接受 notes。"""
|
||||
from __future__ import annotations
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from app.schemas.pl.transport_address import TransportAddressCreate, TransportAddressUpdate
|
||||
|
||||
|
||||
def test_transport_address_create_accepts_notes():
|
||||
body = TransportAddressCreate.model_validate(
|
||||
{
|
||||
"addressName": "测试仓",
|
||||
"fullAddress": "安庆市某某路1号",
|
||||
"lng": Decimal("117.0"),
|
||||
"lat": Decimal("30.5"),
|
||||
"notes": "大门左侧卸货",
|
||||
}
|
||||
)
|
||||
assert body.notes == "大门左侧卸货"
|
||||
|
||||
|
||||
def test_transport_address_update_accepts_notes():
|
||||
body = TransportAddressUpdate.model_validate({"notes": "进厂需报备"})
|
||||
assert body.notes == "进厂需报备"
|
||||
|
||||
|
||||
def test_transport_address_create_notes_optional():
|
||||
body = TransportAddressCreate.model_validate(
|
||||
{
|
||||
"addressName": "测试仓",
|
||||
"fullAddress": "安庆市某某路1号",
|
||||
"lng": Decimal("117.0"),
|
||||
"lat": Decimal("30.5"),
|
||||
}
|
||||
)
|
||||
assert body.notes is None
|
||||
@@ -0,0 +1,7 @@
|
||||
-- 运输地址库增加注意事项
|
||||
-- 设计: docs/superpowers/specs/2026-09-02-pl-transport-address-notes-fill-design.md
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
ALTER TABLE `pl_transport_address`
|
||||
ADD COLUMN `notes` varchar(500) DEFAULT NULL COMMENT '注意事项' AFTER `contact_phone`;
|
||||
@@ -27529,6 +27529,7 @@ CREATE TABLE `pl_transport_address` (
|
||||
`lat` decimal(10,6) NOT NULL COMMENT '纬度',
|
||||
`contact_name` varchar(100) DEFAULT NULL COMMENT '联系人',
|
||||
`contact_phone` varchar(32) DEFAULT NULL COMMENT '联系电话',
|
||||
`notes` varchar(500) DEFAULT NULL COMMENT '注意事项',
|
||||
`status` char(1) NOT NULL DEFAULT '1' COMMENT '状态 1-启用 0-停用',
|
||||
`tenant_no` varchar(64) NOT NULL DEFAULT 'shanxia2.0' COMMENT '租户编号',
|
||||
`order_num` int(11) DEFAULT NULL COMMENT '排序号',
|
||||
|
||||
Reference in new issue
Block a user