库存添加UNIQUE约束

This commit is contained in:
yinjinlu-pc\尹金路 2023-03-05 13:30:51 +08:00
parent c439d98cef
commit 03de020440
3 changed files with 64 additions and 7 deletions

View File

@ -201,13 +201,13 @@ drop table if exists dv_repair_line;
create table dv_repair_line ( create table dv_repair_line (
line_id bigint(20) not null auto_increment comment '行ID', line_id bigint(20) not null auto_increment comment '行ID',
repair_id bigint(20) not null comment '维修单ID', repair_id bigint(20) not null comment '维修单ID',
subject_id bigint(20) not null comment '项目ID', subject_id bigint(20) comment '项目ID',
subject_code varchar(64) not null comment '项目编码', subject_code varchar(64) comment '项目编码',
subject_name varchar(255) comment '项目名称', subject_name varchar(255) comment '项目名称',
subject_type varchar(64) comment '项目类型', subject_type varchar(64) comment '项目类型',
subject_content varchar(500) not null comment '项目内容', subject_content varchar(500) comment '项目内容',
subject_standard varchar(255) comment '标准', subject_standard varchar(255) comment '标准',
malfunction varchar(500) comment '故障描述', malfunction varchar(500) not null comment '故障描述',
malfunction_url varchar(255) comment '故障描述资源', malfunction_url varchar(255) comment '故障描述资源',
repair_des varchar(500) comment '维修情况', repair_des varchar(500) comment '维修情况',
remark varchar(500) default '' comment '备注', remark varchar(500) default '' comment '备注',

View File

@ -385,6 +385,7 @@ create table pro_trans_order (
item_name varchar(255) not null comment '产品物料名称', item_name varchar(255) not null comment '产品物料名称',
specification varchar(500) default null comment '规格型号', specification varchar(500) default null comment '规格型号',
unit_of_measure varchar(64) not null comment '单位', unit_of_measure varchar(64) not null comment '单位',
barcode_url varchar(255) comment '赋码地址',
quantity_transfered double(12,2) comment '流转数量', quantity_transfered double(12,2) comment '流转数量',
produce_date datetime comment '生产日期', produce_date datetime comment '生产日期',
remark varchar(500) default '' comment '备注', remark varchar(500) default '' comment '备注',
@ -440,3 +441,59 @@ create table pro_trans_consume (
primary key (record_id) primary key (record_id)
) engine=innodb auto_increment=200 comment = '物料消耗记录表'; ) engine=innodb auto_increment=200 comment = '物料消耗记录表';
-- ----------------------------
-- 4、上下工记录表
-- ----------------------------
drop table if exists pro_workrecord;
create table pro_workrecord (
record_id bigint(20) not null auto_increment comment '记录ID',
user_id bigint(20) not null comment '用户ID',
user_name varchar(64) comment '用户名',
nick_name bigint(125) comment '名称',
workstation_id bigint(20) not null comment '工作站ID',
workstation_code varchar(64) comment '工作站编号',
workstation_name varchar(125) comment '工作站名称',
operation_flag char(1) not null comment '操作类型',
operation_time datetime comment '操作时间',
remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (record_id)
) engine=innodb auto_increment=200 comment = '上下工记录表';
-- ----------------------------
-- 4、用户工作站绑定关系
-- ----------------------------
drop table if exists pro_user_workstation;
create table pro_user_workstation (
record_id bigint(20) not null auto_increment comment '记录ID',
user_id bigint(20) not null comment '用户ID',
user_name varchar(64) comment '用户名',
nick_name bigint(125) comment '名称',
workstation_id bigint(20) not null comment '工作站ID',
workstation_code varchar(64) comment '工作站编号',
workstation_name varchar(125) comment '工作站名称',
operation_time datetime comment '操作时间',
remark varchar(500) default '' comment '备注',
attr1 varchar(64) default null comment '预留字段1',
attr2 varchar(255) default null comment '预留字段2',
attr3 int(11) default 0 comment '预留字段3',
attr4 int(11) default 0 comment '预留字段4',
create_by varchar(64) default '' comment '创建者',
create_time datetime comment '创建时间',
update_by varchar(64) default '' comment '更新者',
update_time datetime comment '更新时间',
primary key (record_id)
) engine=innodb auto_increment=200 comment = '用户工作站绑定关系';

View File

@ -4,7 +4,7 @@
drop table if exists wm_warehouse; drop table if exists wm_warehouse;
create table wm_warehouse ( create table wm_warehouse (
warehouse_id bigint(20) not null auto_increment comment '仓库ID', warehouse_id bigint(20) not null auto_increment comment '仓库ID',
warehouse_code varchar(64) not null comment '仓库编码', warehouse_code varchar(64) not null UNIQUE comment '仓库编码',
warehouse_name varchar(255) not null comment '仓库名称', warehouse_name varchar(255) not null comment '仓库名称',
location varchar(500) comment '位置', location varchar(500) comment '位置',
area double(12,2) comment '面积', area double(12,2) comment '面积',
@ -30,7 +30,7 @@ create table wm_warehouse (
drop table if exists wm_storage_location; drop table if exists wm_storage_location;
create table wm_storage_location ( create table wm_storage_location (
location_id bigint(20) not null auto_increment comment '库区ID', location_id bigint(20) not null auto_increment comment '库区ID',
location_code varchar(64) not null comment '库区编码', location_code varchar(64) not null UNIQUE comment '库区编码',
location_name varchar(255) not null comment '库区名称', location_name varchar(255) not null comment '库区名称',
warehouse_id bigint(20) not null comment '仓库ID', warehouse_id bigint(20) not null comment '仓库ID',
area double(12,2) comment '面积', area double(12,2) comment '面积',
@ -54,7 +54,7 @@ create table wm_storage_location (
drop table if exists wm_storage_area; drop table if exists wm_storage_area;
create table wm_storage_area ( create table wm_storage_area (
area_id bigint(20) not null auto_increment comment '库位ID', area_id bigint(20) not null auto_increment comment '库位ID',
area_code varchar(64) not null comment '库位编码', area_code varchar(64) not null UNIQUE comment '库位编码',
area_name varchar(255) not null comment '库位名称', area_name varchar(255) not null comment '库位名称',
location_id bigint(20) not null comment '库区ID', location_id bigint(20) not null comment '库区ID',
area double(8,2) comment '面积', area double(8,2) comment '面积',