













升鲜宝云仓供应链管理系统
完整数据库数据字典设计
适用:多租户 SaaS、多货主云仓、多仓多库位、仓配一体、库存成本、费用结算
|
项目 |
说明 |
|
文档版本 |
V1.0 正式版 |
|
生成日期 |
2024-05-04 |
|
业务范围 |
货主、商品、仓库、库存、入库、出库、作业、配送、成本、费用、财务、权限、日志 |
|
设计原则 |
公共字段继承 + 业务字段逐表设计 + 唯一索引/常用索引 + 幂等键控制 |
|
建议数据库 |
MySQL 8.0+ |
|
建议后端 |
Spring Boot + MyBatis-Plus + Redis + Quartz/消息队列 |
本文档按照“公共字段规范 + 领域表清单 + 逐表数据字典 + 枚举字典 + 索引与幂等建议”的结构组织。所有业务表默认继承公共字段,正文的逐表数据字典主要列出业务字段。
|
前缀 |
领域 |
说明 |
|
tenant_ |
租户中心 |
租户、套餐、授权、租户配置 |
|
sys_ |
系统权限 |
用户、角色、菜单、组织、字典、权限规则 |
|
owner_ |
货主中心 |
货主档案、合同、仓库授权、商品映射、门户账号 |
|
pms_ |
商品中心 |
商品分类、SPU、SKU、单位、条码、批次规则 |
|
crm_ |
客户中心 |
客户、收货地址、账期授信 |
|
sup_ |
供应商中心 |
供应商、联系人 |
|
pur_ |
采购中心 |
采购订单与明细 |
|
wms_ |
仓库库存 |
仓库、库位、库存、入库、出库、作业、盘点 |
|
tms_ |
配送运输 |
车辆、司机、路线、配送、签收 |
|
cost_ |
成本中心 |
当前成本、批次成本、成本流水、成本重算 |
|
fee_ |
费用中心 |
费用项目、规则、事件、明细、账单、异议 |
|
fin_ |
财务结算 |
应收、收款、核销、发票、对账 |
|
msg_ |
消息中心 |
模板、站内信、发送任务 |
|
print_ |
打印中心 |
打印模板 |
|
exp_ |
导出中心 |
导出任务 |
|
log_ |
日志审计 |
操作、审核、登录日志 |
|
open_ |
开放接口 |
接口应用、调用日志 |
除纯关系表或特殊流水表外,所有业务表建议默认包含以下公共字段。正文逐表仅列业务字段,避免重复。
|
字段名 |
类型 |
约束 |
默认值 |
说明 |
|
id |
bigint |
PK, not null |
雪花算法主键,所有业务表统一使用 bigint |
|
|
tenant_id |
bigint |
not null |
租户 ID,SaaS 数据隔离核心字段 |
|
|
create_user_id |
bigint |
创建人 ID |
||
|
create_user_name |
varchar(64) |
创建人名称,便于审计快照 |
||
|
create_time |
datetime |
not null |
CURRENT_TIMESTAMP |
创建时间 |
|
update_user_id |
bigint |
更新人 ID |
||
|
update_user_name |
varchar(64) |
更新人名称 |
||
|
update_time |
datetime |
CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP |
更新时间 |
|
|
deleted |
tinyint |
not null |
0 |
逻辑删除:0否,1是 |
|
version |
int |
not null |
0 |
乐观锁版本号 |
|
remark |
varchar(500) |
备注 |
|
业务类型 |
建议类型 |
说明 |
|
数量 |
decimal(18,4) |
适用于入库数量、出库数量、库存数量、盘点数量 |
|
重量 |
decimal(18,4) |
kg、斤等重量计算 |
|
体积 |
decimal(18,6) |
m³ 或体积换算 |
|
单价 |
decimal(18,6) |
采购价、销售价、成本价、计费单价 |
|
金额 |
decimal(18,2) |
业务金额、成本金额、费用金额、应收金额 |
|
税率 |
decimal(8,6) |
支持 0.130000 等税率 |
|
长宽高 |
decimal(18,4) |
商品和库位尺寸 |
|
经纬度 |
decimal(18,6) |
配送地址、仓库地址定位 |
|
主线 |
核心表关系 |
|
入库主线 |
pur_order -> wms_asn_bill -> wms_stockin_bill -> wms_goods_inventory / batch / location -> inventory_flow -> cost_flow -> fee_event |
|
出库主线 |
oms_order -> wms_goods_inventory_lock -> wms_stockout_bill -> pick/review/pack -> inventory_flow -> cost_flow -> tms_delivery_order -> fee_event |
|
盘点损溢 |
wms_stocktake_bill -> wms_loss_overflow_bill -> 报损生成出库 / 报溢生成入库 -> 库存流水 -> 成本流水 |
|
费用账单 |
fee_billing_event -> fee_detail -> fee_owner_bill -> fin_receivable -> fin_receipt -> fin_receipt_writeoff |
|
数据隔离 |
tenant_id + owner_id + warehouse_id + user data scope |
|
领域 |
表名 |
中文名 |
用途说明 |
|
SaaS 租户与系统权限 |
tenant_info |
租户主表 |
记录每个供应链公司或云仓企业租户,是 SaaS 数据隔离和授权控制入口。 |
|
SaaS 租户与系统权限 |
tenant_package |
租户套餐表 |
配置不同版本的功能、用户数、仓库数、货主数和导出额度。 |
|
SaaS 租户与系统权限 |
tenant_auth |
租户授权表 |
记录租户授权、开通、续费、停用、模块授权快照。 |
|
SaaS 租户与系统权限 |
tenant_module |
租户模块授权表 |
控制租户可用的功能模块。 |
|
SaaS 租户与系统权限 |
tenant_config |
租户配置表 |
保存单号、小数位、打印、导出、安全、费用等租户级配置。 |
|
SaaS 租户与系统权限 |
sys_org |
组织部门表 |
租户内组织、部门、岗位与仓库组织关系。 |
|
SaaS 租户与系统权限 |
sys_user |
系统用户表 |
登录用户统一表,可绑定员工、货主用户、司机、平台运维。 |
|
SaaS 租户与系统权限 |
sys_role |
角色表 |
租户内角色定义,支持数据范围控制。 |
|
SaaS 租户与系统权限 |
sys_menu |
菜单权限表 |
菜单、按钮、接口权限统一维护。 |
|
SaaS 租户与系统权限 |
sys_user_role |
用户角色关系表 |
用户与角色多对多关系。 |
|
SaaS 租户与系统权限 |
sys_role_menu |
角色菜单关系表 |
角色拥有菜单、按钮、接口权限。 |
|
SaaS 租户与系统权限 |
sys_dict_type |
字典类型表 |
系统字典类型,例如单据状态、温层、计费方式。 |
|
SaaS 租户与系统权限 |
sys_dict_data |
字典明细表 |
字典枚举明细。 |
|
SaaS 租户与系统权限 |
sys_data_scope_rule |
数据权限规则表 |
配置 owner_id、warehouse_id、customer_id 等数据范围规则。 |
|
SaaS 租户与系统权限 |
sys_field_permission |
字段权限表 |
控制成本、售价、手机号等敏感字段显示、脱敏和写入。 |
|
货主管理 |
owner_info |
货主主表 |
管理云仓服务对象,是库存、费用、账单、门户权限的核心主体。 |
|
货主管理 |
owner_contact |
货主联系人表 |
维护货主老板、财务、仓储、订单、技术等联系人。 |
|
货主管理 |
owner_contract |
货主合同表 |
记录服务范围、账期、最低消费、免费仓储期和默认计费方案。 |
|
货主管理 |
owner_contract_service |
货主合同服务表 |
合同内可用服务及是否计费。 |
|
货主管理 |
owner_warehouse_auth |
货主仓库授权表 |
控制货主可使用哪些仓库及可操作业务。 |
|
货主管理 |
owner_goods_mapping |
货主商品映射表 |
支持货主自己的商品编码、名称、规格、条码与系统 SKU 映射。 |
|
货主管理 |
owner_user |
货主门户用户表 |
货主登录门户使用的账号信息,与 sys_user 关联。 |
|
货主管理 |
owner_service_config |
货主服务配置表 |
货主级库存、审核、计费、账单策略。 |
|
货主管理 |
owner_settlement_account |
货主结算账户表 |
保存货主收付款、发票、银行账户信息。 |
|
货主管理 |
owner_api_app |
货主接口应用表 |
货主通过开放接口推送订单、查询库存的应用凭证。 |
|
货主管理 |
owner_file |
货主附件表 |
合同、营业执照、协议等附件。 |
|
货主管理 |
owner_operation_log |
货主操作日志表 |
记录货主档案、合同、授权、配置变更。 |
|
商品主数据 |
pms_goods_category |
商品分类表 |
树形分类,支持一二级或多级分类。 |
|
商品主数据 |
pms_brand |
品牌表 |
商品品牌资料。 |
|
商品主数据 |
pms_unit |
单位表 |
统一单位主数据。 |
|
商品主数据 |
pms_goods |
商品 SPU 表 |
商品主档,不直接代表可交易规格。 |
|
商品主数据 |
pms_goods_sku |
商品 SKU 表 |
商品规格,可用于采购、库存、销售。 |
|
商品主数据 |
pms_goods_unit_relation |
商品单位换算表 |
定义商品 SKU 多单位换算,并标记采购、销售、库存单位。 |
|
商品主数据 |
pms_goods_barcode |
商品条码表 |
支持一品多码、一 SKU 多单位条码。 |
|
商品主数据 |
pms_goods_batch_rule |
商品批次规则表 |
指定 SKU 批次、生产日期、保质期、出库策略。 |
|
商品主数据 |
pms_goods_media |
商品图片资源表 |
商品图片、视频、文件资源。 |
|
客户与供应商 |
crm_customer |
客户表 |
货主或供应链公司的下游客户资料。 |
|
客户与供应商 |
crm_customer_address |
客户收货地址表 |
客户多收货地址,用于配送路线规划。 |
|
客户与供应商 |
sup_supplier |
供应商表 |
采购、ASN、收货所需供应商资料。 |
|
客户与供应商 |
sup_supplier_contact |
供应商联系人表 |
供应商多联系人。 |
|
仓库与库位 |
wms_warehouse |
仓库表 |
仓库主体,可为中央仓、前置仓、门店仓、虚拟仓。 |
|
仓库与库位 |
wms_area |
库区表 |
仓库下库区,如常温区、冷藏区、发货区、残次区。 |
|
仓库与库位 |
wms_shelf |
货架表 |
库区内货架定义。 |
|
仓库与库位 |
wms_location |
库位表 |
库存最小管理单元。 |
|
仓库与库位 |
wms_temperature_zone |
温层表 |
常温、冷藏、冷冻、恒温等温层定义。 |
|
仓库与库位 |
wms_work_area |
作业区表 |
收货区、复核区、打包区、发货区等作业区。 |
|
仓库与库位 |
wms_location_strategy |
库位策略表 |
上架推荐、拣货推荐、补货策略。 |
|
仓库与库位 |
wms_equipment |
仓库设备表 |
PDA、电子秤、叉车、打印机等仓储设备。 |
|
采购与入库 |
pur_order |
采购订单主表 |
采购订单入口,可生成 ASN 和入库单。 |
|
采购与入库 |
pur_order_detail |
采购订单明细表 |
采购商品明细。 |
|
采购与入库 |
wms_asn_bill |
到货通知 ASN 主表 |
供应商或货主到货预约通知。 |
|
采购与入库 |
wms_asn_bill_detail |
ASN 明细表 |
到货商品明细。 |
|
采购与入库 |
wms_receipt_record |
收货记录表 |
到货后的实际收货记录,可与 ASN 和入库单关联。 |
|
采购与入库 |
wms_quality_check |
质检记录表 |
收货质检、抽检、判定。 |
|
采购与入库 |
wms_stockin_bill |
入库单主表 |
入库审核后增加仓库库存、批次库存、成本。 |
|
采购与入库 |
wms_stockin_bill_detail |
入库单明细表 |
入库商品、批次、成本、库位信息。 |
|
订单与出库 |
oms_order |
销售订单主表 |
货主出库指令或销售订单入口。 |
|
订单与出库 |
oms_order_detail |
销售订单明细表 |
订单商品明细。 |
|
订单与出库 |
wms_stockout_bill |
出库单主表 |
出库审核后扣减库存并结转成本。 |
|
订单与出库 |
wms_stockout_bill_detail |
出库单明细表 |
记录实际出库批次、库位、成本。 |
|
库存与批次 |
wms_goods_inventory |
仓库库存表 |
某货主、某仓库、某 SKU 的库存汇总。 |
|
库存与批次 |
wms_goods_inventory_batch |
批次库存表 |
某货主、仓库、SKU、批次的库存。 |
|
库存与批次 |
wms_goods_inventory_location |
库位库存表 |
最细库存层,支持库位、批次、SKU 维度。 |
|
库存与批次 |
wms_goods_inventory_flow |
库存流水表 |
所有库存变化必须写流水,审核和反审核都要记录。 |
|
库存与批次 |
wms_goods_inventory_lock |
库存占用表 |
订单或拣货占用库存。 |
|
库存与批次 |
wms_goods_inventory_freeze |
库存冻结表 |
盘点、质检、异常、财务冻结库存。 |
|
库存与批次 |
wms_stock_snapshot |
库存快照表 |
用于库存日结、仓储费、报表和对账。 |
|
仓内作业 |
wms_putaway_task |
上架任务表 |
入库审核后生成上架任务。 |
|
仓内作业 |
wms_putaway_task_detail |
上架任务明细表 |
每个 SKU、批次、库位的上架明细。 |
|
仓内作业 |
wms_pick_wave |
拣货波次表 |
多订单生成波次拣货。 |
|
仓内作业 |
wms_pick_task |
拣货任务表 |
按单、批量或波次拣货任务。 |
|
仓内作业 |
wms_pick_task_detail |
拣货任务明细表 |
从指定库位和批次拣货。 |
|
仓内作业 |
wms_review_task |
复核任务表 |
复核商品、数量、批次,产生差异。 |
|
仓内作业 |
wms_pack_task |
打包任务表 |
包裹、重量、体积、耗材记录。 |
|
仓内作业 |
wms_shipment_handover |
发货交接表 |
仓库与配送、司机或承运商交接。 |
|
仓内作业 |
wms_move_task |
移库任务表 |
库位之间移动,库存总量不变,库位库存变化。 |
|
退货 |
wms_stocktake_bill |
盘点单主表 |
盘点单审核后生成差异处理链路。 |
|
退货 |
wms_stocktake_bill_detail |
盘点单明细表 |
系统数量、实盘数量、差异数量。 |
|
退货 |
wms_loss_overflow_bill |
报损报溢单主表 |
盘亏生成报损,盘盈生成报溢。 |
|
退货 |
wms_loss_overflow_bill_detail |
报损报溢单明细表 |
损溢商品明细。 |
|
退货 |
wms_transfer_bill |
调拨单主表 |
仓间、库区、库位调拨。 |
|
退货 |
wms_transfer_bill_detail |
调拨单明细表 |
调拨商品明细。 |
|
退货 |
wms_return_bill |
退货单主表 |
客户退货、拒收、错发、质量退货。 |
|
退货 |
wms_return_bill_detail |
退货单明细表 |
退货商品明细和良残判定。 |
|
配送运输 |
tms_vehicle |
车辆表 |
车辆档案,包含载重、容积和温层。 |
|
配送运输 |
tms_driver |
司机表 |
司机档案,可绑定系统用户。 |
|
配送运输 |
tms_route |
配送路线表 |
固定路线或临时路线。 |
|
配送运输 |
tms_delivery_order |
配送单主表 |
出库后生成配送任务,司机执行签收。 |
|
配送运输 |
tms_delivery_order_detail |
配送单明细表 |
配送关联出库明细或订单明细。 |
|
配送运输 |
tms_loading_record |
装车记录表 |
出库包裹或商品装车确认。 |
|
配送运输 |
tms_sign_record |
签收记录表 |
客户签收、部分签收、拒收凭证。 |
|
配送运输 |
tms_exception_record |
配送异常表 |
配送过程中异常反馈。 |
|
成本核算 |
cost_goods_cost |
商品当前成本表 |
当前 SKU 在仓库的库存成本汇总。 |
|
成本核算 |
cost_goods_cost_batch |
商品批次成本表 |
FIFO 或批次核算时使用。 |
|
成本核算 |
cost_goods_cost_flow |
成本流水表 |
所有成本变化写流水,和库存流水保持一致。 |
|
成本核算 |
cost_rebuild_task |
成本重算任务表 |
用于异常回滚、历史成本重算。 |
|
成本核算 |
cost_exception |
成本异常表 |
库存、成本不一致或计算失败记录。 |
|
费用计费与货主账单 |
fee_item |
费用项目表 |
仓储费、入库费、出库费、配送费、增值服务费等。 |
|
费用计费与货主账单 |
fee_scheme |
计费方案表 |
多个费用项目和规则组合成一个方案。 |
|
费用计费与货主账单 |
fee_scheme_item |
计费方案明细表 |
方案中的费用项目及对应规则。 |
|
费用计费与货主账单 |
fee_rule |
计费规则表 |
费用计算核心规则,支持固定价、阶梯价、区间价、公式价。 |
|
费用计费与货主账单 |
fee_rule_condition |
计费规则条件表 |
按货主、仓库、温层、商品分类、距离、重量等条件匹配规则。 |
|
费用计费与货主账单 |
fee_price_tier |
阶梯价格表 |
数量、重量、体积、距离、金额阶梯。 |
|
费用计费与货主账单 |
fee_billing_event |
计费事件表 |
业务作业触发计费事件,计费引擎消费。 |
|
费用计费与货主账单 |
fee_detail |
费用明细表 |
每一笔业务费用记录,可追溯来源单据和规则。 |
|
费用计费与货主账单 |
fee_storage_snapshot |
仓储费库存快照表 |
仓储费按日库存快照计算。 |
|
费用计费与货主账单 |
fee_adjustment |
费用调整表 |
费用减免、补收、冲红、手工费用。 |
|
费用计费与货主账单 |
fee_owner_bill |
货主账单主表 |
按账期汇总费用明细,货主确认后生成应收。 |
|
费用计费与货主账单 |
fee_owner_bill_detail |
货主账单明细表 |
账单内费用明细快照。 |
|
费用计费与货主账单 |
fee_bill_dispute |
账单异议表 |
货主对账单提出异议及处理结果。 |
|
财务结算 |
fin_receivable |
应收单表 |
货主或客户应收账款。 |
|
财务结算 |
fin_receipt |
收款单表 |
记录实际收款。 |
|
财务结算 |
fin_receipt_writeoff |
收款核销表 |
收款单与应收单之间的核销关系。 |
|
财务结算 |
fin_invoice |
发票表 |
开票申请、开票记录和发票状态。 |
|
财务结算 |
fin_account_statement |
对账单表 |
客户、供应商或货主对账单。 |
|
开放接口 |
msg_template |
消息模板表 |
站内信、短信、邮件、企业微信、WebSocket 模板。 |
|
开放接口 |
msg_notice |
站内信通知表 |
用户站内信和待办。 |
|
开放接口 |
msg_send_task |
消息发送任务表 |
异步发送、重试、死信。 |
|
开放接口 |
print_template |
打印模板表 |
单据、小票、标签、面单模板。 |
|
开放接口 |
exp_export_task |
导出任务表 |
所有 Excel 导出进入任务中心,防止数据泄露。 |
|
开放接口 |
log_operation |
操作日志表 |
记录用户操作、请求参数、结果、IP。 |
|
开放接口 |
log_audit |
审核日志表 |
审核、反审核、驳回记录。 |
|
开放接口 |
log_login |
登录日志表 |
用户登录、退出、失败。 |
|
开放接口 |
open_api_app |
开放接口应用表 |
外部系统接入凭证。 |
|
开放接口 |
open_api_call_log |
开放接口调用日志表 |
记录接口调用和错误排查。 |
管理平台租户、套餐、授权、组织、用户、角色、菜单、字典、数据权限和字段权限。
用途:记录每个供应链公司或云仓企业租户,是 SaaS 数据隔离和授权控制入口。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
tenant_code |
varchar(50) |
not null |
租户编码 |
|
|
tenant_name |
varchar(150) |
not null |
租户名称 |
|
|
tenant_type |
tinyint |
not null |
1 |
租户类型:1供应链公司,2云仓公司,3集团,9其他 |
|
contact_name |
varchar(50) |
联系人 |
||
|
contact_mobile |
varchar(30) |
联系电话 |
||
|
|
varchar(100) |
邮箱 |
||
|
package_id |
bigint |
套餐 ID |
||
|
expire_date |
date |
到期日期 |
||
|
db_mode |
tinyint |
not null |
1 |
数据库模式:1共享库,2独立库 |
|
db_name |
varchar(100) |
独立库名称 |
||
|
status |
tinyint |
not null |
1 |
状态:0停用,1启用,2到期 |
建议索引:uk_tenant_code(tenant_code,deleted); idx_tenant_status(status,expire_date)
用途:配置不同版本的功能、用户数、仓库数、货主数和导出额度。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
package_code |
varchar(50) |
not null |
套餐编码 |
|
|
package_name |
varchar(100) |
not null |
套餐名称 |
|
|
user_limit |
int |
用户数上限 |
||
|
warehouse_limit |
int |
仓库数上限 |
||
|
owner_limit |
int |
货主数上限 |
||
|
export_limit_per_day |
int |
每日导出次数上限 |
||
|
price_month |
decimal(18,2) |
月价格 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_package_code(package_code,deleted)
用途:记录租户授权、开通、续费、停用、模块授权快照。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
tenant_id_ref |
bigint |
not null |
被授权租户 ID |
|
|
auth_no |
varchar(50) |
not null |
授权编号 |
|
|
package_id |
bigint |
套餐 ID |
||
|
start_date |
date |
not null |
授权开始日期 |
|
|
end_date |
date |
not null |
授权结束日期 |
|
|
auth_status |
tinyint |
not null |
1 |
授权状态:1有效,2到期,3停用 |
|
auth_source |
tinyint |
1 |
授权来源:1人工,2线上购买,3试用 |
|
|
auth_content |
json |
授权内容快照 |
建议索引:uk_auth_no(tenant_id,auth_no); idx_auth_end_date(tenant_id,end_date)
用途:控制租户可用的功能模块。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
tenant_id_ref |
bigint |
not null |
租户 ID |
|
|
module_code |
varchar(80) |
not null |
模块编码 |
|
|
module_name |
varchar(100) |
not null |
模块名称 |
|
|
enabled |
tinyint |
not null |
1 |
是否启用 |
|
expire_date |
date |
模块到期日期 |
建议索引:uk_tenant_module(tenant_id_ref,module_code,deleted)
用途:保存单号、小数位、打印、导出、安全、费用等租户级配置。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
config_key |
varchar(100) |
not null |
配置键 |
|
|
config_name |
varchar(100) |
配置名称 |
||
|
config_value |
text |
配置值 |
||
|
config_type |
varchar(50) |
配置类型 |
||
|
is_system |
tinyint |
not null |
0 |
是否系统内置 |
|
enabled |
tinyint |
not null |
1 |
是否启用 |
建议索引:uk_tenant_config(tenant_id,config_key,deleted)
用途:租户内组织、部门、岗位与仓库组织关系。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
parent_id |
bigint |
not null |
0 |
上级组织 ID |
|
org_code |
varchar(50) |
not null |
组织编码 |
|
|
org_name |
varchar(100) |
not null |
组织名称 |
|
|
org_type |
tinyint |
not null |
1 |
组织类型:1公司,2部门,3岗位,4仓库组织 |
|
path |
varchar(500) |
组织路径 |
||
|
sort_no |
int |
0 |
排序 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_org_code(tenant_id,org_code,deleted); idx_org_parent(tenant_id,parent_id)
用途:登录用户统一表,可绑定员工、货主用户、司机、平台运维。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
org_id |
bigint |
组织 ID |
||
|
username |
varchar(64) |
not null |
登录账号 |
|
|
password |
varchar(255) |
not null |
密码哈希 |
|
|
real_name |
varchar(64) |
姓名 |
||
|
mobile |
varchar(30) |
手机号 |
||
|
|
varchar(100) |
邮箱 |
||
|
user_type |
tinyint |
not null |
2 |
用户类型:1平台,2租户员工,3货主,4司机 |
|
owner_id |
bigint |
绑定货主 ID |
||
|
warehouse_id |
bigint |
默认仓库 ID |
||
|
avatar_url |
varchar(255) |
头像 |
||
|
status |
tinyint |
not null |
1 |
状态:0停用,1启用,2锁定 |
|
last_login_time |
datetime |
最后登录时间 |
建议索引:uk_username(tenant_id,username,deleted); idx_user_owner(tenant_id,owner_id); idx_user_warehouse(tenant_id,warehouse_id)
用途:租户内角色定义,支持数据范围控制。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
role_code |
varchar(50) |
not null |
角色编码 |
|
|
role_name |
varchar(100) |
not null |
角色名称 |
|
|
role_type |
tinyint |
not null |
2 |
角色类型:1平台,2租户,3货主,4司机 |
|
data_scope |
tinyint |
not null |
1 |
数据范围:1全部,2本组织,3本仓库,4本人,5自定义 |
|
sort_no |
int |
0 |
排序 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_role_code(tenant_id,role_code,deleted)
用途:菜单、按钮、接口权限统一维护。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
parent_id |
bigint |
not null |
0 |
上级菜单 |
|
menu_code |
varchar(80) |
not null |
菜单编码 |
|
|
menu_name |
varchar(100) |
not null |
菜单名称 |
|
|
menu_type |
tinyint |
not null |
2 |
类型:1目录,2菜单,3按钮,4接口 |
|
route_path |
varchar(255) |
前端路由 |
||
|
component_path |
varchar(255) |
组件路径 |
||
|
permission_code |
varchar(120) |
权限标识 |
||
|
icon |
varchar(100) |
图标 |
||
|
sort_no |
int |
0 |
排序 |
|
|
visible |
tinyint |
not null |
1 |
是否显示 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_menu_code(tenant_id,menu_code,deleted); idx_menu_parent(tenant_id,parent_id)
用途:用户与角色多对多关系。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
user_id |
bigint |
not null |
用户 ID |
|
|
role_id |
bigint |
not null |
角色 ID |
建议索引:uk_user_role(tenant_id,user_id,role_id,deleted)
用途:角色拥有菜单、按钮、接口权限。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
role_id |
bigint |
not null |
角色 ID |
|
|
menu_id |
bigint |
not null |
菜单 ID |
建议索引:uk_role_menu(tenant_id,role_id,menu_id,deleted)
用途:系统字典类型,例如单据状态、温层、计费方式。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
dict_type |
varchar(80) |
not null |
字典类型编码 |
|
|
dict_name |
varchar(100) |
not null |
字典类型名称 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_dict_type(tenant_id,dict_type,deleted)
用途:字典枚举明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
dict_type |
varchar(80) |
not null |
字典类型 |
|
|
dict_label |
varchar(100) |
not null |
显示名称 |
|
|
dict_value |
varchar(80) |
not null |
字典值 |
|
|
sort_no |
int |
0 |
排序 |
|
|
css_class |
varchar(80) |
样式类 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_dict_data(tenant_id,dict_type,dict_value,deleted)
用途:配置 owner_id、warehouse_id、customer_id 等数据范围规则。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
rule_code |
varchar(80) |
not null |
规则编码 |
|
|
rule_name |
varchar(100) |
not null |
规则名称 |
|
|
target_table |
varchar(100) |
not null |
目标表 |
|
|
target_alias |
varchar(50) |
SQL 别名 |
||
|
scope_field |
varchar(80) |
not null |
权限字段 |
|
|
scope_type |
tinyint |
not null |
范围类型:1租户,2货主,3仓库,4客户,5组织,6本人 |
|
|
expression |
varchar(500) |
条件表达式 |
||
|
enabled |
tinyint |
not null |
1 |
是否启用 |
建议索引:uk_data_scope_rule(tenant_id,rule_code,deleted)
用途:控制成本、售价、手机号等敏感字段显示、脱敏和写入。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
permission_code |
varchar(100) |
not null |
字段权限编码 |
|
|
table_name |
varchar(100) |
not null |
表名 |
|
|
field_name |
varchar(100) |
not null |
字段名 |
|
|
field_label |
varchar(100) |
字段中文名 |
||
|
permission_type |
tinyint |
not null |
1 |
权限类型:1可读,2隐藏,3脱敏,4只读,5可写 |
|
mask_rule |
varchar(100) |
脱敏规则 |
||
|
role_id |
bigint |
角色 ID |
||
|
enabled |
tinyint |
not null |
1 |
是否启用 |
建议索引:idx_field_permission(tenant_id,table_name,field_name,role_id)
货主是云仓库存归属、合同主体、计费主体、权限隔离主体。所有核心业务单据建议带 owner_id。
用途:管理云仓服务对象,是库存、费用、账单、门户权限的核心主体。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_code |
varchar(50) |
not null |
货主编码 |
|
|
owner_name |
varchar(150) |
not null |
货主名称 |
|
|
short_name |
varchar(100) |
简称 |
||
|
owner_type |
tinyint |
not null |
1 |
1品牌商,2批发商,3商超,4电商,5餐饮,9其他 |
|
business_license_no |
varchar(80) |
营业执照号 |
||
|
tax_no |
varchar(80) |
纳税人识别号 |
||
|
legal_person |
varchar(50) |
法人 |
||
|
contact_name |
varchar(50) |
默认联系人 |
||
|
contact_mobile |
varchar(30) |
联系电话 |
||
|
|
varchar(100) |
邮箱 |
||
|
province |
varchar(50) |
省 |
||
|
city |
varchar(50) |
市 |
||
|
district |
varchar(50) |
区 |
||
|
address |
varchar(255) |
地址 |
||
|
settle_type |
tinyint |
4 |
结算方式:1日结,2周结,3半月结,4月结 |
|
|
account_period_days |
int |
30 |
账期天数 |
|
|
credit_limit |
decimal(18,2) |
0 |
授信额度 |
|
|
status |
tinyint |
not null |
1 |
0停用,1启用,2待审核,3黑名单 |
|
audit_status |
tinyint |
not null |
0 |
0未提交,1待审,2已审,3驳回 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_owner_code(tenant_id,owner_code,deleted); idx_owner_name(tenant_id,owner_name); idx_owner_status(tenant_id,status)
用途:维护货主老板、财务、仓储、订单、技术等联系人。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
contact_type |
tinyint |
not null |
1 |
1老板,2财务,3仓储,4订单,5技术 |
|
contact_name |
varchar(50) |
not null |
联系人 |
|
|
mobile |
varchar(30) |
手机号 |
||
|
phone |
varchar(30) |
固定电话 |
||
|
|
varchar(100) |
邮箱 |
||
|
|
varchar(80) |
微信 |
||
|
position_name |
varchar(80) |
职务 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:idx_owner_contact(tenant_id,owner_id); idx_owner_mobile(tenant_id,mobile)
用途:记录服务范围、账期、最低消费、免费仓储期和默认计费方案。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
contract_no |
varchar(50) |
not null |
合同编号 |
|
|
contract_name |
varchar(150) |
not null |
合同名称 |
|
|
contract_type |
tinyint |
not null |
4 |
1仓储,2配送,3仓配一体,4综合服务 |
|
start_date |
date |
not null |
生效日期 |
|
|
end_date |
date |
not null |
到期日期 |
|
|
settle_cycle |
tinyint |
not null |
4 |
1日结,2周结,3半月结,4月结 |
|
account_period_days |
int |
30 |
账期天数 |
|
|
min_month_amount |
decimal(18,2) |
0 |
月最低消费 |
|
|
free_storage_days |
int |
0 |
免费仓储天数 |
|
|
billing_scheme_id |
bigint |
默认计费方案 ID |
||
|
auto_generate_bill |
tinyint |
not null |
1 |
是否自动生成账单 |
|
bill_confirm_required |
tinyint |
not null |
1 |
是否需要货主确认账单 |
|
status |
tinyint |
not null |
0 |
0草稿,1待审,2生效,3到期,4终止 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_contract_no(tenant_id,contract_no,deleted); idx_owner_contract(tenant_id,owner_id,status); idx_contract_date(tenant_id,start_date,end_date)
用途:合同内可用服务及是否计费。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
contract_id |
bigint |
not null |
合同 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
service_code |
varchar(50) |
not null |
服务编码,如 STORAGE、INBOUND、OUTBOUND、DELIVERY |
|
|
service_name |
varchar(100) |
not null |
服务名称 |
|
|
service_type |
tinyint |
not null |
1仓储,2入库,3出库,4配送,5加工,6增值 |
|
|
billing_enabled |
tinyint |
not null |
1 |
是否计费 |
|
fee_item_id |
bigint |
费用项目 ID |
||
|
billing_scheme_id |
bigint |
计费方案 ID |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_contract_service(tenant_id,contract_id,service_code,deleted)
用途:控制货主可使用哪些仓库及可操作业务。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
warehouse_code |
varchar(50) |
仓库编码快照 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认仓库 |
|
inbound_enabled |
tinyint |
not null |
1 |
是否允许入库 |
|
outbound_enabled |
tinyint |
not null |
1 |
是否允许出库 |
|
transfer_enabled |
tinyint |
not null |
1 |
是否允许调拨 |
|
return_enabled |
tinyint |
not null |
1 |
是否允许退货 |
|
stocktake_enabled |
tinyint |
not null |
1 |
是否允许盘点 |
|
start_date |
date |
授权开始 |
||
|
end_date |
date |
授权结束 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_owner_warehouse(tenant_id,owner_id,warehouse_id,deleted)
用途:支持货主自己的商品编码、名称、规格、条码与系统 SKU 映射。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
系统商品 ID |
|
|
sku_id |
bigint |
not null |
系统 SKU ID |
|
|
owner_goods_code |
varchar(80) |
not null |
货主商品编码 |
|
|
owner_goods_name |
varchar(150) |
货主商品名称 |
||
|
owner_sku_code |
varchar(80) |
货主 SKU 编码 |
||
|
owner_barcode |
varchar(80) |
货主条码 |
||
|
owner_spec |
varchar(100) |
货主规格 |
||
|
owner_unit_name |
varchar(30) |
货主单位 |
||
|
shelf_life_days |
int |
保质期天数 |
||
|
batch_required |
tinyint |
not null |
0 |
是否必填批次 |
|
production_date_required |
tinyint |
not null |
0 |
是否必填生产日期 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_owner_goods_code(tenant_id,owner_id,owner_goods_code,deleted); uk_owner_barcode(tenant_id,owner_id,owner_barcode,deleted); idx_owner_sku(tenant_id,owner_id,sku_id)
用途:货主登录门户使用的账号信息,与 sys_user 关联。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
sys_user_id |
bigint |
not null |
系统用户 ID |
|
|
user_name |
varchar(64) |
not null |
账号 |
|
|
real_name |
varchar(50) |
姓名 |
||
|
mobile |
varchar(30) |
手机号 |
||
|
|
varchar(100) |
邮箱 |
||
|
role_type |
tinyint |
not null |
1 |
1管理员,2业务员,3财务,4只读 |
|
data_scope |
tinyint |
not null |
1 |
数据范围 |
|
last_login_time |
datetime |
最后登录时间 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_owner_user(tenant_id,owner_id,sys_user_id,deleted)
用途:货主级库存、审核、计费、账单策略。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
allow_negative_stock |
tinyint |
not null |
0 |
是否允许负库存 |
|
auto_allocate_stock |
tinyint |
not null |
1 |
是否自动分配库存 |
|
outbound_batch_rule |
tinyint |
not null |
2 |
1先进先出,2临期先出,3指定批次 |
|
need_inbound_audit |
tinyint |
not null |
1 |
入库是否需要审核 |
|
need_outbound_audit |
tinyint |
not null |
1 |
出库是否需要审核 |
|
need_owner_confirm_bill |
tinyint |
not null |
1 |
账单是否需要货主确认 |
|
storage_fee_enabled |
tinyint |
not null |
1 |
仓储费启用 |
|
inbound_fee_enabled |
tinyint |
not null |
1 |
入库费启用 |
|
outbound_fee_enabled |
tinyint |
not null |
1 |
出库费启用 |
|
delivery_fee_enabled |
tinyint |
not null |
1 |
配送费启用 |
|
value_added_fee_enabled |
tinyint |
not null |
1 |
增值服务费启用 |
|
auto_generate_bill |
tinyint |
not null |
1 |
自动生成账单 |
建议索引:uk_owner_service_config(tenant_id,owner_id,deleted)
用途:保存货主收付款、发票、银行账户信息。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
account_name |
varchar(100) |
not null |
账户名称 |
|
|
bank_name |
varchar(100) |
开户行 |
||
|
bank_account_no |
varchar(100) |
银行账号 |
||
|
tax_no |
varchar(80) |
税号 |
||
|
invoice_title |
varchar(150) |
发票抬头 |
||
|
invoice_address |
varchar(255) |
开票地址 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:idx_owner_settlement(tenant_id,owner_id)
用途:货主通过开放接口推送订单、查询库存的应用凭证。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
app_key |
varchar(80) |
not null |
应用 Key |
|
|
app_secret |
varchar(255) |
not null |
应用密钥密文 |
|
|
app_name |
varchar(100) |
应用名称 |
||
|
ip_whitelist |
varchar(500) |
IP 白名单 |
||
|
callback_url |
varchar(255) |
回调地址 |
||
|
enabled |
tinyint |
not null |
1 |
启用状态 |
建议索引:uk_owner_app_key(tenant_id,app_key,deleted)
用途:合同、营业执照、协议等附件。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
file_type |
tinyint |
not null |
1 |
附件类型:1合同,2证照,3协议,9其他 |
|
file_name |
varchar(255) |
not null |
文件名 |
|
|
file_url |
varchar(500) |
not null |
文件地址 |
|
|
file_size |
bigint |
文件大小 |
||
|
upload_user_id |
bigint |
上传人 |
建议索引:idx_owner_file(tenant_id,owner_id,file_type)
用途:记录货主档案、合同、授权、配置变更。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
operation_type |
varchar(50) |
not null |
操作类型 |
|
|
operation_desc |
varchar(255) |
操作说明 |
||
|
before_data |
longtext |
变更前 JSON |
||
|
after_data |
longtext |
变更后 JSON |
||
|
operator_user_id |
bigint |
操作人 |
||
|
operation_time |
datetime |
not null |
CURRENT_TIMESTAMP |
操作时间 |
建议索引:idx_owner_log(tenant_id,owner_id,operation_time)
支持 SPU/SKU、多单位、双单位、批次、保质期、条码和货主商品映射。
用途:树形分类,支持一二级或多级分类。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
parent_id |
bigint |
not null |
0 |
上级分类 ID |
|
category_code |
varchar(50) |
not null |
分类编码 |
|
|
category_name |
varchar(100) |
not null |
分类名称 |
|
|
category_level |
tinyint |
1 |
分类层级 |
|
|
path |
varchar(500) |
分类路径 |
||
|
sort_no |
int |
0 |
排序 |
|
|
icon_url |
varchar(255) |
图标 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_category_code(tenant_id,category_code,deleted); idx_parent(tenant_id,parent_id)
用途:商品品牌资料。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
brand_code |
varchar(50) |
not null |
品牌编码 |
|
|
brand_name |
varchar(100) |
not null |
品牌名称 |
|
|
logo_url |
varchar(255) |
Logo |
||
|
sort_no |
int |
0 |
排序 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_brand_code(tenant_id,brand_code,deleted); uk_brand_name(tenant_id,brand_name,deleted)
用途:统一单位主数据。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
unit_code |
varchar(50) |
not null |
单位编码 |
|
|
unit_name |
varchar(50) |
not null |
单位名称 |
|
|
unit_type |
tinyint |
not null |
1 |
1数量,2重量,3体积,4包装 |
|
decimal_places |
int |
not null |
2 |
小数位 |
|
sort_no |
int |
0 |
排序 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_unit_code(tenant_id,unit_code,deleted); uk_unit_name(tenant_id,unit_name,deleted)
用途:商品主档,不直接代表可交易规格。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_code |
varchar(80) |
not null |
商品编码 |
|
|
goods_name |
varchar(150) |
not null |
商品名称 |
|
|
category_id |
bigint |
not null |
分类 ID |
|
|
brand_id |
bigint |
品牌 ID |
||
|
goods_type |
tinyint |
not null |
1 |
1普通,2生鲜,3冻品,4耗材 |
|
temperature_type |
tinyint |
not null |
1 |
1常温,2冷藏,3冷冻,4恒温 |
|
batch_manage |
tinyint |
not null |
0 |
是否批次管理 |
|
shelf_life_manage |
tinyint |
not null |
0 |
是否保质期管理 |
|
serial_manage |
tinyint |
not null |
0 |
是否序列号管理 |
|
main_image_url |
varchar(255) |
主图 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_goods_code(tenant_id,goods_code,deleted); idx_goods_name(tenant_id,goods_name); idx_category(tenant_id,category_id)
用途:商品规格,可用于采购、库存、销售。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_code |
varchar(80) |
not null |
SKU 编码 |
|
|
sku_name |
varchar(150) |
not null |
SKU 名称 |
|
|
spec |
varchar(150) |
规格 |
||
|
model |
varchar(100) |
型号 |
||
|
default_unit_id |
bigint |
默认单位 |
||
|
inventory_unit_id |
bigint |
库存单位 |
||
|
purchase_unit_id |
bigint |
采购单位 |
||
|
sale_unit_id |
bigint |
销售单位 |
||
|
length |
decimal(18,4) |
长 |
||
|
width |
decimal(18,4) |
宽 |
||
|
height |
decimal(18,4) |
高 |
||
|
volume |
decimal(18,6) |
体积 |
||
|
weight |
decimal(18,4) |
重量 |
||
|
tax_rate |
decimal(8,6) |
税率 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_sku_code(tenant_id,sku_code,deleted); idx_goods_sku(tenant_id,goods_id)
用途:定义商品 SKU 多单位换算,并标记采购、销售、库存单位。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
from_unit_id |
bigint |
not null |
来源单位 |
|
|
to_unit_id |
bigint |
not null |
目标单位 |
|
|
convert_rate |
decimal(18,6) |
not null |
1 |
换算比例,如 1箱=10袋 |
|
is_inventory_unit |
tinyint |
not null |
0 |
是否库存单位 |
|
is_purchase_unit |
tinyint |
not null |
0 |
是否采购单位 |
|
is_sale_unit |
tinyint |
not null |
0 |
是否销售单位 |
|
is_base_unit |
tinyint |
not null |
0 |
是否基础单位 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_sku_unit_relation(tenant_id,sku_id,from_unit_id,to_unit_id,deleted)
用途:支持一品多码、一 SKU 多单位条码。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
单位 ID |
||
|
barcode |
varchar(80) |
not null |
条码 |
|
|
barcode_type |
tinyint |
not null |
1 |
1商品码,2箱码,3自有码 |
|
is_default |
tinyint |
not null |
0 |
是否默认 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_barcode(tenant_id,barcode,deleted); idx_sku_barcode(tenant_id,sku_id)
用途:指定 SKU 批次、生产日期、保质期、出库策略。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
batch_required |
tinyint |
not null |
0 |
是否必填批次 |
|
production_date_required |
tinyint |
not null |
0 |
是否必填生产日期 |
|
expire_date_required |
tinyint |
not null |
0 |
是否必填到期日期 |
|
shelf_life_days |
int |
默认保质期天数 |
||
|
warning_days |
int |
临期预警天数 |
||
|
outbound_rule |
tinyint |
not null |
2 |
1FIFO,2FEFO,3指定批次 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_sku_batch_rule(tenant_id,sku_id,deleted)
用途:商品图片、视频、文件资源。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
SKU ID,可为空 |
||
|
media_type |
tinyint |
not null |
1 |
1图片,2视频,3文件 |
|
media_url |
varchar(500) |
not null |
资源地址 |
|
|
sort_no |
int |
0 |
排序 |
|
|
is_main |
tinyint |
not null |
0 |
是否主图 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:idx_goods_media(tenant_id,goods_id,sku_id)
客户用于销售出库和配送签收;供应商用于采购和到货收货。
用途:货主或供应链公司的下游客户资料。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
所属货主,可为空表示平台客户 |
||
|
customer_code |
varchar(50) |
not null |
客户编码 |
|
|
customer_name |
varchar(150) |
not null |
客户名称 |
|
|
customer_type |
tinyint |
not null |
1 |
1门店,2餐饮,3商超,4个人,9其他 |
|
contact_name |
varchar(50) |
联系人 |
||
|
contact_mobile |
varchar(30) |
联系电话 |
||
|
province |
varchar(50) |
省 |
||
|
city |
varchar(50) |
市 |
||
|
district |
varchar(50) |
区 |
||
|
address |
varchar(255) |
地址 |
||
|
account_period_days |
int |
0 |
账期天数 |
|
|
credit_limit |
decimal(18,2) |
0 |
授信额度 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_customer_code(tenant_id,owner_id,customer_code,deleted); idx_customer_name(tenant_id,customer_name)
用途:客户多收货地址,用于配送路线规划。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
customer_id |
bigint |
not null |
客户 ID |
|
|
owner_id |
bigint |
货主 ID |
||
|
receiver_name |
varchar(50) |
not null |
收货人 |
|
|
receiver_mobile |
varchar(30) |
电话 |
||
|
province |
varchar(50) |
省 |
||
|
city |
varchar(50) |
市 |
||
|
district |
varchar(50) |
区 |
||
|
address |
varchar(255) |
not null |
详细地址 |
|
|
longitude |
decimal(18,6) |
经度 |
||
|
latitude |
decimal(18,6) |
纬度 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认 |
建议索引:idx_customer_address(tenant_id,customer_id)
用途:采购、ASN、收货所需供应商资料。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
supplier_code |
varchar(50) |
not null |
供应商编码 |
|
|
supplier_name |
varchar(150) |
not null |
供应商名称 |
|
|
supplier_type |
tinyint |
1 |
供应商类型 |
|
|
contact_name |
varchar(50) |
联系人 |
||
|
contact_mobile |
varchar(30) |
手机号 |
||
|
tax_no |
varchar(80) |
税号 |
||
|
province |
varchar(50) |
省 |
||
|
city |
varchar(50) |
市 |
||
|
district |
varchar(50) |
区 |
||
|
address |
varchar(255) |
地址 |
||
|
account_period_days |
int |
0 |
账期 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_supplier_code(tenant_id,supplier_code,deleted); idx_supplier_name(tenant_id,supplier_name)
用途:供应商多联系人。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
supplier_id |
bigint |
not null |
供应商 ID |
|
|
contact_name |
varchar(50) |
not null |
联系人 |
|
|
contact_mobile |
varchar(30) |
手机号 |
||
|
|
varchar(100) |
邮箱 |
||
|
position_name |
varchar(80) |
职务 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:idx_supplier_contact(tenant_id,supplier_id)
仓库是作业执行场所,库位是库存最小管理单元。
用途:仓库主体,可为中央仓、前置仓、门店仓、虚拟仓。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_code |
varchar(50) |
not null |
仓库编码 |
|
|
warehouse_name |
varchar(100) |
not null |
仓库名称 |
|
|
warehouse_type |
tinyint |
not null |
1 |
1中央仓,2前置仓,3门店仓,4虚拟仓 |
|
province |
varchar(50) |
省 |
||
|
city |
varchar(50) |
市 |
||
|
district |
varchar(50) |
区 |
||
|
address |
varchar(255) |
地址 |
||
|
manager_user_id |
bigint |
负责人 |
||
|
contact_name |
varchar(50) |
联系人 |
||
|
contact_mobile |
varchar(30) |
电话 |
||
|
longitude |
decimal(18,6) |
经度 |
||
|
latitude |
decimal(18,6) |
纬度 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_warehouse_code(tenant_id,warehouse_code,deleted); idx_warehouse_city(tenant_id,city)
用途:仓库下库区,如常温区、冷藏区、发货区、残次区。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
area_code |
varchar(50) |
not null |
库区编码 |
|
|
area_name |
varchar(100) |
not null |
库区名称 |
|
|
area_type |
tinyint |
not null |
1 |
1存储,2收货,3拣货,4复核,5发货,6残次 |
|
temperature_type |
tinyint |
not null |
1 |
温层 |
|
sort_no |
int |
0 |
排序 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_area_code(tenant_id,warehouse_id,area_code,deleted); idx_area_type(tenant_id,warehouse_id,area_type)
用途:库区内货架定义。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
area_id |
bigint |
not null |
库区 ID |
|
|
shelf_code |
varchar(50) |
not null |
货架编码 |
|
|
shelf_name |
varchar(100) |
货架名称 |
||
|
row_no |
int |
排号 |
||
|
column_no |
int |
列号 |
||
|
layer_count |
int |
层数 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_shelf_code(tenant_id,warehouse_id,shelf_code,deleted); idx_shelf_area(tenant_id,area_id)
用途:库存最小管理单元。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
area_id |
bigint |
not null |
库区 ID |
|
|
shelf_id |
bigint |
货架 ID |
||
|
location_code |
varchar(80) |
not null |
库位编码 |
|
|
location_name |
varchar(100) |
库位名称 |
||
|
location_type |
tinyint |
not null |
1 |
1存储位,2拣货位,3暂存位,4残次位 |
|
temperature_type |
tinyint |
not null |
1 |
温层 |
|
length |
decimal(18,4) |
长 |
||
|
width |
decimal(18,4) |
宽 |
||
|
height |
decimal(18,4) |
高 |
||
|
volume |
decimal(18,6) |
容积 |
||
|
max_weight |
decimal(18,4) |
承重 |
||
|
allow_mixed_goods |
tinyint |
not null |
0 |
允许混放商品 |
|
allow_mixed_batch |
tinyint |
not null |
0 |
允许混放批次 |
|
priority_no |
int |
0 |
推荐优先级 |
|
|
is_locked |
tinyint |
not null |
0 |
是否锁定 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_location_code(tenant_id,warehouse_id,location_code,deleted); idx_area_location(tenant_id,warehouse_id,area_id)
用途:常温、冷藏、冷冻、恒温等温层定义。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
zone_code |
varchar(50) |
not null |
温层编码 |
|
|
zone_name |
varchar(100) |
not null |
温层名称 |
|
|
temperature_type |
tinyint |
not null |
温层类型 |
|
|
min_temperature |
decimal(8,2) |
最低温度 |
||
|
max_temperature |
decimal(8,2) |
最高温度 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_temperature_zone(tenant_id,zone_code,deleted)
用途:收货区、复核区、打包区、发货区等作业区。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
work_area_code |
varchar(50) |
not null |
作业区编码 |
|
|
work_area_name |
varchar(100) |
not null |
作业区名称 |
|
|
work_area_type |
tinyint |
not null |
1收货,2上架,3拣货,4复核,5打包,6发货 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_work_area(tenant_id,warehouse_id,work_area_code,deleted)
用途:上架推荐、拣货推荐、补货策略。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
strategy_code |
varchar(50) |
not null |
策略编码 |
|
|
strategy_name |
varchar(100) |
not null |
策略名称 |
|
|
warehouse_id |
bigint |
仓库 ID |
||
|
strategy_type |
tinyint |
not null |
1 |
1上架,2拣货,3补货 |
|
match_temperature |
tinyint |
not null |
1 |
是否匹配温层 |
|
same_goods_first |
tinyint |
not null |
1 |
同品优先 |
|
same_batch_first |
tinyint |
not null |
1 |
同批次优先 |
|
empty_location_first |
tinyint |
not null |
0 |
空位优先 |
|
enabled |
tinyint |
not null |
1 |
启用 |
建议索引:uk_location_strategy(tenant_id,strategy_code,deleted)
用途:PDA、电子秤、叉车、打印机等仓储设备。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
equipment_code |
varchar(50) |
not null |
设备编码 |
|
|
equipment_name |
varchar(100) |
not null |
设备名称 |
|
|
equipment_type |
tinyint |
not null |
1PDA,2电子秤,3打印机,4叉车,9其他 |
|
|
bind_user_id |
bigint |
绑定人员 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_equipment_code(tenant_id,warehouse_id,equipment_code,deleted)
采购、ASN 到货、收货、质检、入库审核、上架任务组成入库闭环。
用途:采购订单入口,可生成 ASN 和入库单。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
supplier_id |
bigint |
not null |
供应商 ID |
|
|
warehouse_id |
bigint |
not null |
收货仓库 |
|
|
purchase_no |
varchar(50) |
not null |
采购单号 |
|
|
purchase_date |
date |
采购日期 |
||
|
expected_arrive_date |
date |
预计到货日期 |
||
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
bill_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3部分入库,4完成,9作废 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_purchase_no(tenant_id,purchase_no,deleted); idx_purchase_owner(tenant_id,owner_id,warehouse_id)
用途:采购商品明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
purchase_id |
bigint |
not null |
采购订单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
purchase_qty |
decimal(18,4) |
not null |
0 |
采购数量 |
|
received_qty |
decimal(18,4) |
0 |
已收数量 |
|
|
unit_price |
decimal(18,6) |
0 |
单价 |
|
|
amount |
decimal(18,2) |
0 |
金额 |
|
|
tax_rate |
decimal(8,6) |
0 |
税率 |
|
|
tax_amount |
decimal(18,2) |
0 |
税额 |
|
|
total_amount |
decimal(18,2) |
0 |
含税金额 |
|
|
batch_no |
varchar(80) |
指定批次 |
建议索引:idx_purchase_detail(tenant_id,purchase_id); idx_purchase_sku(tenant_id,sku_id)
用途:供应商或货主到货预约通知。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
supplier_id |
bigint |
供应商 ID |
||
|
warehouse_id |
bigint |
not null |
到货仓库 |
|
|
asn_no |
varchar(50) |
not null |
ASN 单号 |
|
|
source_bill_type |
varchar(50) |
来源类型 |
||
|
source_bill_id |
bigint |
来源 ID |
||
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
expected_arrive_time |
datetime |
预计到货时间 |
||
|
carrier_name |
varchar(100) |
承运商 |
||
|
vehicle_no |
varchar(50) |
车牌号 |
||
|
driver_name |
varchar(50) |
司机 |
||
|
driver_mobile |
varchar(30) |
司机电话 |
||
|
bill_status |
tinyint |
not null |
1 |
1待到货,2部分收货,3已收货,9作废 |
建议索引:uk_asn_no(tenant_id,asn_no,deleted); idx_asn_owner(tenant_id,owner_id,warehouse_id)
用途:到货商品明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
asn_id |
bigint |
not null |
ASN ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
expected_qty |
decimal(18,4) |
not null |
0 |
预计到货数量 |
|
received_qty |
decimal(18,4) |
0 |
已收数量 |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
production_date |
date |
生产日期 |
||
|
expire_date |
date |
到期日期 |
建议索引:idx_asn_detail(tenant_id,asn_id)
用途:到货后的实际收货记录,可与 ASN 和入库单关联。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
receipt_no |
varchar(50) |
not null |
收货记录号 |
|
|
asn_id |
bigint |
ASN ID |
||
|
receiver_user_id |
bigint |
收货员 |
||
|
receipt_time |
datetime |
收货时间 |
||
|
package_qty |
decimal(18,4) |
0 |
包装数量 |
|
|
total_qty |
decimal(18,4) |
0 |
收货数量 |
|
|
receipt_status |
tinyint |
not null |
1 |
收货状态 |
建议索引:uk_receipt_no(tenant_id,receipt_no,deleted); idx_receipt_asn(tenant_id,asn_id)
用途:收货质检、抽检、判定。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
source_bill_type |
varchar(50) |
来源单据类型 |
||
|
source_bill_id |
bigint |
来源单据 ID |
||
|
source_detail_id |
bigint |
来源明细 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
check_qty |
decimal(18,4) |
0 |
质检数量 |
|
|
qualified_qty |
decimal(18,4) |
0 |
合格数量 |
|
|
unqualified_qty |
decimal(18,4) |
0 |
不合格数量 |
|
|
check_result |
tinyint |
not null |
1 |
1合格,2不合格,3让步接收 |
|
check_user_id |
bigint |
质检员 |
||
|
check_time |
datetime |
质检时间 |
建议索引:idx_quality_source(tenant_id,source_bill_type,source_bill_id)
用途:入库审核后增加仓库库存、批次库存、成本。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockin_no |
varchar(50) |
not null |
入库单号 |
|
|
stockin_type |
tinyint |
not null |
1 |
1采购,2退货,3调拨,4报溢,5期初 |
|
source_bill_type |
varchar(50) |
来源类型 |
||
|
source_bill_id |
bigint |
来源 ID |
||
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
bill_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3部分上架,4完成,9作废 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
||
|
reverse_audit_user_id |
bigint |
反审核人 |
||
|
reverse_audit_time |
datetime |
反审核时间 |
建议索引:uk_stockin_no(tenant_id,stockin_no,deleted); idx_stockin_owner(tenant_id,owner_id,warehouse_id); idx_stockin_source(tenant_id,source_bill_type,source_bill_id)
用途:入库商品、批次、成本、库位信息。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
stockin_id |
bigint |
not null |
入库单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
production_date |
date |
生产日期 |
||
|
expire_date |
date |
到期日期 |
||
|
stockin_qty |
decimal(18,4) |
not null |
0 |
入库数量 |
|
putaway_qty |
decimal(18,4) |
0 |
已上架数量 |
|
|
unit_price |
decimal(18,6) |
0 |
入库单价 |
|
|
amount |
decimal(18,2) |
0 |
入库金额 |
|
|
quality_status |
tinyint |
1 |
1合格,2不合格,3免检 |
|
|
location_id |
bigint |
推荐库位 ID |
建议索引:idx_stockin_detail(tenant_id,stockin_id); idx_stockin_detail_sku(tenant_id,owner_id,warehouse_id,sku_id)
销售订单、出库单、库存占用、拣货、复核、打包和发货交接。
用途:货主出库指令或销售订单入口。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
customer_id |
bigint |
客户 ID |
||
|
warehouse_id |
bigint |
not null |
发货仓库 |
|
|
order_no |
varchar(50) |
not null |
订单号 |
|
|
order_type |
tinyint |
not null |
1 |
1普通销售,2调拨销售,3电商订单 |
|
order_source |
tinyint |
not null |
1 |
1后台,2货主门户,3接口,4导入 |
|
order_date |
datetime |
下单时间 |
||
|
require_delivery_date |
date |
要求配送日期 |
||
|
receiver_name |
varchar(50) |
收货人 |
||
|
receiver_mobile |
varchar(30) |
收货电话 |
||
|
receiver_address |
varchar(255) |
收货地址 |
||
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
order_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3已出库,4已签收,9作废 |
|
stock_lock_status |
tinyint |
0 |
库存占用状态 |
|
|
delivery_status |
tinyint |
0 |
配送状态 |
建议索引:uk_order_no(tenant_id,order_no,deleted); idx_order_owner(tenant_id,owner_id,warehouse_id); idx_order_customer(tenant_id,customer_id)
用途:订单商品明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
order_id |
bigint |
not null |
订单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
指定批次 |
||
|
order_qty |
decimal(18,4) |
not null |
0 |
下单数量 |
|
locked_qty |
decimal(18,4) |
0 |
占用数量 |
|
|
shipped_qty |
decimal(18,4) |
0 |
已出库数量 |
|
|
unit_price |
decimal(18,6) |
0 |
销售单价 |
|
|
amount |
decimal(18,2) |
0 |
金额 |
建议索引:idx_order_detail(tenant_id,order_id); idx_order_detail_sku(tenant_id,sku_id)
用途:出库审核后扣减库存并结转成本。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
customer_id |
bigint |
客户 ID |
||
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockout_no |
varchar(50) |
not null |
出库单号 |
|
|
stockout_type |
tinyint |
not null |
1 |
1销售,2调拨,3报损,4退货 |
|
source_bill_type |
varchar(50) |
来源单据类型 |
||
|
source_bill_id |
bigint |
来源单据 ID |
||
|
source_bill_no |
varchar(50) |
来源单据号 |
||
|
total_qty |
decimal(18,4) |
0 |
出库总数量 |
|
|
total_amount |
decimal(18,2) |
0 |
出库金额 |
|
|
pick_status |
tinyint |
0 |
拣货状态 |
|
|
review_status |
tinyint |
0 |
复核状态 |
|
|
pack_status |
tinyint |
0 |
打包状态 |
|
|
delivery_status |
tinyint |
0 |
配送状态 |
|
|
bill_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3已发货,4完成,9作废 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_stockout_no(tenant_id,stockout_no,deleted); idx_stockout_owner(tenant_id,owner_id,warehouse_id); idx_stockout_source(tenant_id,source_bill_type,source_bill_id)
用途:记录实际出库批次、库位、成本。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
stockout_id |
bigint |
not null |
出库单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
出库批次 |
||
|
location_id |
bigint |
出库库位 |
||
|
stockout_qty |
decimal(18,4) |
not null |
0 |
应出数量 |
|
picked_qty |
decimal(18,4) |
0 |
已拣数量 |
|
|
reviewed_qty |
decimal(18,4) |
0 |
已复核数量 |
|
|
shipped_qty |
decimal(18,4) |
0 |
已发数量 |
|
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
|
|
cost_amount |
decimal(18,2) |
0 |
成本金额 |
建议索引:idx_stockout_detail(tenant_id,stockout_id); idx_stockout_sku_batch(tenant_id,owner_id,warehouse_id,sku_id,batch_no)
库存按仓库、批次、库位多层维护,并以库存流水作为可信变动依据。
用途:某货主、某仓库、某 SKU 的库存汇总。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
库存单位 |
|
|
stock_qty |
decimal(18,4) |
not null |
0 |
实物库存 |
|
available_qty |
decimal(18,4) |
not null |
0 |
可用库存 |
|
locked_qty |
decimal(18,4) |
not null |
0 |
占用库存 |
|
frozen_qty |
decimal(18,4) |
not null |
0 |
冻结库存 |
|
defective_qty |
decimal(18,4) |
not null |
0 |
残次库存 |
|
in_transit_qty |
decimal(18,4) |
not null |
0 |
在途库存 |
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
|
|
cost_amount |
decimal(18,2) |
0 |
库存金额 |
|
|
last_in_time |
datetime |
最近入库 |
||
|
last_out_time |
datetime |
最近出库 |
建议索引:uk_inv(tenant_id,owner_id,warehouse_id,sku_id,unit_id,deleted); idx_inv_owner_wh(tenant_id,owner_id,warehouse_id)
用途:某货主、仓库、SKU、批次的库存。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
not null |
批次号 |
|
|
production_date |
date |
生产日期 |
||
|
expire_date |
date |
到期日期 |
||
|
stock_qty |
decimal(18,4) |
not null |
0 |
批次库存 |
|
available_qty |
decimal(18,4) |
not null |
0 |
可用库存 |
|
locked_qty |
decimal(18,4) |
not null |
0 |
占用库存 |
|
frozen_qty |
decimal(18,4) |
not null |
0 |
冻结库存 |
|
cost_price |
decimal(18,6) |
0 |
批次成本单价 |
|
|
cost_amount |
decimal(18,2) |
0 |
批次金额 |
建议索引:uk_batch_inv(tenant_id,owner_id,warehouse_id,sku_id,unit_id,batch_no,deleted); idx_expire_date(tenant_id,warehouse_id,expire_date)
用途:最细库存层,支持库位、批次、SKU 维度。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
not null |
库位 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
not null |
批次号 |
|
|
production_date |
date |
生产日期 |
||
|
expire_date |
date |
到期日期 |
||
|
stock_qty |
decimal(18,4) |
not null |
0 |
库位实物库存 |
|
available_qty |
decimal(18,4) |
not null |
0 |
库位可用库存 |
|
locked_qty |
decimal(18,4) |
not null |
0 |
库位占用库存 |
|
frozen_qty |
decimal(18,4) |
not null |
0 |
库位冻结库存 |
建议索引:uk_location_inv(tenant_id,owner_id,warehouse_id,location_id,sku_id,unit_id,batch_no,deleted); idx_location(tenant_id,warehouse_id,location_id)
用途:所有库存变化必须写流水,审核和反审核都要记录。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
flow_no |
varchar(50) |
not null |
流水号 |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
flow_type |
varchar(50) |
not null |
INBOUND、OUTBOUND、STOCKTAKE、LOSS、OVERFLOW、RETURN |
|
|
direction |
tinyint |
not null |
1入库,2出库 |
|
|
before_qty |
decimal(18,4) |
0 |
变动前数量 |
|
|
change_qty |
decimal(18,4) |
not null |
0 |
变动数量 |
|
after_qty |
decimal(18,4) |
0 |
变动后数量 |
|
|
source_bill_type |
varchar(50) |
not null |
来源单据类型 |
|
|
source_bill_id |
bigint |
not null |
来源单据 ID |
|
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
source_detail_id |
bigint |
来源明细 ID |
||
|
posting_key |
varchar(150) |
not null |
幂等键 |
|
|
biz_time |
datetime |
not null |
CURRENT_TIMESTAMP |
业务时间 |
建议索引:uk_posting_key(tenant_id,posting_key); idx_inv_flow_sku(tenant_id,owner_id,warehouse_id,sku_id); idx_source_bill(tenant_id,source_bill_type,source_bill_id)
用途:订单或拣货占用库存。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
lock_qty |
decimal(18,4) |
not null |
0 |
占用数量 |
|
lock_type |
tinyint |
not null |
1 |
1订单占用,2拣货占用 |
|
source_bill_type |
varchar(50) |
来源单据 |
||
|
source_bill_id |
bigint |
来源 ID |
||
|
source_detail_id |
bigint |
来源明细 |
||
|
lock_status |
tinyint |
not null |
1 |
1占用中,2已释放,3已扣减 |
|
expire_time |
datetime |
过期时间 |
建议索引:idx_lock_source(tenant_id,source_bill_type,source_bill_id); idx_lock_sku(tenant_id,owner_id,warehouse_id,sku_id)
用途:盘点、质检、异常、财务冻结库存。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
freeze_qty |
decimal(18,4) |
not null |
0 |
冻结数量 |
|
freeze_type |
tinyint |
not null |
1 |
1盘点,2质检,3异常,4财务 |
|
source_bill_type |
varchar(50) |
来源单据 |
||
|
source_bill_id |
bigint |
来源 ID |
||
|
freeze_status |
tinyint |
not null |
1 |
1冻结中,2已释放 |
建议索引:idx_freeze_source(tenant_id,source_bill_type,source_bill_id); idx_freeze_sku(tenant_id,owner_id,warehouse_id,sku_id)
用途:用于库存日结、仓储费、报表和对账。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
snapshot_date |
date |
not null |
快照日期 |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
stock_qty |
decimal(18,4) |
not null |
0 |
库存数量 |
|
available_qty |
decimal(18,4) |
0 |
可用数量 |
|
|
cost_amount |
decimal(18,2) |
0 |
库存金额 |
建议索引:uk_stock_snapshot(tenant_id,snapshot_date,owner_id,warehouse_id,location_id,sku_id,batch_no,deleted)
上架、拣货、复核、打包、发货、移库等作业任务。
用途:入库审核后生成上架任务。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockin_id |
bigint |
入库单 ID |
||
|
putaway_no |
varchar(50) |
not null |
上架任务号 |
|
|
putaway_user_id |
bigint |
上架员 |
||
|
task_status |
tinyint |
not null |
0 |
0待上架,1上架中,2完成,3异常,9取消 |
|
start_time |
datetime |
开始时间 |
||
|
finish_time |
datetime |
完成时间 |
建议索引:uk_putaway_no(tenant_id,putaway_no,deleted); idx_putaway_stockin(tenant_id,stockin_id)
用途:每个 SKU、批次、库位的上架明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
putaway_task_id |
bigint |
not null |
上架任务 ID |
|
|
stockin_detail_id |
bigint |
入库明细 ID |
||
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
suggest_location_id |
bigint |
推荐库位 |
||
|
actual_location_id |
bigint |
实际库位 |
||
|
should_putaway_qty |
decimal(18,4) |
0 |
应上架 |
|
|
actual_putaway_qty |
decimal(18,4) |
0 |
实上架 |
|
|
task_status |
tinyint |
not null |
0 |
状态 |
建议索引:idx_putaway_detail(tenant_id,putaway_task_id)
用途:多订单生成波次拣货。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
货主 ID,可为空表示混合波次 |
||
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
wave_no |
varchar(50) |
not null |
波次号 |
|
|
wave_type |
tinyint |
not null |
1 |
1按线路,2按客户,3按商品,4按时间 |
|
order_count |
int |
0 |
订单数 |
|
|
sku_count |
int |
0 |
SKU 数 |
|
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
wave_status |
tinyint |
not null |
0 |
0待生成,1拣货中,2完成,9作废 |
|
assign_user_id |
bigint |
分配人 |
||
|
assign_time |
datetime |
分配时间 |
建议索引:uk_wave_no(tenant_id,wave_no,deleted); idx_wave_wh(tenant_id,warehouse_id,wave_status)
用途:按单、批量或波次拣货任务。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
wave_id |
bigint |
波次 ID |
||
|
stockout_id |
bigint |
出库单 ID |
||
|
pick_no |
varchar(50) |
not null |
拣货任务号 |
|
|
pick_type |
tinyint |
not null |
1 |
1按单,2批量,3波次 |
|
picker_user_id |
bigint |
拣货员 |
||
|
start_time |
datetime |
开始时间 |
||
|
finish_time |
datetime |
完成时间 |
||
|
task_status |
tinyint |
not null |
0 |
0待拣,1拣货中,2完成,3异常,9取消 |
建议索引:uk_pick_no(tenant_id,pick_no,deleted); idx_pick_stockout(tenant_id,stockout_id); idx_pick_user(tenant_id,picker_user_id,task_status)
用途:从指定库位和批次拣货。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
pick_task_id |
bigint |
not null |
拣货任务 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockout_detail_id |
bigint |
出库明细 ID |
||
|
location_id |
bigint |
not null |
拣货库位 |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
should_pick_qty |
decimal(18,4) |
not null |
0 |
应拣 |
|
actual_pick_qty |
decimal(18,4) |
0 |
实拣 |
|
|
exception_qty |
decimal(18,4) |
0 |
异常数量 |
|
|
exception_reason |
varchar(255) |
异常原因 |
||
|
task_status |
tinyint |
not null |
0 |
明细状态 |
建议索引:idx_pick_detail(tenant_id,pick_task_id); idx_pick_detail_location(tenant_id,location_id,sku_id)
用途:复核商品、数量、批次,产生差异。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockout_id |
bigint |
not null |
出库单 ID |
|
|
review_no |
varchar(50) |
not null |
复核任务号 |
|
|
reviewer_user_id |
bigint |
复核员 |
||
|
should_qty |
decimal(18,4) |
0 |
应复核 |
|
|
actual_qty |
decimal(18,4) |
0 |
实复核 |
|
|
diff_qty |
decimal(18,4) |
0 |
差异 |
|
|
review_status |
tinyint |
not null |
0 |
0待复核,1复核中,2完成,3异常 |
建议索引:uk_review_no(tenant_id,review_no,deleted); idx_review_stockout(tenant_id,stockout_id)
用途:包裹、重量、体积、耗材记录。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stockout_id |
bigint |
not null |
出库单 ID |
|
|
pack_no |
varchar(50) |
not null |
打包任务号 |
|
|
package_count |
int |
0 |
包裹数 |
|
|
total_weight |
decimal(18,4) |
0 |
总重量 |
|
|
total_volume |
decimal(18,6) |
0 |
总体积 |
|
|
material_amount |
decimal(18,2) |
0 |
耗材金额 |
|
|
pack_user_id |
bigint |
打包人 |
||
|
pack_time |
datetime |
打包时间 |
||
|
pack_status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_pack_no(tenant_id,pack_no,deleted); idx_pack_stockout(tenant_id,stockout_id)
用途:仓库与配送、司机或承运商交接。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
handover_no |
varchar(50) |
not null |
交接单号 |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
owner_id |
bigint |
货主 ID |
||
|
stockout_id |
bigint |
出库单 ID |
||
|
delivery_id |
bigint |
配送单 ID |
||
|
handover_user_id |
bigint |
交接人 |
||
|
receiver_user_id |
bigint |
接收人 |
||
|
handover_time |
datetime |
交接时间 |
||
|
package_count |
int |
0 |
包裹数 |
|
|
handover_status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_handover_no(tenant_id,handover_no,deleted)
用途:库位之间移动,库存总量不变,库位库存变化。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
move_no |
varchar(50) |
not null |
移库单号 |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
from_location_id |
bigint |
not null |
原库位 |
|
|
to_location_id |
bigint |
not null |
目标库位 |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次 |
||
|
move_qty |
decimal(18,4) |
not null |
0 |
移库数量 |
|
move_user_id |
bigint |
移库人 |
||
|
move_status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_move_no(tenant_id,move_no,deleted); idx_move_location(tenant_id,warehouse_id,from_location_id,to_location_id)
支持盘点自动或手动生成报损报溢,报损生成出库,报溢生成入库。
用途:盘点单审核后生成差异处理链路。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
stocktake_no |
varchar(50) |
not null |
盘点单号 |
|
|
stocktake_type |
tinyint |
not null |
1 |
1全仓,2分类,3库位,4动态,5循环 |
|
stocktake_mode |
tinyint |
not null |
1 |
1明盘,2盲盘 |
|
freeze_stock |
tinyint |
not null |
1 |
是否冻结盘点范围 |
|
auto_generate_loss_overflow |
tinyint |
not null |
1 |
自动生成损溢单 |
|
auto_audit_loss_overflow |
tinyint |
not null |
0 |
自动审核损溢单 |
|
auto_generate_inout |
tinyint |
not null |
1 |
自动生成出入库 |
|
auto_audit_inout |
tinyint |
not null |
0 |
自动审核出入库 |
|
bill_status |
tinyint |
not null |
0 |
0草稿,1盘点中,2待审,3已审,4完成,9作废 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_stocktake_no(tenant_id,stocktake_no,deleted); idx_stocktake_owner(tenant_id,owner_id,warehouse_id)
用途:系统数量、实盘数量、差异数量。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
stocktake_id |
bigint |
not null |
盘点单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
system_qty |
decimal(18,4) |
0 |
系统数量 |
|
|
actual_qty |
decimal(18,4) |
0 |
实盘数量 |
|
|
diff_qty |
decimal(18,4) |
0 |
差异数量 |
|
|
diff_type |
tinyint |
0 |
0无差异,1盘盈,2盘亏 |
|
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
|
|
diff_amount |
decimal(18,2) |
0 |
差异金额 |
|
|
handle_status |
tinyint |
0 |
处理状态 |
建议索引:idx_stocktake_detail(tenant_id,stocktake_id); idx_stocktake_sku(tenant_id,sku_id,batch_no)
用途:盘亏生成报损,盘盈生成报溢。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
bill_no |
varchar(50) |
not null |
损溢单号 |
|
|
bill_type |
tinyint |
not null |
1报损,2报溢 |
|
|
source_bill_type |
varchar(50) |
来源单据类型 |
||
|
source_bill_id |
bigint |
来源单据 ID |
||
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
generated_stock_bill |
tinyint |
not null |
0 |
是否生成出入库单 |
|
stock_bill_id |
bigint |
关联出/入库单 ID |
||
|
bill_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3完成,9作废 |
建议索引:uk_loss_overflow_no(tenant_id,bill_no,deleted); idx_loss_source(tenant_id,source_bill_type,source_bill_id)
用途:损溢商品明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
bill_id |
bigint |
not null |
损溢单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
location_id |
bigint |
库位 ID |
||
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次 |
||
|
change_qty |
decimal(18,4) |
not null |
0 |
损溢数量 |
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
|
|
amount |
decimal(18,2) |
0 |
金额 |
|
|
reason |
varchar(255) |
原因 |
建议索引:idx_loss_detail(tenant_id,bill_id)
用途:仓间、库区、库位调拨。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
transfer_no |
varchar(50) |
not null |
调拨单号 |
|
|
from_warehouse_id |
bigint |
not null |
调出仓库 |
|
|
to_warehouse_id |
bigint |
not null |
调入仓库 |
|
|
transfer_type |
tinyint |
not null |
1 |
1仓间,2库区,3库位 |
|
total_qty |
decimal(18,4) |
0 |
总数量 |
|
|
out_stockout_id |
bigint |
调拨出库单 |
||
|
in_stockin_id |
bigint |
调拨入库单 |
||
|
bill_status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_transfer_no(tenant_id,transfer_no,deleted); idx_transfer_wh(tenant_id,from_warehouse_id,to_warehouse_id)
用途:调拨商品明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
transfer_id |
bigint |
not null |
调拨单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次 |
||
|
from_location_id |
bigint |
调出库位 |
||
|
to_location_id |
bigint |
调入库位 |
||
|
transfer_qty |
decimal(18,4) |
not null |
0 |
调拨数量 |
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
建议索引:idx_transfer_detail(tenant_id,transfer_id)
用途:客户退货、拒收、错发、质量退货。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
customer_id |
bigint |
客户 ID |
||
|
warehouse_id |
bigint |
not null |
退货仓库 |
|
|
return_no |
varchar(50) |
not null |
退货单号 |
|
|
return_type |
tinyint |
not null |
1 |
1客户退货,2配送拒收,3质量退货,4错发退货 |
|
source_bill_type |
varchar(50) |
来源单据类型 |
||
|
source_bill_id |
bigint |
来源单据 ID |
||
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
total_qty |
decimal(18,4) |
0 |
退货数量 |
|
|
return_reason |
varchar(500) |
退货原因 |
||
|
stockin_id |
bigint |
退货入库单 |
||
|
bill_status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_return_no(tenant_id,return_no,deleted); idx_return_source(tenant_id,source_bill_type,source_bill_id)
用途:退货商品明细和良残判定。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
return_id |
bigint |
not null |
退货单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次 |
||
|
return_qty |
decimal(18,4) |
not null |
0 |
退货数量 |
|
good_qty |
decimal(18,4) |
0 |
良品数量 |
|
|
defective_qty |
decimal(18,4) |
0 |
残次数量 |
|
|
return_reason |
varchar(255) |
原因 |
建议索引:idx_return_detail(tenant_id,return_id)
仓配一体:车辆、司机、路线、配送单、装车、签收、异常。
用途:车辆档案,包含载重、容积和温层。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
vehicle_no |
varchar(50) |
not null |
车牌号 |
|
|
vehicle_type |
tinyint |
not null |
1 |
1面包车,2厢货,3冷藏车,4冷冻车 |
|
driver_id |
bigint |
默认司机 |
||
|
max_weight |
decimal(18,4) |
最大载重 |
||
|
max_volume |
decimal(18,6) |
最大容积 |
||
|
temperature_type |
tinyint |
1 |
支持温层 |
|
|
status |
tinyint |
not null |
1 |
0停用,1启用,2维修 |
建议索引:uk_vehicle_no(tenant_id,vehicle_no,deleted)
用途:司机档案,可绑定系统用户。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
driver_code |
varchar(50) |
not null |
司机编码 |
|
|
driver_name |
varchar(50) |
not null |
司机姓名 |
|
|
mobile |
varchar(30) |
手机号 |
||
|
id_card_no |
varchar(50) |
身份证号 |
||
|
license_no |
varchar(80) |
驾驶证号 |
||
|
user_id |
bigint |
关联系统用户 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_driver_code(tenant_id,driver_code,deleted); idx_driver_mobile(tenant_id,mobile)
用途:固定路线或临时路线。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
route_code |
varchar(50) |
not null |
路线编码 |
|
|
route_name |
varchar(100) |
not null |
路线名称 |
|
|
warehouse_id |
bigint |
not null |
起始仓库 |
|
|
route_type |
tinyint |
not null |
1 |
1固定,2临时 |
|
start_address |
varchar(255) |
起点地址 |
||
|
end_address |
varchar(255) |
终点地址 |
||
|
distance_km |
decimal(18,4) |
距离公里 |
||
|
estimated_minutes |
int |
预计耗时 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_route_code(tenant_id,route_code,deleted); idx_route_wh(tenant_id,warehouse_id)
用途:出库后生成配送任务,司机执行签收。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
发货仓库 |
|
|
delivery_no |
varchar(50) |
not null |
配送单号 |
|
|
stockout_id |
bigint |
出库单 ID |
||
|
customer_id |
bigint |
客户 ID |
||
|
route_id |
bigint |
路线 ID |
||
|
vehicle_id |
bigint |
车辆 ID |
||
|
driver_id |
bigint |
司机 ID |
||
|
receiver_name |
varchar(50) |
收货人 |
||
|
receiver_mobile |
varchar(30) |
电话 |
||
|
receiver_address |
varchar(255) |
地址 |
||
|
planned_delivery_time |
datetime |
计划配送 |
||
|
depart_time |
datetime |
发车时间 |
||
|
sign_time |
datetime |
签收时间 |
||
|
delivery_status |
tinyint |
not null |
0 |
0待装车,1待发车,2配送中,3已签收,4拒收,9取消 |
建议索引:uk_delivery_no(tenant_id,delivery_no,deleted); idx_delivery_driver(tenant_id,driver_id,delivery_status); idx_delivery_stockout(tenant_id,stockout_id)
用途:配送关联出库明细或订单明细。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
delivery_id |
bigint |
not null |
配送单 ID |
|
|
stockout_id |
bigint |
出库单 ID |
||
|
stockout_detail_id |
bigint |
出库明细 ID |
||
|
owner_id |
bigint |
not null |
货主 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
delivery_qty |
decimal(18,4) |
0 |
配送数量 |
|
|
sign_qty |
decimal(18,4) |
0 |
签收数量 |
|
|
reject_qty |
decimal(18,4) |
0 |
拒收数量 |
建议索引:idx_delivery_detail(tenant_id,delivery_id)
用途:出库包裹或商品装车确认。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
delivery_id |
bigint |
not null |
配送单 ID |
|
|
vehicle_id |
bigint |
车辆 ID |
||
|
driver_id |
bigint |
司机 ID |
||
|
package_code |
varchar(80) |
包裹码 |
||
|
stockout_id |
bigint |
出库单 ID |
||
|
load_qty |
decimal(18,4) |
0 |
装车数量 |
|
|
load_user_id |
bigint |
装车人 |
||
|
load_time |
datetime |
装车时间 |
建议索引:idx_loading_delivery(tenant_id,delivery_id)
用途:客户签收、部分签收、拒收凭证。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
delivery_id |
bigint |
not null |
配送单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
sign_type |
tinyint |
not null |
1 |
1正常签收,2部分签收,3拒收 |
|
sign_name |
varchar(50) |
签收人 |
||
|
sign_mobile |
varchar(30) |
电话 |
||
|
sign_time |
datetime |
签收时间 |
||
|
sign_address |
varchar(255) |
签收地址 |
||
|
photo_urls |
text |
照片 |
||
|
video_urls |
text |
视频 |
||
|
reject_reason |
varchar(500) |
拒收原因 |
||
|
longitude |
decimal(18,6) |
经度 |
||
|
latitude |
decimal(18,6) |
纬度 |
建议索引:idx_sign_delivery(tenant_id,delivery_id); idx_sign_time(tenant_id,sign_time)
用途:配送过程中异常反馈。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
delivery_id |
bigint |
not null |
配送单 ID |
|
|
exception_type |
tinyint |
not null |
1客户不在,2拒收,3破损,4延误,9其他 |
|
|
exception_desc |
varchar(500) |
异常说明 |
||
|
photo_urls |
text |
照片 |
||
|
report_user_id |
bigint |
上报人 |
||
|
report_time |
datetime |
上报时间 |
||
|
handle_status |
tinyint |
not null |
0 |
0待处理,1已处理 |
建议索引:idx_tms_exception(tenant_id,delivery_id,handle_status)
成本中心支持移动加权、FIFO、标准成本,并记录成本流水。
用途:当前 SKU 在仓库的库存成本汇总。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
cost_method |
tinyint |
not null |
1 |
1移动加权,2FIFO,3标准成本 |
|
stock_qty |
decimal(18,4) |
0 |
库存数量 |
|
|
cost_price |
decimal(18,6) |
0 |
成本单价 |
|
|
cost_amount |
decimal(18,2) |
0 |
库存金额 |
|
|
last_calc_time |
datetime |
最近计算时间 |
建议索引:uk_cost(tenant_id,owner_id,warehouse_id,sku_id,unit_id,deleted)
用途:FIFO 或批次核算时使用。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
not null |
批次号 |
|
|
stock_qty |
decimal(18,4) |
0 |
批次库存 |
|
|
cost_price |
decimal(18,6) |
0 |
批次成本 |
|
|
cost_amount |
decimal(18,2) |
0 |
批次金额 |
建议索引:uk_batch_cost(tenant_id,owner_id,warehouse_id,sku_id,unit_id,batch_no,deleted)
用途:所有成本变化写流水,和库存流水保持一致。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
flow_no |
varchar(50) |
not null |
成本流水号 |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次号 |
||
|
source_type |
tinyint |
not null |
1采购入库,2销售出库,3盘点,4报损,5报溢,6调拨,7退货 |
|
|
source_bill_type |
varchar(50) |
not null |
来源单据类型 |
|
|
source_bill_id |
bigint |
not null |
来源 ID |
|
|
source_detail_id |
bigint |
来源明细 |
||
|
direction |
tinyint |
not null |
1入库成本,2出库成本 |
|
|
before_qty |
decimal(18,4) |
0 |
变动前数量 |
|
|
change_qty |
decimal(18,4) |
0 |
变动数量 |
|
|
after_qty |
decimal(18,4) |
0 |
变动后数量 |
|
|
before_cost_price |
decimal(18,6) |
0 |
变动前成本 |
|
|
change_amount |
decimal(18,2) |
0 |
变动金额 |
|
|
after_cost_price |
decimal(18,6) |
0 |
变动后成本 |
|
|
calc_method |
tinyint |
计算方法 |
||
|
posting_key |
varchar(150) |
not null |
幂等键 |
建议索引:uk_cost_posting_key(tenant_id,posting_key); idx_cost_source(tenant_id,source_bill_type,source_bill_id); idx_cost_sku(tenant_id,owner_id,warehouse_id,sku_id)
用途:用于异常回滚、历史成本重算。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
task_no |
varchar(50) |
not null |
任务编号 |
|
|
owner_id |
bigint |
货主 ID |
||
|
warehouse_id |
bigint |
仓库 ID |
||
|
sku_id |
bigint |
SKU ID |
||
|
begin_date |
date |
开始日期 |
||
|
end_date |
date |
结束日期 |
||
|
task_status |
tinyint |
not null |
0 |
0待处理,1处理中,2成功,3失败 |
|
fail_reason |
varchar(500) |
失败原因 |
建议索引:uk_cost_rebuild_task(tenant_id,task_no,deleted)
用途:库存、成本不一致或计算失败记录。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
exception_no |
varchar(50) |
not null |
异常编号 |
|
|
owner_id |
bigint |
货主 ID |
||
|
warehouse_id |
bigint |
仓库 ID |
||
|
sku_id |
bigint |
SKU ID |
||
|
exception_type |
tinyint |
not null |
异常类型 |
|
|
exception_desc |
varchar(500) |
异常说明 |
||
|
handle_status |
tinyint |
not null |
0 |
0待处理,1已处理 |
|
handle_user_id |
bigint |
处理人 |
||
|
handle_time |
datetime |
处理时间 |
建议索引:uk_cost_exception_no(tenant_id,exception_no,deleted); idx_cost_exception_status(tenant_id,handle_status)
费用从计费事件产生,经过规则匹配生成费用明细,再汇总货主账单。
用途:仓储费、入库费、出库费、配送费、增值服务费等。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
fee_code |
varchar(50) |
not null |
费用项目编码 |
|
|
fee_name |
varchar(100) |
not null |
费用项目名称 |
|
|
fee_category |
tinyint |
not null |
1仓储,2入库,3出库,4配送,5增值,6退货,7耗材 |
|
|
charge_direction |
tinyint |
not null |
1 |
1应收,2应付 |
|
default_unit |
varchar(30) |
默认计费单位 |
||
|
tax_rate |
decimal(8,6) |
0 |
税率 |
|
|
enabled |
tinyint |
not null |
1 |
是否启用 |
|
sort_no |
int |
0 |
排序 |
建议索引:uk_fee_code(tenant_id,fee_code,deleted)
用途:多个费用项目和规则组合成一个方案。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
scheme_code |
varchar(50) |
not null |
方案编码 |
|
|
scheme_name |
varchar(100) |
not null |
方案名称 |
|
|
scheme_type |
tinyint |
not null |
3 |
1仓储,2配送,3综合 |
|
effective_date |
date |
生效日期 |
||
|
expire_date |
date |
失效日期 |
||
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_fee_scheme_code(tenant_id,scheme_code,deleted)
用途:方案中的费用项目及对应规则。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
scheme_id |
bigint |
not null |
方案 ID |
|
|
fee_item_id |
bigint |
not null |
费用项目 ID |
|
|
billing_rule_id |
bigint |
计费规则 ID |
||
|
required_flag |
tinyint |
not null |
1 |
是否必算 |
|
enabled |
tinyint |
not null |
1 |
是否启用 |
建议索引:uk_fee_scheme_item(tenant_id,scheme_id,fee_item_id,deleted)
用途:费用计算核心规则,支持固定价、阶梯价、区间价、公式价。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
rule_code |
varchar(50) |
not null |
规则编码 |
|
|
rule_name |
varchar(100) |
not null |
规则名称 |
|
|
fee_item_id |
bigint |
not null |
费用项目 ID |
|
|
billing_method |
tinyint |
not null |
1 |
1按单,2按件,3按箱,4按重量,5按体积,6按天,7按距离 |
|
price_type |
tinyint |
not null |
1 |
1固定价,2阶梯价,3区间价,4公式价 |
|
base_price |
decimal(18,6) |
0 |
基础单价 |
|
|
min_amount |
decimal(18,2) |
0 |
最低收费 |
|
|
max_amount |
decimal(18,2) |
最高收费 |
||
|
free_qty |
decimal(18,4) |
0 |
免费数量 |
|
|
free_days |
int |
0 |
免费天数 |
|
|
formula |
varchar(500) |
公式表达式 |
||
|
rounding_rule |
tinyint |
1 |
舍入规则 |
|
|
priority |
int |
100 |
优先级 |
|
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_fee_rule_code(tenant_id,rule_code,deleted); idx_fee_rule_item(tenant_id,fee_item_id,status)
用途:按货主、仓库、温层、商品分类、距离、重量等条件匹配规则。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
rule_id |
bigint |
not null |
规则 ID |
|
|
condition_field |
varchar(80) |
not null |
条件字段,如 owner_id、warehouse_id、temperature_type |
|
|
operator |
varchar(20) |
not null |
= |
操作符:=、in、between、>=、<= |
|
condition_value |
varchar(500) |
not null |
条件值 |
|
|
sort_no |
int |
0 |
排序 |
建议索引:idx_fee_rule_condition(tenant_id,rule_id)
用途:数量、重量、体积、距离、金额阶梯。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
rule_id |
bigint |
not null |
规则 ID |
|
|
tier_type |
tinyint |
not null |
1 |
1数量,2重量,3体积,4距离,5金额 |
|
start_value |
decimal(18,4) |
not null |
0 |
起始值 |
|
end_value |
decimal(18,4) |
结束值 |
||
|
unit_price |
decimal(18,6) |
0 |
单价 |
|
|
fixed_amount |
decimal(18,2) |
0 |
固定金额 |
|
|
calc_mode |
tinyint |
not null |
1 |
1全量按档,2分段累进 |
建议索引:idx_fee_price_tier(tenant_id,rule_id,tier_type,start_value)
用途:业务作业触发计费事件,计费引擎消费。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
仓库 ID |
||
|
event_no |
varchar(50) |
not null |
事件编号 |
|
|
event_type |
varchar(50) |
not null |
INBOUND、OUTBOUND、STORAGE、DELIVERY、RETURN |
|
|
source_bill_type |
varchar(50) |
not null |
来源单据类型 |
|
|
source_bill_id |
bigint |
not null |
来源 ID |
|
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
source_detail_id |
bigint |
来源明细 |
||
|
event_time |
datetime |
not null |
CURRENT_TIMESTAMP |
事件时间 |
|
billing_status |
tinyint |
not null |
0 |
0未计费,1已计费,2失败,3已冲红 |
|
idempotent_key |
varchar(150) |
not null |
幂等键 |
|
|
fail_reason |
varchar(500) |
失败原因 |
建议索引:uk_billing_event_key(tenant_id,idempotent_key); idx_billing_event_status(tenant_id,billing_status,event_time)
用途:每一笔业务费用记录,可追溯来源单据和规则。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
仓库 ID |
||
|
billing_event_id |
bigint |
计费事件 ID |
||
|
fee_item_id |
bigint |
not null |
费用项目 ID |
|
|
fee_item_name |
varchar(100) |
费用项目名称 |
||
|
source_bill_type |
varchar(50) |
来源类型 |
||
|
source_bill_id |
bigint |
来源 ID |
||
|
source_bill_no |
varchar(50) |
来源单号 |
||
|
billing_date |
date |
not null |
计费日期 |
|
|
billing_qty |
decimal(18,4) |
0 |
计费数量 |
|
|
billing_unit |
varchar(30) |
计费单位 |
||
|
unit_price |
decimal(18,6) |
0 |
单价 |
|
|
amount |
decimal(18,2) |
0 |
金额 |
|
|
discount_amount |
decimal(18,2) |
0 |
优惠金额 |
|
|
tax_rate |
decimal(8,6) |
0 |
税率 |
|
|
tax_amount |
decimal(18,2) |
0 |
税额 |
|
|
total_amount |
decimal(18,2) |
0 |
含税金额 |
|
|
rule_id |
bigint |
命中规则 |
||
|
calculation_desc |
varchar(500) |
计算说明 |
||
|
status |
tinyint |
not null |
1 |
1正常,2已调整,3已冲红 |
|
bill_id |
bigint |
所属账单 |
||
|
idempotent_key |
varchar(150) |
幂等键 |
建议索引:uk_fee_detail_key(tenant_id,idempotent_key); idx_fee_detail_owner_date(tenant_id,owner_id,billing_date); idx_fee_detail_bill(tenant_id,bill_id)
用途:仓储费按日库存快照计算。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
warehouse_id |
bigint |
not null |
仓库 ID |
|
|
snapshot_date |
date |
not null |
快照日期 |
|
|
goods_id |
bigint |
not null |
商品 ID |
|
|
sku_id |
bigint |
not null |
SKU ID |
|
|
unit_id |
bigint |
not null |
单位 ID |
|
|
batch_no |
varchar(80) |
批次 |
||
|
temperature_type |
tinyint |
1 |
温层 |
|
|
stock_qty |
decimal(18,4) |
0 |
库存数量 |
|
|
weight |
decimal(18,4) |
0 |
重量 |
|
|
volume |
decimal(18,6) |
0 |
体积 |
|
|
pallet_qty |
decimal(18,4) |
0 |
托盘数 |
|
|
location_count |
int |
0 |
占用库位数 |
|
|
storage_days |
int |
1 |
存储天数 |
|
|
fee_generated |
tinyint |
not null |
0 |
是否已生成费用 |
建议索引:uk_fee_storage_snapshot(tenant_id,snapshot_date,owner_id,warehouse_id,sku_id,batch_no,deleted); idx_fee_snapshot_generate(tenant_id,fee_generated,snapshot_date)
用途:费用减免、补收、冲红、手工费用。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
adjustment_no |
varchar(50) |
not null |
调整单号 |
|
|
adjustment_type |
tinyint |
not null |
1减免,2补收,3冲红,4手工费用 |
|
|
related_fee_detail_id |
bigint |
关联费用明细 |
||
|
fee_item_id |
bigint |
费用项目 |
||
|
adjustment_amount |
decimal(18,2) |
not null |
0 |
调整金额 |
|
reason |
varchar(500) |
调整原因 |
||
|
status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3作废 |
|
audit_user_id |
bigint |
审核人 |
||
|
audit_time |
datetime |
审核时间 |
建议索引:uk_fee_adjustment_no(tenant_id,adjustment_no,deleted); idx_adjust_owner(tenant_id,owner_id,status)
用途:按账期汇总费用明细,货主确认后生成应收。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
not null |
货主 ID |
|
|
bill_no |
varchar(50) |
not null |
账单编号 |
|
|
bill_name |
varchar(150) |
账单名称 |
||
|
bill_period_start |
date |
not null |
账期开始 |
|
|
bill_period_end |
date |
not null |
账期结束 |
|
|
settle_cycle |
tinyint |
4 |
结算周期 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
discount_amount |
decimal(18,2) |
0 |
优惠金额 |
|
|
tax_amount |
decimal(18,2) |
0 |
税额 |
|
|
payable_amount |
decimal(18,2) |
0 |
应收金额 |
|
|
received_amount |
decimal(18,2) |
0 |
已收金额 |
|
|
unpaid_amount |
decimal(18,2) |
0 |
未收金额 |
|
|
bill_status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3待确认,4已确认,5已生成应收,6已结清,9作废 |
|
confirm_status |
tinyint |
0 |
货主确认状态 |
|
|
confirm_time |
datetime |
确认时间 |
||
|
due_date |
date |
应收日期 |
建议索引:uk_fee_owner_bill_no(tenant_id,bill_no,deleted); idx_fee_owner_bill_period(tenant_id,owner_id,bill_period_start,bill_period_end)
用途:账单内费用明细快照。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
bill_id |
bigint |
not null |
账单 ID |
|
|
fee_detail_id |
bigint |
not null |
费用明细 ID |
|
|
fee_item_id |
bigint |
not null |
费用项目 ID |
|
|
fee_item_name |
varchar(100) |
费用名称 |
||
|
source_bill_no |
varchar(50) |
来源业务单号 |
||
|
billing_date |
date |
计费日期 |
||
|
billing_qty |
decimal(18,4) |
0 |
计费数量 |
|
|
unit_price |
decimal(18,6) |
0 |
单价 |
|
|
amount |
decimal(18,2) |
0 |
金额 |
|
|
tax_amount |
decimal(18,2) |
0 |
税额 |
|
|
total_amount |
decimal(18,2) |
0 |
含税金额 |
|
|
calculation_desc |
varchar(500) |
计算说明 |
建议索引:idx_fee_bill_detail(tenant_id,bill_id); uk_fee_bill_detail(tenant_id,bill_id,fee_detail_id,deleted)
用途:货主对账单提出异议及处理结果。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
bill_id |
bigint |
not null |
账单 ID |
|
|
owner_id |
bigint |
not null |
货主 ID |
|
|
dispute_no |
varchar(50) |
not null |
异议单号 |
|
|
dispute_type |
tinyint |
异议类型 |
||
|
dispute_desc |
varchar(500) |
异议说明 |
||
|
dispute_amount |
decimal(18,2) |
0 |
争议金额 |
|
|
status |
tinyint |
not null |
1 |
1待处理,2已处理,3已驳回 |
|
handle_user_id |
bigint |
处理人 |
||
|
handle_result |
varchar(500) |
处理结果 |
||
|
handle_time |
datetime |
处理时间 |
建议索引:uk_dispute_no(tenant_id,dispute_no,deleted); idx_dispute_bill(tenant_id,bill_id,status)
货主账单确认后生成应收,收款后核销,应支持发票和对账单。
用途:货主或客户应收账款。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
货主 ID |
||
|
customer_id |
bigint |
客户 ID,可为空 |
||
|
source_bill_type |
varchar(50) |
not null |
来源单据类型 |
|
|
source_bill_id |
bigint |
not null |
来源账单 ID |
|
|
receivable_no |
varchar(50) |
not null |
应收单号 |
|
|
receivable_amount |
decimal(18,2) |
not null |
0 |
应收金额 |
|
received_amount |
decimal(18,2) |
0 |
已收金额 |
|
|
unpaid_amount |
decimal(18,2) |
0 |
未收金额 |
|
|
due_date |
date |
应收日期 |
||
|
overdue_days |
int |
0 |
逾期天数 |
|
|
status |
tinyint |
not null |
1 |
1待收,2部分收款,3已结清,4逾期,9作废 |
建议索引:uk_receivable_no(tenant_id,receivable_no,deleted); idx_receivable_owner(tenant_id,owner_id,status,due_date)
用途:记录实际收款。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
owner_id |
bigint |
货主 ID |
||
|
receipt_no |
varchar(50) |
not null |
收款单号 |
|
|
receipt_date |
date |
not null |
收款日期 |
|
|
receipt_amount |
decimal(18,2) |
not null |
0 |
收款金额 |
|
pay_method |
tinyint |
1现金,2银行,3微信,4支付宝,5支票 |
||
|
bank_account |
varchar(100) |
收款账户 |
||
|
payer_name |
varchar(100) |
付款方 |
||
|
status |
tinyint |
not null |
0 |
0草稿,1待审,2已审,3已核销,9作废 |
建议索引:uk_receipt_no(tenant_id,receipt_no,deleted); idx_receipt_owner(tenant_id,owner_id,receipt_date)
用途:收款单与应收单之间的核销关系。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
receipt_id |
bigint |
not null |
收款单 ID |
|
|
receivable_id |
bigint |
not null |
应收单 ID |
|
|
owner_id |
bigint |
货主 ID |
||
|
writeoff_amount |
decimal(18,2) |
not null |
0 |
核销金额 |
|
writeoff_time |
datetime |
not null |
CURRENT_TIMESTAMP |
核销时间 |
|
writeoff_user_id |
bigint |
核销人 |
||
|
writeoff_remark |
varchar(500) |
核销说明 |
建议索引:idx_writeoff_receipt(tenant_id,receipt_id); idx_writeoff_receivable(tenant_id,receivable_id)
用途:开票申请、开票记录和发票状态。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
invoice_no |
varchar(80) |
发票号码 |
||
|
source_bill_type |
varchar(50) |
来源单据类型 |
||
|
source_bill_id |
bigint |
来源单据 ID |
||
|
owner_id |
bigint |
货主 ID |
||
|
invoice_title |
varchar(150) |
发票抬头 |
||
|
tax_no |
varchar(80) |
税号 |
||
|
invoice_amount |
decimal(18,2) |
0 |
开票金额 |
|
|
invoice_type |
tinyint |
1 |
1普票,2专票 |
|
|
invoice_status |
tinyint |
not null |
0 |
0待开,1已开,2作废 |
|
invoice_date |
date |
开票日期 |
建议索引:idx_invoice_source(tenant_id,source_bill_type,source_bill_id); idx_invoice_owner(tenant_id,owner_id,invoice_status)
用途:客户、供应商或货主对账单。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
statement_no |
varchar(50) |
not null |
对账单号 |
|
|
statement_type |
tinyint |
not null |
1 |
1货主,2客户,3供应商 |
|
owner_id |
bigint |
货主 ID |
||
|
customer_id |
bigint |
客户 ID |
||
|
supplier_id |
bigint |
供应商 ID |
||
|
period_start |
date |
not null |
期间开始 |
|
|
period_end |
date |
not null |
期间结束 |
|
|
total_amount |
decimal(18,2) |
0 |
总金额 |
|
|
confirm_status |
tinyint |
not null |
0 |
确认状态 |
|
status |
tinyint |
not null |
0 |
状态 |
建议索引:uk_statement_no(tenant_id,statement_no,deleted); idx_statement_period(tenant_id,statement_type,period_start,period_end)
支撑系统运营、安全审计、消息提醒、打印和开放接口。
用途:站内信、短信、邮件、企业微信、WebSocket 模板。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
template_code |
varchar(80) |
not null |
模板编码 |
|
|
template_name |
varchar(100) |
not null |
模板名称 |
|
|
scene_code |
varchar(80) |
not null |
消息场景 |
|
|
channel_type |
tinyint |
not null |
1 |
1站内信,2短信,3邮件,4企业微信,5WebSocket |
|
title_template |
varchar(255) |
标题模板 |
||
|
content_template |
text |
内容模板 |
||
|
enabled |
tinyint |
not null |
1 |
是否启用 |
建议索引:uk_msg_template(tenant_id,template_code,channel_type,deleted)
用途:用户站内信和待办。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
receiver_user_id |
bigint |
not null |
接收人 |
|
|
title |
varchar(255) |
not null |
标题 |
|
|
content |
text |
内容 |
||
|
notice_type |
tinyint |
消息类型 |
||
|
biz_type |
varchar(50) |
业务类型 |
||
|
biz_id |
bigint |
业务 ID |
||
|
read_status |
tinyint |
not null |
0 |
0未读,1已读 |
|
read_time |
datetime |
阅读时间 |
建议索引:idx_notice_receiver(tenant_id,receiver_user_id,read_status,create_time)
用途:异步发送、重试、死信。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
task_no |
varchar(50) |
not null |
任务编号 |
|
|
template_code |
varchar(80) |
模板编码 |
||
|
channel_type |
tinyint |
not null |
渠道 |
|
|
receiver |
varchar(255) |
接收人 |
||
|
title |
varchar(255) |
标题 |
||
|
content |
text |
内容 |
||
|
send_status |
tinyint |
not null |
0 |
0待发,1成功,2失败,3死信 |
|
retry_count |
int |
0 |
重试次数 |
|
|
next_retry_time |
datetime |
下次重试 |
||
|
fail_reason |
varchar(500) |
失败原因 |
建议索引:uk_msg_task_no(tenant_id,task_no,deleted); idx_msg_send_status(tenant_id,send_status,next_retry_time)
用途:单据、小票、标签、面单模板。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
template_code |
varchar(80) |
not null |
模板编码 |
|
|
template_name |
varchar(100) |
not null |
模板名称 |
|
|
bill_type |
varchar(50) |
not null |
单据类型 |
|
|
template_engine |
tinyint |
not null |
1 |
1Hiprint,2锐浪,3自定义 |
|
template_content |
longtext |
模板内容 |
||
|
is_default |
tinyint |
not null |
0 |
是否默认 |
|
status |
tinyint |
not null |
1 |
状态 |
建议索引:uk_print_template(tenant_id,template_code,deleted); idx_print_bill_type(tenant_id,bill_type,is_default)
用途:所有 Excel 导出进入任务中心,防止数据泄露。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
task_no |
varchar(50) |
not null |
导出任务号 |
|
|
export_name |
varchar(150) |
not null |
导出名称 |
|
|
export_type |
varchar(50) |
not null |
导出类型 |
|
|
query_params |
text |
查询参数 |
||
|
file_url |
varchar(500) |
文件地址 |
||
|
file_name |
varchar(255) |
文件名 |
||
|
file_size |
bigint |
文件大小 |
||
|
status |
tinyint |
not null |
0 |
0待处理,1处理中,2成功,3失败 |
|
fail_reason |
varchar(500) |
失败原因 |
||
|
download_count |
int |
0 |
下载次数 |
|
|
expire_time |
datetime |
过期时间 |
建议索引:uk_export_task_no(tenant_id,task_no,deleted); idx_export_status(tenant_id,status,create_time)
用途:记录用户操作、请求参数、结果、IP。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
user_id |
bigint |
操作人 |
||
|
username |
varchar(64) |
账号 |
||
|
module_name |
varchar(100) |
模块 |
||
|
operation_type |
varchar(50) |
操作类型 |
||
|
operation_desc |
varchar(255) |
操作说明 |
||
|
request_url |
varchar(255) |
请求地址 |
||
|
request_method |
varchar(20) |
请求方法 |
||
|
request_params |
longtext |
请求参数 |
||
|
response_result |
longtext |
响应结果 |
||
|
ip_address |
varchar(64) |
IP |
||
|
operation_time |
datetime |
not null |
CURRENT_TIMESTAMP |
操作时间 |
|
success |
tinyint |
1 |
是否成功 |
|
|
error_msg |
text |
错误信息 |
建议索引:idx_log_operation_user(tenant_id,user_id,operation_time); idx_log_operation_module(tenant_id,module_name,operation_time)
用途:审核、反审核、驳回记录。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
bill_type |
varchar(50) |
not null |
单据类型 |
|
|
bill_id |
bigint |
not null |
单据 ID |
|
|
bill_no |
varchar(50) |
单据编号 |
||
|
audit_action |
tinyint |
not null |
1审核,2反审核,3驳回 |
|
|
before_status |
tinyint |
审核前状态 |
||
|
after_status |
tinyint |
审核后状态 |
||
|
audit_user_id |
bigint |
审核人 |
||
|
audit_user_name |
varchar(64) |
审核人名称 |
||
|
audit_time |
datetime |
not null |
CURRENT_TIMESTAMP |
审核时间 |
|
audit_remark |
varchar(500) |
审核意见 |
建议索引:idx_audit_bill(tenant_id,bill_type,bill_id); idx_audit_user(tenant_id,audit_user_id,audit_time)
用途:用户登录、退出、失败。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
user_id |
bigint |
用户 ID |
||
|
username |
varchar(64) |
账号 |
||
|
login_type |
tinyint |
1 |
1登录,2退出,3失败 |
|
|
login_ip |
varchar(64) |
IP |
||
|
login_location |
varchar(255) |
登录地点 |
||
|
browser |
varchar(100) |
浏览器 |
||
|
os |
varchar(100) |
操作系统 |
||
|
login_time |
datetime |
not null |
CURRENT_TIMESTAMP |
登录时间 |
|
success |
tinyint |
1 |
是否成功 |
|
|
fail_reason |
varchar(500) |
失败原因 |
建议索引:idx_login_user(tenant_id,user_id,login_time); idx_login_username(tenant_id,username,login_time)
用途:外部系统接入凭证。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
app_key |
varchar(80) |
not null |
应用 Key |
|
|
app_secret |
varchar(255) |
not null |
密钥密文 |
|
|
app_name |
varchar(100) |
应用名称 |
||
|
owner_id |
bigint |
绑定货主 |
||
|
ip_whitelist |
varchar(500) |
IP 白名单 |
||
|
enabled |
tinyint |
not null |
1 |
启用 |
|
expire_time |
datetime |
过期时间 |
建议索引:uk_open_app_key(tenant_id,app_key,deleted)
用途:记录接口调用和错误排查。
|
字段名 |
数据类型 |
约束 |
默认值 |
字段说明 |
|
app_key |
varchar(80) |
应用 Key |
||
|
api_path |
varchar(255) |
接口路径 |
||
|
request_method |
varchar(20) |
请求方法 |
||
|
request_body |
longtext |
请求报文 |
||
|
response_body |
longtext |
响应报文 |
||
|
client_ip |
varchar(64) |
客户端 IP |
||
|
success |
tinyint |
1 |
是否成功 |
|
|
error_msg |
varchar(500) |
错误信息 |
||
|
cost_ms |
int |
耗时毫秒 |
||
|
call_time |
datetime |
not null |
CURRENT_TIMESTAMP |
调用时间 |
建议索引:idx_api_call_app(tenant_id,app_key,call_time); idx_api_call_path(tenant_id,api_path,call_time)
|
枚举编码 |
取值 |
说明 |
|
bill_status |
0 |
草稿 |
|
bill_status |
1 |
待审核 |
|
bill_status |
2 |
已审核 |
|
bill_status |
3 |
执行中 / 部分完成 |
|
bill_status |
4 |
已完成 |
|
bill_status |
8 |
已关闭 |
|
bill_status |
9 |
已作废 |
|
direction |
1 |
入库 |
|
direction |
2 |
出库 |
|
temperature_type |
1 |
常温 |
|
temperature_type |
2 |
冷藏 |
|
temperature_type |
3 |
冷冻 |
|
temperature_type |
4 |
恒温 |
|
temperature_type |
9 |
其他 |
|
cost_method |
1 |
移动加权平均 |
|
cost_method |
2 |
FIFO 先进先出 |
|
cost_method |
3 |
标准成本 |
|
cost_method |
4 |
手工成本 |
|
billing_method |
1 |
按单 |
|
billing_method |
2 |
按件 |
|
billing_method |
3 |
按箱 |
|
billing_method |
4 |
按重量 |
|
billing_method |
5 |
按体积 |
|
billing_method |
6 |
按天 |
|
billing_method |
7 |
按托盘 |
|
billing_method |
8 |
按库位 |
|
billing_method |
9 |
按距离 |
|
billing_method |
10 |
按金额比例 |
|
billing_method |
11 |
按人工次数 |
|
billing_method |
12 |
按公式 |
|
flow_type |
INBOUND |
入库 |
|
flow_type |
OUTBOUND |
出库 |
|
flow_type |
RETURN_IN |
退货入库 |
|
flow_type |
TRANSFER_OUT |
调拨出库 |
|
flow_type |
TRANSFER_IN |
调拨入库 |
|
flow_type |
STOCKTAKE_GAIN |
盘盈 |
|
flow_type |
STOCKTAKE_LOSS |
盘亏 |
|
flow_type |
LOSS |
报损 |
|
flow_type |
OVERFLOW |
报溢 |
|
flow_type |
MOVE |
移库 |
|
场景 |
建议键值 |
适用表 |
|
库存变动幂等 |
tenant_id + source_bill_type + source_bill_id + source_detail_id + operation_type |
wms_goods_inventory_flow |
|
成本变动幂等 |
tenant_id + source_bill_type + source_bill_id + source_detail_id + operation_type |
cost_goods_cost_flow |
|
计费事件幂等 |
event_type + source_bill_type + source_bill_id + source_detail_id |
fee_billing_event |
|
费用明细幂等 |
billing_event_id + fee_item_id + source_detail_id |
fee_detail |
|
业务单号唯一 |
tenant_id + bill_no 或 tenant_id + order_no |
所有主单表 |
|
库存汇总唯一 |
tenant_id + owner_id + warehouse_id + sku_id + unit_id |
wms_goods_inventory |
|
批次库存唯一 |
tenant_id + owner_id + warehouse_id + sku_id + unit_id + batch_no |
wms_goods_inventory_batch |
|
库位库存唯一 |
tenant_id + owner_id + warehouse_id + location_id + sku_id + unit_id + batch_no |
wms_goods_inventory_location |
|
阶段 |
建议优先表 |
目标 |
|
第一阶段:基础主数据 |
tenant_info, sys_user, owner_info, owner_contract, pms_goods, pms_goods_sku, wms_warehouse, wms_location |
先完成租户、权限、货主、商品、仓库、库位 |
|
第二阶段:库存闭环 |
wms_stockin_bill, wms_stockout_bill, wms_goods_inventory, wms_goods_inventory_flow, wms_goods_inventory_lock |
跑通入库审核加库存、出库审核减库存、库存流水 |
|
第三阶段:仓内作业 |
wms_putaway_task, wms_pick_task, wms_review_task, wms_pack_task, wms_stocktake_bill, wms_loss_overflow_bill |
实现上架、拣货、复核、打包、盘点损溢 |
|
第四阶段:配送成本费用 |
tms_delivery_order, cost_goods_cost, cost_goods_cost_flow, fee_billing_event, fee_detail, fee_owner_bill |
打通配送、成本和费用账单 |
|
第五阶段:财务与平台化 |
fin_receivable, fin_receipt, msg_template, exp_export_task, log_operation, open_api_app |
完善结算、消息、导出、日志、开放接口 |
本数据字典的核心设计思想是:货主是数据归属主体,商品是业务流转对象,仓库与库位是作业执行单元,库存流水是库存可信依据,成本流水是财务成本依据,计费事件是费用自动化依据,账单和应收是财务闭环依据。
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。