base.sql
8.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
alter table base_data_customer modify column mnemonic_code varchar(20) null;
-- 厂房信息
create table if not exists base_data_workshop (
id varchar(32) primary key comment 'ID',
code varchar(20) not null comment '厂房编号',
name varchar(50) not null comment '厂房名称',
type varchar(20) not null comment '厂房类型',
description varchar(100) comment '描述',
create_by_id varchar(32) not null comment '创建人ID',
create_by varchar(20) not null comment '创建人',
update_by_id varchar(32) not null comment '更新人ID',
update_by varchar(20) not null comment '更新人',
create_time datetime default now() comment '创建时间',
update_time datetime default now() comment '更新时间'
);
-- 办事处/科办
create table if not exists base_data_office (
id varchar(32) primary key comment 'ID',
code varchar(20) not null comment '编号',
name varchar(50) not null comment '名称',
description varchar(100) comment '描述',
create_by_id varchar(32) not null comment '创建人ID',
create_by varchar(20) not null comment '创建人',
update_by_id varchar(32) not null comment '更新人ID',
update_by varchar(20) not null comment '更新人',
create_time datetime default now() comment '创建时间',
update_time datetime default now() comment '更新时间'
);
-- 类型数据
create table if not exists base_data_type (
id varchar(32) primary key comment 'ID',
code varchar(20) not null comment '编号',
name varchar(50) not null comment '名称',
description varchar(100) comment '描述',
type varchar(20) not null comment '类型:客户(CUSTOMER)',
create_by_id varchar(32) not null comment '创建人ID',
create_by varchar(20) not null comment '创建人',
update_by_id varchar(32) not null comment '更新人ID',
update_by varchar(20) not null comment '更新人',
create_time datetime default now() comment '创建时间',
update_time datetime default now() comment '更新时间'
);
-- 产品品种
create table if not exists base_data_product_variety (
id varchar(32) primary key comment 'ID',
code varchar(20) not null comment '编号',
name varchar(50) not null comment '名称',
description varchar(100) comment '描述',
create_by_id varchar(32) not null comment '创建人ID',
create_by varchar(20) not null comment '创建人',
update_by_id varchar(32) not null comment '更新人ID',
update_by varchar(20) not null comment '更新人',
create_time datetime default now() comment '创建时间',
update_time datetime default now() comment '更新时间'
);
-- 合同框架
create table if not exists `tbl_contract_framework`(
`id` varchar(32) primary key comment 'ID',
`code` varchar(20) not null comment '编号',
`customer_id` varchar(32) not null comment '客户id',
`company` varchar(50) not null comment '所属单位',
`has_framework_agreement` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否签订框架合同',
`material_type_id` varchar(500) NOT NULL COMMENT '品种id',
`validity_time` date comment '期限',
`create_by_id` varchar(32) not null comment '创建人ID',
`create_by` varchar(20) not null comment '创建人',
`update_by_id` varchar(32) not null comment '更新人ID',
`update_by` varchar(20) not null comment '更新人',
`create_time` datetime default now() comment '创建时间',
`update_time` datetime default now() comment '更新时间'
);
-- 经销标准合同
create table if not exists `tbl_contract_distributor_standard`
(
`id` varchar(32) primary key comment 'ID',
`code` varchar(20) not null comment '编号',
`supplier` varchar(50) not null comment '供方',
`buyer` varchar(200) not null comment '需方',
`dept_id` varchar(32) not null comment '办事处',
`order_date` date NOT NULL COMMENT '订货日期',
`unit` VARCHAR(50) COMMENT '单位',
`total_quantity` DECIMAL(15, 4) COMMENT '合计数量',
`total_amount_excluding_tax` DECIMAL(15, 4) COMMENT '合计不含税金额',
`total_amount_including_tax` DECIMAL(15, 4) COMMENT '合计总金额',
`total_amount_capital` VARCHAR(100) COMMENT '合计人民币金额(大写)',
`deposit_info` VARCHAR(500) COMMENT '交付定金信息(包含数额、时间)',
`packaging_requirements` VARCHAR(200) COMMENT '包装要求',
`payment_terms` VARCHAR(500) COMMENT '付款信息(包含付款方式、付款期限)',
`execution_standard` VARCHAR(50) COMMENT '执行标准',
`execution_standard_remarks` VARCHAR(100) COMMENT '执行标准备注',
`transport_mode` VARCHAR(100) COMMENT '运输方式',
`destination` VARCHAR(200) COMMENT '目的地',
`includes_packaging_fee` tinyint(1) NOT NULL DEFAULT 0 COMMENT '单价中是否已包含包装费',
`includes_transport_fee` tinyint(1) NOT NULL DEFAULT 0 COMMENT '单价中是否已包含运费',
`piece_weight_head` TEXT COMMENT '件重条头',
`surface` TEXT COMMENT '表面',
`tolerance` TEXT COMMENT '公差',
`performance` TEXT COMMENT '性能',
`packaging` TEXT COMMENT '包装',
`special_terms` VARCHAR(50) COMMENT '特别条款要求',
`designated_consignee` TEXT COMMENT '需方指定收货人',
`special_instructions` TEXT COMMENT '特别说明',
`remarks` TEXT COMMENT '备注',
`status` varchar(20) not null DEFAULT 'DRAFT' COMMENT '状态',
`type` varchar(20) COMMENT '合同类型',
`parent_id` varchar(32) COMMENT '父合同id',
`create_by_id` varchar(32) not null comment '创建人ID',
`create_by` varchar(20) not null comment '创建人',
`update_by_id` varchar(32) not null comment '更新人ID',
`update_by` varchar(20) not null comment '更新人',
`create_time` datetime default now() comment '创建时间',
`update_time` datetime default now() comment '更新时间'
);
-- 经销合同物料行
create table if not exists `tbl_contract_distributor_line`
(
`id` varchar(32) primary key comment 'ID',
`contract_id` varchar(32) NOT NULL COMMENT '合同主表ID',
`product_id` VARCHAR(50) NOT NULL COMMENT '产品名称',
`industry` VARCHAR(100) COMMENT '行业',
`quality` VARCHAR(100) COMMENT '品质',
`brand` VARCHAR(100) COMMENT '牌号',
`thickness` DECIMAL(10, 4) COMMENT '厚度',
`thickness_tol_pos` DECIMAL(10, 4) COMMENT '厚度公差正',
`thickness_tol_neg` DECIMAL(10, 4) COMMENT '厚度公差负',
`width` DECIMAL(10, 4) COMMENT '宽度',
`width_tol_pos` DECIMAL(10, 4) COMMENT '宽度公差正',
`width_tol_neg` DECIMAL(10, 4) COMMENT '宽度公差负',
`length` DECIMAL(10, 4) COMMENT '长度',
`length_tol_pos` DECIMAL(10, 4) COMMENT '长度公差正',
`length_tol_neg` DECIMAL(10, 4) COMMENT '长度公差负',
`status` VARCHAR(50) COMMENT '状态',
`quantity` DECIMAL(15, 4) NOT NULL COMMENT '数量',
`unit_price` DECIMAL(15, 4) NOT NULL COMMENT '单价',
`amount_excluding_tax` DECIMAL(15, 2) COMMENT '不含税金额',
`total_amount` DECIMAL(15, 2) COMMENT '总金额',
`delivery_date` DATE COMMENT '发货日期',
`show_order` INT DEFAULT 0 COMMENT '排序',
`create_by_id` varchar(32) not null comment '创建人ID',
`create_by` varchar(20) not null comment '创建人',
`update_by_id` varchar(32) not null comment '更新人ID',
`update_by` varchar(20) not null comment '更新人',
`create_time` datetime default now() comment '创建时间',
`update_time` datetime default now() comment '更新时间'
)