103 lines
5.1 KiB
SQL
103 lines
5.1 KiB
SQL
-- ----------------------------
|
|
-- 创建 项目流程表
|
|
-- 针对不通过流程需要创建不同表
|
|
-- ----------------------------
|
|
|
|
create table project_process
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
apply_date date null comment '申请时间',
|
|
apply_dept varchar(255) null comment '申请部门(逗号分割)',
|
|
apply_dept_id varchar(255) null comment '申请部门ID(逗号分割)',
|
|
apply_dept_leader_id int null comment '申请部门领导ID',
|
|
apply_dept_leader_name varchar(255) null comment '申请人领导',
|
|
apply_person_name varchar(255) null comment '申请人姓名',
|
|
apply_person_id int null comment '申请人ID',
|
|
contract_name varchar(255) null comment '合同名称',
|
|
contract_no varchar(255) null comment '合同编号',
|
|
project_id int null comment '项目ID',
|
|
project_no varchar(255) null comment '项目编号',
|
|
project_title varchar(255) null comment '标题',
|
|
seal_types varchar(255) null comment '印章类型',
|
|
`status` varchar(255) null comment '流程状态',
|
|
tax_rate varchar(255) null comment '税率',
|
|
process_type varchar(255) null comment '流程类型',
|
|
remark text null comment '备注',
|
|
attachment_uri text null comment '附件 JSON Array',
|
|
|
|
reviewed_id varchar(1024) null comment '审核过的人的ID',
|
|
current_audit varchar(255) null comment '当前审核人',
|
|
current_audit_id varchar(255) null comment '当前审核人ID逗号分割',
|
|
|
|
create_at datetime default CURRENT_TIMESTAMP comment '创建时间',
|
|
last_update_at datetime default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '最后更新时间'
|
|
|
|
) comment '项目对应的流程';
|
|
|
|
|
|
create table procurement_contract
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
procurement_mode varchar(255) null comment '采购模式',
|
|
payment_terms text null comment '付款条件',
|
|
supplier_name varchar(255) null comment '供应商名称',
|
|
process_id int comment '流程ID'
|
|
) comment '采购合同流程';
|
|
|
|
create table sale_contract
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
apply_person_phone varchar(255) null comment '申请人电话',
|
|
client_name varchar(255) null comment '客户名称',
|
|
payment_terms text null comment '收款条件',
|
|
process_id int comment '流程ID'
|
|
) comment '销售合同流程';
|
|
|
|
create table procurement_contract_supplier_material
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
company_name varchar(255) null comment '公司名称',
|
|
total_amount varchar(255) null comment '合计金额',
|
|
service_terms varchar(255) null comment '服务条款',
|
|
payment_terms varchar(255) null comment '付款条件',
|
|
tax_rate varchar(255) null comment '税率',
|
|
remark varchar(255) null comment '备注',
|
|
attachment varchar(1000) null comment '附件',
|
|
|
|
process_id int comment '流程ID',
|
|
contract_id int comment '采购合同ID'
|
|
) comment '采购合同流程的供应商材料';
|
|
|
|
create table procurement_contract_budget_purchase_amount
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
amount decimal(11, 2) not null comment '总共要采购数量',
|
|
amount_current decimal(11, 2) not null comment '本次采购数量',
|
|
submit bit default 0 not null comment '该流程是否提交,提交了才计算到已采购数量',
|
|
process_id int not null comment '流程ID',
|
|
contract_id int not null comment '采购合同ID',
|
|
budget_cost_id int not null comment '成本ID',
|
|
UNIQUE key (process_id, budget_cost_id)
|
|
) comment '采购合同流程预算采购明细的数量记录';
|
|
|
|
create table procurement_contract_budget_purchase_detail
|
|
(
|
|
id int auto_increment primary key comment 'ID',
|
|
supplier_name varchar(255) null comment '供应商名称',
|
|
manufacturer_name varchar(255) null comment '设备厂商名称',
|
|
purchase_list varchar(255) null comment '对应采购清单',
|
|
spec varchar(255) null comment '规格型号',
|
|
procurement_amount decimal(11, 2) null comment '对应采购数目',
|
|
procurement_price decimal(19, 5) null comment '采购单价',
|
|
total_tax_include decimal(19, 5) null comment '含税总金额(元)',
|
|
|
|
process_id int not null comment '流程ID',
|
|
contract_id int not null comment '采购合同ID',
|
|
amount_id int not null comment '记录数量表的ID',
|
|
budget_cost_id int not null comment '成本ID'
|
|
|
|
) comment '采购合同流程预算采购明细的详情';
|
|
|
|
|
|
alter table project_budget_income_detail
|
|
add expiration_date varchar(32) null comment '质保期'; |