|
@@ -143,25 +143,26 @@ CREATE TABLE `sales_contract`
|
|
|
(
|
|
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
|
|
|
`customer_user_id` BIGINT UNSIGNED DEFAULT 0 COMMENT '客户id',
|
|
|
- `contract_no` varchar(64) default '' comment '合同编号',
|
|
|
- `contract_name` varchar(300) default '' comment '合同名称',
|
|
|
- `importer_cert_no` VARCHAR(32) DEFAULT '' COMMENT '进口商统一社会信用代码/注册号',
|
|
|
- `importer_enterprise_name` VARCHAR(300) DEFAULT NULL COMMENT '进口商企业名称',
|
|
|
- `agency_cert_no` VARCHAR(32) DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
|
|
|
- `agency_enterprise_name` VARCHAR(300) DEFAULT NULL COMMENT '代理公司企业名称',
|
|
|
- `trade_terms` varchar(4) DEFAULT '' COMMENT '贸易术语',
|
|
|
- `port_departure` varchar(255) DEFAULT '' comment '起运港',
|
|
|
- `port_destination` varchar(255) DEFAULT '' comment '目的港',
|
|
|
+ `contract_no` varchar(64) default '' comment '合同编号',
|
|
|
+ `contract_name` varchar(300) default '' comment '合同名称',
|
|
|
+ `importer_cert_no` VARCHAR(32) DEFAULT '' COMMENT '进口商统一社会信用代码/注册号',
|
|
|
+ `importer_enterprise_name` VARCHAR(300) DEFAULT NULL COMMENT '进口商企业名称',
|
|
|
+ `agency_cert_no` VARCHAR(32) DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
|
|
|
+ `agency_enterprise_name` VARCHAR(300) DEFAULT NULL COMMENT '代理公司企业名称',
|
|
|
+ `trade_terms` varchar(4) DEFAULT '' COMMENT '贸易术语',
|
|
|
+ `port_departure` varchar(255) DEFAULT '' comment '起运港',
|
|
|
+ `port_destination` varchar(255) DEFAULT '' comment '目的港',
|
|
|
`template_type` TINYINT(2) DEFAULT null COMMENT '模板类型1长银0自有',
|
|
|
- `sign_date` DATETIME DEFAULT null COMMENT '签署日期',
|
|
|
- `submit_status` varchar(4) DEFAULT '' COMMENT '提交状态1草稿2正式',
|
|
|
- `contract_status` varchar(4) DEFAULT '' COMMENT '合同状态1草稿2生效3待上传6已完成',
|
|
|
- `audit_status` varchar(4) DEFAULT '' COMMENT '审核状态1待审核2风控审核通过3法务审核通过4风控审核不通过5法务审核不通过',
|
|
|
+ `sign_date` DATETIME DEFAULT null COMMENT '签署日期',
|
|
|
+ `exchange_rate` DECIMAL(17, 10) DEFAULT 0 COMMENT '汇率',
|
|
|
+ `submit_status` varchar(4) DEFAULT '' COMMENT '提交状态1草稿2正式',
|
|
|
+ `contract_status` varchar(4) DEFAULT '' COMMENT '合同状态1草稿2生效3待上传6已完成',
|
|
|
+ `audit_status` varchar(4) DEFAULT '' COMMENT '审核状态1待审核2风控审核通过3法务审核通过4风控审核不通过5法务审核不通过',
|
|
|
`deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
- `create_by` varchar(64) default '' comment '创建者',
|
|
|
- `update_by` varchar(64) default '' comment '更新者',
|
|
|
- `gmt_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
- `gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ `create_by` varchar(64) default '' comment '创建者',
|
|
|
+ `update_by` varchar(64) default '' comment '更新者',
|
|
|
+ `gmt_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
PRIMARY KEY (`id`),
|
|
|
UNIQUE INDEX uk_contract_No (`contract_No`),
|
|
|
INDEX idx_cui (`customer_user_id`)
|
|
@@ -274,11 +275,13 @@ CREATE TABLE `purchase_order`
|
|
|
`sales_order_id` BIGINT UNSIGNED DEFAULT 0 COMMENT '销售订单主键',
|
|
|
`order_no` VARCHAR(64) DEFAULT '' COMMENT '订单编号',
|
|
|
`entity_no` VARCHAR(64) DEFAULT '' COMMENT '供应商编号',
|
|
|
+ `agency_cert_no` VARCHAR(32) DEFAULT '' COMMENT '代理公司统一社会信用代码/注册号',
|
|
|
`purchase_contract_no` VARCHAR(64) DEFAULT '' COMMENT '采购合同编号',
|
|
|
`invoice_type` VARCHAR(2) DEFAULT '' COMMENT '发票类型1增值税专用发票2增值税普通发票',
|
|
|
`currency` VARCHAR(3) DEFAULT 'CNY' COMMENT '币种',
|
|
|
`amount_total` DECIMAL(17, 4) DEFAULT '0' COMMENT '订单总额',
|
|
|
`tax_amount_total` DECIMAL(17, 4) DEFAULT '0' COMMENT '订单税额',
|
|
|
+ `settlement_cycle` INT DEFAULT NULL COMMENT '结算周期单位天',
|
|
|
`deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
`gmt_create` TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
`gmt_modified` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
@@ -293,38 +296,54 @@ CREATE TABLE `purchase_order`
|
|
|
DROP TABLE IF EXISTS `purchase_order_commodity`;
|
|
|
CREATE TABLE `purchase_order_commodity`
|
|
|
(
|
|
|
- `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
- `purchase_order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
|
|
|
- `hs_code` VARCHAR(32) DEFAULT '' COMMENT '商品编码',
|
|
|
- `name` VARCHAR(32) DEFAULT '' COMMENT '商品名称',
|
|
|
- `measurement_unit` VARCHAR(32) DEFAULT '' COMMENT '计量单位',
|
|
|
- `pack_spec` VARCHAR(300) DEFAULT '' COMMENT '包装规格',
|
|
|
- `number` INT DEFAULT 0 comment '数量',
|
|
|
- `price_unit` DECIMAL(17, 2) DEFAULT '0' COMMENT '采购单价 (不含税) ',
|
|
|
- `tax_refund_rate` DECIMAL(8, 6) DEFAULT '0' COMMENT '增值税税率',
|
|
|
- `currency` VARCHAR(3) DEFAULT 'CNY' COMMENT '币种',
|
|
|
- `amount` DECIMAL(17, 4) DEFAULT '0' COMMENT '商品金额',
|
|
|
- `model` VARCHAR(64) DEFAULT '' COMMENT '型号',
|
|
|
- `deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
- `gmt_create` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
- `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
+ `purchase_order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
|
|
|
+ `sales_commodity_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '销售商品id',
|
|
|
+ `hs_code` VARCHAR(32) DEFAULT '' COMMENT '商品编码',
|
|
|
+ `name` VARCHAR(32) DEFAULT '' COMMENT '商品名称',
|
|
|
+ `measurement_unit` VARCHAR(32) DEFAULT '' COMMENT '计量单位',
|
|
|
+ `pack_spec` VARCHAR(300) DEFAULT '' COMMENT '包装规格',
|
|
|
+ `number` INT DEFAULT 0 comment '数量',
|
|
|
+ `price_unit` DECIMAL(17, 2) DEFAULT '0' COMMENT '采购单价 (不含税) ',
|
|
|
+ `tax_refund_rate` DECIMAL(8, 6) DEFAULT '0' COMMENT '增值税税率',
|
|
|
+ `currency` VARCHAR(3) DEFAULT 'CNY' COMMENT '币种',
|
|
|
+ `amount` DECIMAL(17, 4) DEFAULT '0' COMMENT '商品金额',
|
|
|
+ `model` VARCHAR(64) DEFAULT '' COMMENT '型号',
|
|
|
+ `deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
+ `gmt_create` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
PRIMARY KEY (`id`)
|
|
|
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-关联商品';
|
|
|
|
|
|
DROP TABLE IF EXISTS `purchase_order_logistics`;
|
|
|
CREATE TABLE `purchase_order_logistics`
|
|
|
(
|
|
|
- `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
- `purchase_order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
|
|
|
- `company_name` VARCHAR(300) DEFAULT '' COMMENT '物流公司名称',
|
|
|
- `logistics_order_number` VARCHAR(32) DEFAULT '' COMMENT '物流单号',
|
|
|
- `delivery_time` DATETIME DEFAULT NULL COMMENT '发货时间',
|
|
|
- `arrive_time` DATETIME DEFAULT NULL COMMENT '送达时间',
|
|
|
- `transport_certificate_file_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '运输证明文件id',
|
|
|
- `remark` varchar(512) DEFAULT '' COMMENT '备注',
|
|
|
- `deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
- `gmt_create` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
- `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
+ `purchase_order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
|
|
|
+ `company_name` VARCHAR(300) DEFAULT '' COMMENT '物流公司名称',
|
|
|
+ `logistics_order_number` VARCHAR(32) DEFAULT '' COMMENT '物流单号',
|
|
|
+ `delivery_time` DATETIME DEFAULT NULL COMMENT '发货时间',
|
|
|
+ `arrive_time` DATETIME DEFAULT NULL COMMENT '送达时间',
|
|
|
+ -- `transport_certificate_file_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '运输证明文件id',
|
|
|
+ `remark` varchar(512) DEFAULT '' COMMENT '备注',
|
|
|
+ `deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
+ `gmt_create` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
PRIMARY KEY (`id`)
|
|
|
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-关联商品';
|
|
|
|
|
|
+-- 采购订单-发票信息
|
|
|
+DROP TABLE IF EXISTS `purchase_order_invoice`;
|
|
|
+CREATE TABLE `purchase_order_invoice`
|
|
|
+(
|
|
|
+ `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
|
+ `order_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '采购订单id',
|
|
|
+ `invoice_no` VARCHAR(32) DEFAULT '' COMMENT '发票号码',
|
|
|
+ `amount` DECIMAL(17, 2) DEFAULT '0' COMMENT '发票金额',
|
|
|
+ `file_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '发票文件id',
|
|
|
+ `deleted` TINYINT(1) DEFAULT 0 COMMENT '删除标识',
|
|
|
+ `gmt_create` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `gmt_modified` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ PRIMARY KEY (`id`)
|
|
|
+)ENGINE=InnoDB DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin COMMENT='采购订单-发票信息';
|
|
|
+
|