587 lines
27 KiB
Markdown
587 lines
27 KiB
Markdown
# FMS 业务表设计
|
||
|
||
## 往来单位(合作伙伴)
|
||
|
||
```sql
|
||
create table dbo.b_othercompany (
|
||
b_id bigint not null primary key,
|
||
b_ywid varchar(50) not null,
|
||
b_pycode nvarchar(50) null,
|
||
b_type varchar(200) null,
|
||
b_name nvarchar(500) null,
|
||
b_shortname nvarchar(50) null,
|
||
b_linkman nvarchar(200) null,
|
||
b_phone nvarchar(500) null,
|
||
b_addr nvarchar(500) null,
|
||
b_firstlinkdate datetime null,
|
||
b_htno varchar(50) null,
|
||
b_htdate date null,
|
||
b_htexpiredate date null,
|
||
b_black tinyint not null default 0,
|
||
b_canuse tinyint not null default 0,
|
||
b_zl int null,
|
||
b_tel nvarchar(50) null,
|
||
b_fax nvarchar(500) null,
|
||
b_www varchar(50) null,
|
||
b_email varchar(50) null,
|
||
b_bankacount nvarchar(500) null,
|
||
b_invaccount nvarchar(500) null,
|
||
b_cate_id varchar(150) null,
|
||
b_bz1 nvarchar(500) null,
|
||
b_bz2 nvarchar(500) null,
|
||
b_bz3 nvarchar(500) null,
|
||
b_bz4 nvarchar(500) null,
|
||
b_province nvarchar(50) null,
|
||
b_city nvarchar(50) null,
|
||
b_area nvarchar(50) null,
|
||
b_country nvarchar(50) null,
|
||
b_edicode varchar(50) null,
|
||
b_showcolor int null,
|
||
b_type_id nvarchar(200) null,
|
||
b_from_id nvarchar(50) null,
|
||
b_type1_id nvarchar(50) null,
|
||
b_type2_id nvarchar(50) null,
|
||
b_type3_id nvarchar(50) null,
|
||
b_type4_id nvarchar(50) null,
|
||
b_type5_id nvarchar(50) null,
|
||
b_owner_id varchar(50) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null,
|
||
b_password varchar(50) null,
|
||
b_state nvarchar(50) null,
|
||
b_bankacount_e varchar(500) null,
|
||
b_addr_e varchar(500) null,
|
||
b_name_e nvarchar(500) null
|
||
);
|
||
|
||
create unique index ux_b_othercompany_ywid on dbo.b_othercompany (b_ywid);
|
||
create index ix_b_othercompany_cate on dbo.b_othercompany (b_cate_id, b_canuse, b_id);
|
||
create index ix_b_othercompany_name on dbo.b_othercompany (b_name, b_canuse, b_id);
|
||
|
||
create table dbo.b_othercompany_partner_type (
|
||
b_id varchar(50) not null primary key,
|
||
b_name nvarchar(50) null,
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(50) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_othercompany_category (
|
||
b_id varchar(150) not null primary key,
|
||
b_parent_id varchar(150) null,
|
||
b_depth int not null default 0,
|
||
b_path varchar(1000) not null,
|
||
b_name nvarchar(200) not null,
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create index ix_b_othercompany_category_parent
|
||
on dbo.b_othercompany_category (b_parent_id, b_canuse, b_depth, b_xh, b_id);
|
||
create index ix_b_othercompany_category_path
|
||
on dbo.b_othercompany_category (b_path, b_canuse, b_id);
|
||
|
||
-- 注:b_grade 由「其他数据」迁移重建为雪花主键(原为级别编码)
|
||
create table dbo.b_grade (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 级别名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(50) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
-- 注:b_from 由「其他数据」迁移重建为雪花主键(原为来源编码)
|
||
create table dbo.b_from (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 来源名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(50) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_othercompany_accountbank (
|
||
subid bigint not null primary key,
|
||
mx_xh int null,
|
||
father bigint null,
|
||
mx_bank nvarchar(800) null,
|
||
mx_bz1 nvarchar(200) null,
|
||
mx_created_by varchar(50) null,
|
||
mx_created_at datetime2 null,
|
||
mx_updated_by varchar(50) null,
|
||
mx_updated_at datetime2 null
|
||
);
|
||
|
||
create index ix_b_othercompany_accountbank_father
|
||
on dbo.b_othercompany_accountbank (father, mx_xh, subid);
|
||
|
||
create or alter view dbo.v_b_othercompany as
|
||
select o.b_id, o.b_ywid, o.b_pycode, o.b_type, o.b_name, o.b_shortname,
|
||
o.b_linkman, o.b_phone, o.b_addr, o.b_firstlinkdate,
|
||
o.b_htno, o.b_htdate, o.b_htexpiredate, o.b_black, o.b_canuse,
|
||
o.b_zl, o.b_tel, o.b_fax, o.b_www, o.b_email,
|
||
o.b_bankacount, o.b_invaccount, o.b_cate_id,
|
||
o.b_bz1, o.b_bz2, o.b_bz3, o.b_bz4,
|
||
o.b_province, o.b_city, o.b_area, o.b_country,
|
||
o.b_edicode, o.b_showcolor, o.b_type_id, o.b_from_id,
|
||
o.b_type1_id, o.b_type2_id, o.b_type3_id, o.b_type4_id, o.b_type5_id,
|
||
o.b_owner_id, o.b_created_by, o.b_created_at,
|
||
o.b_updated_by, o.b_updated_at,
|
||
o.b_password, o.b_state,
|
||
o.b_bankacount_e, o.b_addr_e, o.b_name_e,
|
||
u.b_name as v_ownername
|
||
from dbo.b_othercompany o
|
||
left join dbo.b_user u on u.b_id = o.b_owner_id;
|
||
```
|
||
|
||
## 联系人
|
||
|
||
```sql
|
||
create table dbo.b_contact (
|
||
b_id bigint not null primary key,
|
||
b_ywid varchar(50) not null,
|
||
b_name_ch nvarchar(50) null,
|
||
b_name_en nvarchar(50) null,
|
||
b_sex nvarchar(50) null,
|
||
b_birthday date null,
|
||
b_duty nvarchar(50) null,
|
||
b_departmentname nvarchar(50) null,
|
||
b_phone nvarchar(50) null,
|
||
b_mobilephone nvarchar(50) null,
|
||
b_fax nvarchar(50) null,
|
||
b_email varchar(50) null,
|
||
b_homephone nvarchar(50) null,
|
||
b_homeaddr nvarchar(255) null,
|
||
b_taste nvarchar(50) null,
|
||
b_habit nvarchar(50) null,
|
||
b_homesituation nvarchar(50) null,
|
||
b_picture varchar(500) null,
|
||
b_cate_id varchar(50) null,
|
||
b_type1_id varchar(50) null,
|
||
b_customer_id bigint null,
|
||
b_owner_id varchar(50) null,
|
||
b_isdefault tinyint not null default 0,
|
||
b_showcolor int null,
|
||
b_htbegindate date null,
|
||
b_htenddate date null,
|
||
b_state varchar(50) null,
|
||
b_bz nvarchar(1000) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create unique index ux_b_contact_ywid on dbo.b_contact (b_ywid);
|
||
create index ix_b_contact_customer on dbo.b_contact (b_customer_id, b_id);
|
||
create index ix_b_contact_name on dbo.b_contact (b_name_ch, b_id);
|
||
|
||
create table dbo.b_contact_type (
|
||
b_id varchar(50) not null primary key,
|
||
b_name nvarchar(50) null,
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create or alter view dbo.v_b_contact as
|
||
select c.b_id, c.b_ywid, c.b_name_ch, c.b_name_en, c.b_sex, c.b_phone,
|
||
c.b_mobilephone, c.b_fax, c.b_email,
|
||
c.b_duty, c.b_homephone, c.b_cate_id, c.b_homeaddr, c.b_bz,
|
||
c.b_departmentname, c.b_picture,
|
||
c.b_customer_id, c.b_owner_id, c.b_isdefault,
|
||
c.b_taste, c.b_habit, c.b_homesituation,
|
||
u.b_name as v_ownername,
|
||
d.b_name as v_ownerdepartment,
|
||
c.b_showcolor,
|
||
o.b_name as v_customer_name,
|
||
c.b_birthday,
|
||
case when isnull(c.b_name_ch, '') = '' then c.b_name_en
|
||
when isnull(c.b_name_en, '') = '' then c.b_name_ch
|
||
else isnull(c.b_name_ch, '') + isnull(c.b_name_en, '') end as b_name,
|
||
c.b_type1_id,
|
||
c.b_htbegindate, c.b_htenddate,
|
||
c.b_created_by, c.b_created_at, c.b_updated_by, c.b_updated_at,
|
||
c.b_state
|
||
from dbo.b_contact c
|
||
left join dbo.b_othercompany o on o.b_id = c.b_customer_id
|
||
left join dbo.b_user u on u.b_id = c.b_owner_id
|
||
left join dbo.b_dept d on d.b_id = u.b_dept_id
|
||
where isnull(o.b_ywid, '') <> 'b_employee';
|
||
```
|
||
|
||
## 其他数据(base_otherdata)
|
||
|
||
> 数据来源:旧库 `b_other_bmfl`(65 条模块清单,每条对应一张数据表)。
|
||
> 其中 3 张已在「往来单位」迁移中建过(`b_othercompany_partner_type`、`b_from`、`b_grade`):
|
||
> `b_from`、`b_grade` 随本次迁移**重建为纯雪花**(见下),`b_othercompany_partner_type` 保持编码主键
|
||
> (树形分类,由 othercompany 页面自研维护)。
|
||
> 本次待迁移 **62 张表**(启用 46 张)、数据合计 572 行;清单见 `fms-api/tools/migration/otherdata-modules.txt`。
|
||
> 新版不建 `b_other_bmfl` 表;模块树为三层:`base_otherdata`(其他数据,根)→ 6 个分组
|
||
> (常用 / 系统 / 仓库 / 物流 / 铁运 / 空运,`b_module_type = 'module'`)→ 62 个数据模块(`data`)。
|
||
> 数据模块编码 = 表名(如 `b_port`),`b_view_table` / `b_save_table` 都指向表本身:
|
||
> 字典表直接查表,不建 `v_` 直通视图(只有需要 join / 计算列的模块才用视图,如 `v_b_othercompany`)。
|
||
> 模块顺序 `b_xh` 按旧库「分组 + 组内序号」连续生成,保持原有排列(常用在前)。
|
||
>
|
||
> **主键模式**:`b_id` 为雪花主键(新增行由前端 `nextIdApi` 生成,通用列表组件的主键列只读)。
|
||
> 旧编号(`001`、`002` 等流水号)不保留 —— 它们没有业务含义,对外交换另有 `b_edicode` 等字段;
|
||
> 将来迁移引用这些字典的业务表时,按「旧编号 → 新雪花」映射替换字段值(映射由迁移脚本生成并留档)。
|
||
|
||
### `b_from` / `b_grade` 重建与引用转换
|
||
|
||
这两张表在「往来单位」迁移时按编码主键建好,随本次迁移改为纯雪花:
|
||
|
||
1. 备份旧行(旧 `b_id` + `b_name`)→ 重建表(雪花主键)→ 重导数据(`IdGenerator` 生成雪花);
|
||
2. 引用它们的字段按「名称」映射转换为新雪花:
|
||
- `b_othercompany.b_from_id`(客户来源)
|
||
- `b_othercompany.b_type_id`(客户级别)
|
||
3. `b_othercompany_partner_type` 保持编码主键不动(树形分类,由 othercompany 页面自研维护)。
|
||
|
||
### 字段转换规则
|
||
|
||
| 旧字段 | 新字段 | 说明 |
|
||
| --- | --- | --- |
|
||
| `b_id` varchar(50) 主键 | —(不保留) | 旧编号是流水号,无业务含义;引用方迁移时按映射替换为雪花 |
|
||
| —(新生成) | `b_id` bigint 主键 | 雪花,前端新增时自动生成 |
|
||
| `b_name` / `b_name_c` | `b_name` nvarchar(50) | 名称统一为 `b_name` |
|
||
| `b_name_e` | `b_name_e` nvarchar(50) | 英文名保留 |
|
||
| `b_bz` varchar(n) | `b_bz` nvarchar(200) | 备注改 nvarchar |
|
||
| `b_default` / `b_tz` / `b_isconvert` 等 varchar(1) | tinyint not null default 0 | 布尔标志按 0/1 |
|
||
| `b_canuse` varchar(1) | `b_canuse` tinyint not null default 1 | 按规范 |
|
||
| `b_xh` int | `b_xh` int not null default 0 | 按规范 |
|
||
| `b_inputuser_id` / `b_inputdatetime` / `b_updateuser_id` / `b_updatedatetime` | `b_created_by` / `b_created_at` / `b_updated_by` / `b_updated_at` | 审计字段,datetime → datetime2 |
|
||
| 编码 / EDI 代码 / 状态类字段 | 类型保留 varchar | |
|
||
| — | `b_i18n` varchar(150) | 新增多语言资源键 |
|
||
|
||
### 常用(旧分组「1.常用」,9 张)
|
||
|
||
```sql
|
||
create table dbo.b_feetype (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_name_e nvarchar(50) null, -- 英文名
|
||
b_default tinyint not null default 0, -- 默认类别(0/1)
|
||
b_amount decimal(18,2) null, -- 默认金额
|
||
b_tax decimal(18,4) null, -- 税额/税率
|
||
b_money_id varchar(50) null, -- 币种(b_money.b_id,雪花)
|
||
b_i18n varchar(150) null, -- 多语言资源键
|
||
b_canuse tinyint not null default 1, -- 是否启用(0/1)
|
||
b_xh int not null default 0, -- 显示顺序
|
||
b_bz nvarchar(200) null, -- 备注
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_oceanline (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_goodssource (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_dailyfeetype (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_dailytype (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_ywtype (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_ysfs (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_port (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称(原 b_name_c)
|
||
b_name_e nvarchar(50) null, -- 英文名
|
||
b_country nvarchar(50) null, -- 国家
|
||
b_oceanline varchar(50) null, -- 所属航线(b_oceanline.b_id,雪花)
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_tz tinyint not null default 0, -- 标志位(0/1,待确认含义)
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_money (
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_hl decimal(18,4) null, -- 汇率
|
||
b_symbol nvarchar(50) null, -- 货币符号
|
||
b_isconvert tinyint not null default 0, -- 是否参与折算(0/1)
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
```
|
||
|
||
### 系统(旧分组「2.系统」,35 张)
|
||
|
||
其中 29 张结构完全一致(`b_id` 雪花主键、`b_name`、`b_i18n`、`b_canuse`、`b_xh`、`b_bz`、审计四字段),按下面这个模板建(表名与注释替换即可):
|
||
|
||
```sql
|
||
create table dbo.b_cargo_damage_status ( -- 货损状态
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_i18n varchar(150) null, -- 多语言资源键
|
||
b_canuse tinyint not null default 1, -- 是否启用(0/1)
|
||
b_xh int not null default 0, -- 显示顺序
|
||
b_bz nvarchar(200) null, -- 备注
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
```
|
||
|
||
29 张同构表:
|
||
|
||
| 表名 | 名称 | 表名 | 名称 |
|
||
| --- | --- | --- | --- |
|
||
| `b_cargo_damage_status` | 货损状态 | `b_sys_level` | 级别 |
|
||
| `b_bulkforkliftpersonname` | 散货铲车人员 | `b_sys_operator` | 条件设置操作符 |
|
||
| `b_bulktype` | 散货类型 | `b_blstate` | 提单方式 |
|
||
| `b_bulkpersonname` | 散货理货人员 | `b_sys_state` | 审核状态 |
|
||
| `b_bulkstevedorepersonname` | 散货装卸人员 | `b_sys_feesf` | 费用收付 |
|
||
| `b_charging_method` | 收费方式 | `bc_priceList_type` | 价目表类型 |
|
||
| `b_unloading_method` | 卸货方式 | `b_sys_yesno` | 是否 |
|
||
| `b_sys_b_lessfull` | 装箱 | `b_ystype` | 付款类型 |
|
||
| `b_sys_edittype` | 字段编辑选择 | `b_billtype` | 账单类型 |
|
||
| `b_freightpayment` | 运费条款 | `b_bgtype` | 报关方式 |
|
||
| `b_jsfs` | 结算方式 | `b_httype` | 合同类型 |
|
||
| `b_ivtype` | 发票类型 | `b_sys_hdtype` | 回单类型 |
|
||
| `b_sys_sex` | 性别 | `b_progress` | 进度情况 |
|
||
| `b_sys_copies` | 提单份数 | `b_zxstate` | 执行状态 |
|
||
| `b_cztype` | 称重方式 | | |
|
||
|
||
另外 6 张有差异字段(完整写出):
|
||
|
||
```sql
|
||
create table dbo.b_vessel ( -- 船名船次
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(100) null, -- 船名(原 b_vessel_name)
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_voy nvarchar(100) null, -- 船次
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_con_type ( -- 箱型管理
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 箱型(40GP / 20GP / 45HQ)
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_type nvarchar(50) null, -- 箱类(大箱/小箱)
|
||
b_linkcon nvarchar(50) null, -- 关联箱型
|
||
b_default tinyint not null default 0, -- 默认箱型(0/1)
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_city ( -- 城市
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 中文名(原 b_name_c)
|
||
b_name_e nvarchar(50) null, -- 英文名
|
||
b_country_name_c nvarchar(50) null, -- 国家(中文)
|
||
b_country_name_e nvarchar(50) null, -- 国家(英文)
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_sys_pricelisttype ( -- 合作伙伴类型(委托单位/订舱单位/报关行…)
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 名称
|
||
b_dw_id varchar(50) null, -- 关联单位字段名(如 b_customer_id)
|
||
b_dw_name varchar(50) null, -- 关联单位视图名(如 v_customer_company)
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_transway ( -- 运输条款(CY-CY / DOOR-DOOR / CFS-CFS)
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(100) null, -- 条款
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
|
||
create table dbo.b_package ( -- 包装单位(BAGS / BALES / CASES…)
|
||
b_id bigint not null primary key, -- 主键(雪花)
|
||
b_name nvarchar(50) null, -- 包装代码
|
||
b_edicode varchar(50) null, -- EDI 代码
|
||
b_i18n varchar(150) null,
|
||
b_canuse tinyint not null default 1,
|
||
b_xh int not null default 0,
|
||
b_bz nvarchar(200) null,
|
||
b_created_by varchar(50) null,
|
||
b_created_at datetime2 null,
|
||
b_updated_by varchar(50) null,
|
||
b_updated_at datetime2 null
|
||
);
|
||
```
|
||
|
||
### 仓库、物流、铁运、空运(18 张)
|
||
|
||
这 18 张全部是标准结构(同系统组模板,仅 `b_name` 即名称):
|
||
|
||
| 分组 | 表名 | 名称 |
|
||
| --- | --- | --- |
|
||
| 3.仓库 | `b_depot` | 仓库 |
|
||
| 3.仓库 | `b_depotouttype` | 出库类型 |
|
||
| 3.仓库 | `b_depotintype` | 入库类型 |
|
||
| 5.物流 | `car_daily_feetype` | 费用报销-费用类型 |
|
||
| 5.物流 | `car_jiayou_jsfs` | 计算方式 |
|
||
| 5.物流 | `car_jiayou_type` | 加油类型 |
|
||
| 5.物流 | `car_jiayou_youliao` | 燃油种类 |
|
||
| 5.物流 | `b_cdtype` | 派车类型 |
|
||
| 5.物流 | `b_shfs` | 派送方式 |
|
||
| 5.物流 | `b_thfs` | 提货方式 |
|
||
| 5.物流 | `b_wangdian` | 网点 |
|
||
| 5.物流 | `b_ywfrom` | 业务来源 |
|
||
| 5.物流 | `b_ywtype_tc` | 业务类型(拖车) |
|
||
| 6.铁运 | `b_servicetype` | 服务内容 |
|
||
| 6.铁运 | `b_contype` | 箱属 |
|
||
| 6.铁运 | `b_ywtype_ht` | 业务类型(铁运) |
|
||
| 7.空运 | `b_dcterm` | 订舱条款 |
|
||
| 7.空运 | `b_ywtype_ky` | 业务类型(空运) |
|
||
|
||
### 实施记录(2026-09-14)
|
||
|
||
| 步骤 | 产物 | 状态 |
|
||
| --- | --- | --- |
|
||
| 建表 | `sql/fms_business_otherdata.sql`(62 张表;字典模块直接查表,不建视图) | 已执行 |
|
||
| 模块注册 | `sql/fms_module_otherdata.sql`(`base_otherdata` 根 + 6 个分组 + 64 个数据模块,编码 = 表名 + s_field) | 已执行 |
|
||
| 数据导入 | `fms-api/tools/migration/OtherDataMigrate.java`(555 行,雪花主键);映射留档 `otherdata-id-map.tsv` | 已执行 |
|
||
| `b_from` / `b_grade` 重建 | 工具内完成(雪花主键) | 已执行 |
|
||
| 引用转换 | `b_othercompany.b_from_id` / `b_type_id` | **待执行**:`b_othercompany` 目前是空表,数据迁入后重跑 `OtherDataMigrate` 即可(旧编号未匹配时脚本无副作用) |
|
||
| 字段中文名与界面配置 | `FieldNameSync --all-otherdata --force`:64 个模块全部同步(中文名 + view/edit 配置,含字段别名 `b_vessel_name`→`b_name`、`b_name_c`→`b_name`);通用字段名由注册脚本补齐(668 字段全部有中文名);旧库无配置的 44 个模块补默认列(名称 + 备注) | 已执行 |
|