mes-lqqt/doc/设计文档/数据库设计/mes-wm.sql
DESKTOP-J7ED0MB\yinjinlu c8e61fc6d8 库存脚本更新
2022-10-27 23:37:43 +08:00

996 lines
72 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ----------------------------
-- 1、仓库表
-- ----------------------------
drop table if exists wm_warehouse;
create table wm_warehouse (
warehouse_id bigint(20) not null auto_increment comment '仓库ID',
warehouse_code varchar(64) not null comment '仓库编码',
warehouse_name varchar(255) not null comment '仓库名称',
location varchar(500) comment '位置',
area double(12,2) comment '面积',
charge varchar(64) 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 (warehouse_id)
) engine=innodb auto_increment=200 comment = '仓库表';
-- ----------------------------
-- 2、库区表
-- ----------------------------
drop table if exists wm_storage_location;
create table wm_storage_location (
location_id bigint(20) not null auto_increment comment '库区ID',
location_code varchar(64) not null comment '库区编码',
location_name varchar(255) not null comment '库区名称',
warehouse_id bigint(20) not null comment '仓库ID',
area double(12,2) comment '面积',
area_flag char(1) default 'Y' 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 (location_id)
) engine=innodb auto_increment=200 comment = '库区表';
-- ----------------------------
-- 3、库位表
-- ----------------------------
drop table if exists wm_storage_area;
create table wm_storage_area (
area_id bigint(20) not null auto_increment comment '库位ID',
area_code varchar(64) not null comment '库位编码',
area_name varchar(255) not null comment '库位名称',
location_id bigint(20) not null comment '库区ID',
area double(8,2) comment '面积',
max_loa double(8,2) comment '最大载重量',
position_x int(11) comment '库位位置X',
position_y int(11) comment '库位位置y',
position_z int(11) comment '库位位置z',
enable_flag char(1) 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 (area_id)
) engine=innodb auto_increment=200 comment = '库位表';
-- ----------------------------
-- 4、库存事务表
-- ----------------------------
drop table if exists wm_transaction;
create table wm_transaction (
transaction_id bigint(20) not null auto_increment comment '事务ID',
transaction_type varchar(64) not null comment '事务类型',
item_id bigint(20) not null comment '产品物料ID',
item_code varchar(64) comment '产品物料编码',
item_name varchar(255) comment '产品物料名称',
specification varchar(500) comment '规格型号',
unit_of_measure varchar(64) comment '单位',
batch_code varchar(255) comment '入库批次号',
warehouse_id bigint(20) not null comment '仓库ID',
warehouse_code varchar(64) comment '仓库编码',
warehouse_name varchar(255) comment '仓库名称',
location_id bigint(20) comment '库区ID',
location_code varchar(64) comment '库区编码',
location_name varchar(255) comment '库区名称',
area_id bigint(20) comment '库位ID',
area_code varchar(64) comment '库位编码',
area_name varchar(255) comment '库位名称',
vendor_id bigint(20) comment '供应商ID',
vendor_code varchar(64) comment '供应商编号',
vendor_name varchar(255) comment '供应商名称',
vendor_nick varchar(64) comment '供应商简称',
source_doc_type varchar(64) comment '单据类型',
source_doc_id bigint(20) comment '单据ID',
source_doc_code varchar(64) comment '单据编号',
source_doc_line_id bigint(20) comment '单据行ID',
material_stock_id bigint(20) not null comment '库存记录ID',
transaction_flag int(1) default 1 comment '库存方向',
transaction_quantity double(12,2) comment '事务数量',
transaction_date datetime comment '事务日期',
related_transaction_id bigint(20) comment '关联的事务ID',
erp_date datetime comment 'ERP账期',
workorder_id bigint(20) comment '生产工单ID',
workorder_code varchar(64) comment '生产工单编号',
recpt_date datetime comment '接收日期',
expire_date datetime 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 (transaction_id)
) engine=innodb auto_increment=200 comment = '库存事务表';
-- ----------------------------
-- 5、库存记录表
-- ----------------------------
drop table if exists wm_material_stock;
create table wm_material_stock (
material_stock_id bigint(20) not null auto_increment comment '事务ID',
item_type_id bigint(20) comment '物料类型ID',
item_id bigint(20) not null comment '产品物料ID',
item_code varchar(64) comment '产品物料编码',
item_name varchar(255) comment '产品物料名称',
specification varchar(500) comment '规格型号',
unit_of_measure varchar(64) comment '单位',
batch_code varchar(255) comment '入库批次号',
warehouse_id bigint(20) not null comment '仓库ID',
warehouse_code varchar(64) comment '仓库编码',
warehouse_name varchar(255) comment '仓库名称',
location_id bigint(20) comment '库区ID',
location_code varchar(64) comment '库区编码',
location_name varchar(255) comment '库区名称',
area_id bigint(20) comment '库位ID',
area_code varchar(64) comment '库位编码',
area_name varchar(255) comment '库位名称',
vendor_id bigint(20) comment '供应商ID',
vendor_code varchar(64) comment '供应商编号',
vendor_name varchar(255) comment '供应商名称',
vendor_nick varchar(64) comment '供应商简称',
quantity_onhand double(12,2) comment '在库数量',
workorder_id bigint(20) comment '生产工单ID',
workorder_code varchar(64) comment '生产工单编号',
recpt_date datetime comment '入库时间',
expire_date datetime 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 (material_stock_id)
) engine=innodb auto_increment=200 comment = '库存记录表';
-- ----------------------------
-- 6、物料入库单表
-- ----------------------------
drop table if exists wm_item_recpt;
create table wm_item_recpt (
recpt_id bigint(20) not null auto_increment comment '入库单ID',
recpt_code varchar(64) not null comment '入库单编号',
recpt_name varchar(255) not null comment '入库单名称',
iqc_id bigint(20) comment '来料检验单ID',
iqc_code varchar(64) comment '来料检验单编号',
po_code varchar(64) comment '采购订单编号',
vendor_id bigint(20) comment '供应商ID',
vendor_code varchar(64) comment '供应商编码',
vendor_name varchar(255) comment '供应商名称',
vendor_nick varchar(255) comment '供应商简称',
warehouse_id bigint(20) comment '仓库ID',
warehouse_code varchar(64) comment '仓库编码',
warehouse_name varchar(255) comment '仓库名称',
location_id bigint(20) comment '库区ID',
location_code varchar(64) comment '库区编码',
location_name varchar(255) comment '库区名称',
area_id bigint(20) comment '库位ID',
area_code varchar(64) comment '库位编码',
area_name varchar(255) comment '库位名称',
recpt_date datetime comment '入库日期',
status varchar(64) default 'PREPARE' 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 (recpt_id)
) engine=innodb auto_increment=200 comment = '物料入库单表';
-- ----------------------------
-- 7、物料入库单行表
-- ----------------------------
drop table if exists wm_item_recpt_line;
create table wm_item_recpt_line (
line_id bigint(20) not null auto_increment comment '行ID',
recpt_id bigint(20) comment '入库单ID',
item_id bigint(20) not null comment '产品物料ID',
item_code varchar(64) comment '产品物料编码',
item_name varchar(255) comment '产品物料名称',
specification varchar(500) comment '规格型号',
unit_of_measure varchar(64) comment '单位',
quantity_recived double(12,2) not null comment '入库数量',
batch_code varchar(255) comment '入库批次号',
warehouse_id bigint(20) comment '仓库ID',
warehouse_code varchar(64) comment '仓库编码',
warehouse_name varchar(255) comment '仓库名称',
location_id bigint(20) comment '库区ID',
location_code varchar(64) comment '库区编码',
location_name varchar(255) comment '库区名称',
area_id bigint(20) comment '库位ID',
area_code varchar(64) comment '库位编码',
area_name varchar(255) comment '库位名称',
expire_date 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 (line_id)
) engine=innodb auto_increment=200 comment = '物料入库单行表';
-- ----------------------------
-- 8、供应商退货表
-- ----------------------------
drop table if exists wm_rt_vendor;
create table wm_rt_vendor (
rt_id bigint(20) not null auto_increment comment '退货单ID',
rt_code varchar(64) not null comment '退货单编号',
rt_name varchar(255) not null comment '退货单名称',
po_code varchar(64) comment '采购订单编号',
vendor_id bigint(20) comment '供应商ID',
vendor_code varchar(64) comment '供应商编码',
vendor_name varchar(255) comment '供应商名称',
vendor_nick varchar(255) comment '供应商简称',
batch_code varchar(255) comment '批次号',
rt_date datetime comment '退货日期',
status varchar(64) default 'PREPARE' 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 (rt_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 9、供应商退货行表
-- ----------------------------
drop table if exists wm_rt_vendor_line;
create table wm_rt_vendor_line (
line_id bigint(20) not null auto_increment comment 'ID',
rt_id bigint(20) comment '退ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_rted double(12,2) not null comment '退',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 10、生产领料单头表
-- ----------------------------
drop table if exists wm_issue_header;
create table wm_issue_header (
issue_id bigint(20) not null auto_increment comment 'ID',
issue_code varchar(64) not null comment '',
issue_name varchar(255) not null comment '',
workstation_id bigint(20) comment 'ID',
workstation_code varchar(64) comment '',
workstation_name varchar(255) comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
task_id bigint(20) comment 'ID',
task_code varchar(64) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
issue_date datetime comment '',
status varchar(64) default 'PREPARE' 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 (issue_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 11、生产领料单行表
-- ----------------------------
drop table if exists wm_issue_line;
create table wm_issue_line (
line_id bigint(20) not null auto_increment comment 'ID',
issue_id bigint(20) comment 'ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_issued double(12,2) not null comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 10、生产退料单头表
-- ----------------------------
drop table if exists wm_rt_issue;
create table wm_rt_issue (
rt_id bigint(20) not null auto_increment comment '退ID',
rt_code varchar(64) not null comment '退',
rt_name varchar(255) comment '退',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
rt_date datetime comment '退',
status varchar(64) default 'PREPARE' 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 (rt_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 11、生产领料单行表
-- ----------------------------
drop table if exists wm_rt_issue_line;
create table wm_rt_issue_line (
line_id bigint(20) not null auto_increment comment 'ID',
rt_id bigint(20) comment '退ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_rt double(12,2) not null comment '退',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 10、物料消耗记录表
-- ----------------------------
drop table if exists wm_item_consume;
create table wm_item_consume (
record_id bigint(20) not null auto_increment comment 'ID',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
workorder_name varchar(255) comment '',
task_id bigint(20) comment 'ID',
task_code varchar(64) comment '',
task_name varchar(255) comment '',
workstation_id bigint(20) comment 'ID',
workstation_code varchar(64) comment '',
workstation_name varchar(255) comment '',
process_id bigint(20) comment 'ID',
process_code varchar(64) comment '',
process_name varchar(255) comment '',
consume_date datetime comment '',
status varchar(64) default 'PREPARE' 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 = '';
-- ----------------------------
-- 11、物料消耗记录行表
-- ----------------------------
drop table if exists wm_item_consume_line;
create table wm_item_consume_line (
line_id bigint(20) not null auto_increment comment 'ID',
record_id bigint(20) comment 'ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_consume double(12,2) not null comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 8、产品产出记录表入线边库
-- ----------------------------
drop table if exists wm_product_produce;
create table wm_product_produce (
record_id bigint(20) not null auto_increment comment 'ID',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
workorder_name varchar(255) comment '',
task_id bigint(20) comment 'ID',
task_code varchar(64) comment '',
task_name varchar(255) comment '',
workstation_id bigint(20) comment 'ID',
workstation_code varchar(64) comment '',
workstation_name varchar(255) comment '',
process_id bigint(20) comment 'ID',
process_code varchar(64) comment '',
process_name varchar(255) comment '',
produce_date datetime comment '',
status varchar(64) default 'PREPARE' 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 = '';
-- ----------------------------
-- 11、产品产出记录表行表
-- ----------------------------
drop table if exists wm_product_produce_line;
create table wm_product_produce_line (
line_id bigint(20) not null auto_increment comment 'ID',
record_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_produce double(12,2) not null comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 12、产品入库录表线边库入正式库
-- ----------------------------
drop table if exists wm_product_recpt;
create table wm_product_recpt (
recpt_id bigint(20) not null auto_increment comment 'ID',
recpt_code varchar(64) not null comment '',
recpt_name varchar(255) comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
workorder_name varchar(255) comment '',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
recpt_date datetime comment '',
status varchar(64) default 'PREPARE' 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 (recpt_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 13、产品入库记录表行表
-- ----------------------------
drop table if exists wm_product_recpt_line;
create table wm_product_recpt_line (
line_id bigint(20) not null auto_increment comment 'ID',
recpt_id bigint(20) comment 'ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_recived double(12,2) not null comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
workorder_name varchar(255) comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 14、产品销售出库单表
-- ----------------------------
drop table if exists wm_product_salse;
create table wm_product_salse (
salse_id bigint(20) not null auto_increment comment 'ID',
salse_code varchar(64) not null comment '',
salse_name varchar(255) not null comment '',
oqc_id bigint(20) comment 'ID',
oqc_code varchar(64) comment '',
so_code varchar(64) comment '',
client_id bigint(20) comment 'ID',
client_code varchar(64) comment '',
client_name varchar(255) comment '',
client_nick varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
salse_date datetime comment '',
status varchar(64) default 'PREPARE' 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 (salse_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 15、产品销售出库行表
-- ----------------------------
drop table if exists wm_product_salse_line;
create table wm_product_salse_line (
line_id bigint(20) not null auto_increment comment 'ID',
salse_id bigint(20) comment 'ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_salse double(12,2) not null comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 16、产品销售退货单表
-- ----------------------------
drop table if exists wm_rt_salse;
create table wm_rt_salse (
rt_id bigint(20) not null auto_increment comment '退ID',
rt_code varchar(64) not null comment '退',
rt_name varchar(255) not null comment '退',
so_code varchar(64) comment '',
client_id bigint(20) comment 'ID',
client_code varchar(64) comment '',
client_name varchar(255) comment '',
client_nick varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
rt_date datetime comment '退',
rt_reason varchar(255) comment '退',
status varchar(64) default 'PREPARE' 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 (rt_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 17、产品销售退货行表
-- ----------------------------
drop table if exists wm_rt_salse_line;
create table wm_rt_salse_line (
line_id bigint(20) not null auto_increment comment 'ID',
rt_id bigint(20) comment '退ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_rted double(12,2) not null comment '退',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
expire_date 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 (line_id)
) engine=innodb auto_increment=200 comment = '退';
-- ----------------------------
-- 18、条码清单表
-- ----------------------------
drop table if exists wm_barcode;
create table wm_barcode (
barcode_id bigint(20) not null auto_increment comment 'ID',
barcode_formart varchar(64) not null comment '',
barcode_type varchar(64) not null comment '',
barcode_content varchar(255) not null comment '',
bussiness_id bigint(20) not null comment 'ID',
bussiness_code varchar(64) comment '',
bussiness_name varchar(255) comment '',
barcode_url varchar(255) comment '',
enable_flag char(1) default 'Y' 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 (barcode_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 18、条码配置
-- ----------------------------
drop table if exists wm_barcode_config;
create table wm_barcode_config (
config_id bigint(20) not null auto_increment comment 'ID',
barcode_formart varchar(64) not null comment '',
barcode_type varchar(64) not null comment '',
content_formart varchar(255) not null comment '',
content_example varchar(255) comment '',
auto_gen_flag char(1) default 'Y' comment '',
enable_flag char(1) default 'Y' 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 (config_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 19、装箱单表
-- ----------------------------
drop table if exists wm_package;
create table wm_package (
package_id bigint(20) not null auto_increment comment 'ID',
parent_id bigint(20) not null default 0 comment 'ID',
ancestors varchar(255) not null default 0 comment 'ID',
package_code varchar(64) comment '',
barcode_id bigint(20) comment 'ID',
barcode_content varchar(255) comment '',
barcode_url varchar(255) comment '',
package_date datetime not null comment '',
so_code varchar(64) comment '',
invoice_code varchar(255) comment '',
client_id bigint(20) comment 'ID',
client_code varchar(64) comment '',
client_name varchar(255) comment '',
client_nick varchar(255) comment '',
package_length double(12,4) comment '',
package_width double(12,4) comment '',
package_height double(12,4) comment '',
size_unit varchar(64) comment '',
net_weight double(12,4) comment '',
cross_weight double(12,4) comment '',
weight_unit varchar(64) comment '',
inspector varchar(64) comment '',
inspector_name varchar(64) comment '',
status varchar(64) default 'PREPARE' comment '',
enable_flag char(1) default 'Y' 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 (package_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 20、装箱明细表
-- ----------------------------
drop table if exists wm_package_line;
create table wm_package_line (
line_id bigint(20) not null auto_increment comment 'ID',
package_id bigint(20) not null comment 'ID',
material_stock_id bigint(20) comment 'ID',
item_id bigint(20) not null comment 'ID',
item_code varchar(64) comment '',
item_name varchar(255) comment '',
specification varchar(500) comment '',
unit_of_measure varchar(64) comment '',
quantity_package double(12,2) not null comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
batch_code varchar(255) comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name varchar(255) comment '',
location_id bigint(20) comment 'ID',
location_code varchar(64) comment '',
location_name varchar(255) comment '',
area_id bigint(20) comment 'ID',
area_code varchar(64) comment '',
area_name varchar(255) comment '',
expire_date 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 (line_id)
) engine=innodb auto_increment=200 comment = '';