mes-lqqt/doc/设计文档/数据库设计/mes-wm.sql
yinjinlu-pc\尹金路 9d1089843a 流转卡相关功能
2024-11-24 11:41:57 +08:00

1509 lines
110 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 UNIQUE comment '仓库编码',
warehouse_name varchar(255) not null comment '仓库名称',
location varchar(500) comment '位置',
area double(12,2) comment '面积',
charge varchar(64) comment '负责人',
enable_flag char(1) default 'N' 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 UNIQUE 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 UNIQUE 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 '库位名称',
pakcage_id bigint(20) comment '容器ID',
package_code varchar(64) 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 '批次号',
workorder_id bigint(20) comment '生产工单ID',
workorder_code varchar(64) comment '生产工单编号',
vendor_id bigint(20) comment '供应商ID',
vendor_code varchar(64) comment '供应商编号',
vendor_name varchar(255) comment '供应商名称',
vendor_nick 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) 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 '库位名称',
package_id bigint(20) comment '容器ID',
package_code varchar(64) comment '容器编号',
quantity_onhand double(12,2) comment '在库数量',
quantity_reserved double(12,2) comment '保留数量',
production_date datetime comment '生产日期',
recpt_date datetime comment '入库时间',
expire_date datetime comment '库存有效期',
frozen_flag char(1) default 'N' not null 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_arrival_notice;
create table wm_arrival_notice (
notice_id bigint(20) not null auto_increment comment '通知单ID',
notice_code varchar(64) not null comment '通知单编号',
notice_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 '供应商简称',
arrival_date datetime comment '到货日期',
contact varchar(64) comment '联系人',
tel varchar(128) 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 (notice_id)
) engine=innodb auto_increment=200 comment = '到货通知单表';
-- ----------------------------
-- 7、到货通知单行表
-- ----------------------------
drop table if exists wm_arrival_notice_line;
create table wm_arrival_notice_line (
line_id bigint(20) not null auto_increment comment '行ID',
notice_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_arrival double(12,2) not null comment '到货数量',
quantity_quanlified double(12,2) comment '合格数量',
iqc_check char(1) comment '是否来料检验',
iqc_id bigint(20) comment '来料检验单ID',
iqc_code 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 (line_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 '来料检验单编号',
notice_id bigint(20) comment '到货通知单ID',
notice_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',
notice_line_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 '有效期',
iqc_check char(1) comment '是否来料检验',
iqc_id bigint(20) comment '来料检验单ID',
iqc_code 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 (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 '生产任务编码',
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 '库位名称',
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 '',
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 = '';
-- ----------------------------
-- 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 '',
oqc_check char(1) comment '',
oqc_id bigint(20) comment 'ID',
oqc_code 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 (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 '',
default_template 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 (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 = '';
-- ----------------------------
-- 21、转移单表
-- ----------------------------
drop table if exists wm_transfer;
create table wm_transfer (
transfer_id bigint(20) not null auto_increment comment 'ID',
transfer_code varchar(64) not null comment '',
transfer_name varchar(255) comment '',
transfer_type varchar(64) not null comment '',
destination varchar(255) comment '',
carrier varchar(64) comment '',
booking_note varchar(64) comment '',
receiver varchar(64) comment '',
receiver_nick varchar(64) comment '',
from_warehouse_id bigint(20) comment 'ID',
from_warehouse_code varchar(64) comment '',
from_warehouse_name varchar(255) comment '',
to_warehouse_id bigint(20) comment 'ID',
to_warehouse_code varchar(64) comment '',
to_warehouse_name varchar(255) comment '',
transfer_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 (transfer_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 22、转移单行表
-- ----------------------------
drop table if exists wm_transfer_line;
create table wm_transfer_line (
line_id bigint(20) not null auto_increment comment 'ID',
transfer_id bigint(20) not null comment 'ID',
material_stock_id bigint(20) not null 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_transfer double(12,2) not null comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
batch_code varchar(255) comment '',
from_warehouse_id bigint(20) comment 'ID',
from_warehouse_code varchar(64) comment '',
from_warehouse_name varchar(255) comment '',
from_location_id bigint(20) comment 'ID',
from_location_code varchar(64) comment '',
from_location_name varchar(255) comment '',
from_area_id bigint(20) comment 'ID',
from_area_code varchar(64) comment '',
from_area_name varchar(255) comment '',
to_warehouse_id bigint(20) comment 'ID',
to_warehouse_code varchar(64) comment '',
to_warehouse_name varchar(255) comment '',
to_location_id bigint(20) comment 'ID',
to_location_code varchar(64) comment '',
to_location_name varchar(255) comment '',
to_area_id bigint(20) comment 'ID',
to_area_code varchar(64) comment '',
to_area_name varchar(255) comment '',
expire_date datetime comment '',
vendor_id bigint(20) comment 'ID',
vendor_code varchar(64) comment '',
vendor_name varchar(255) comment '',
vendor_nick 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 = '';
-- ----------------------------
-- 23、SN码表
-- ----------------------------
drop table if exists wm_sn;
create table wm_sn (
sn_id bigint(20) not null auto_increment comment 'SN码ID',
sn_code varchar(64) not null comment 'SN码',
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 '',
gen_date datetime comment '',
workorder_id bigint(20) comment 'ID',
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 (sn_id)
) engine=innodb auto_increment=200 comment = 'SN码表';
-- ----------------------------
-- 24、库存盘点记录表
-- ----------------------------
drop table if exists wm_stock_taking;
create table wm_stock_taking (
taking_id bigint(20) not null auto_increment comment 'ID',
taking_code varchar(64) not null comment '',
taking_name varchar(255) comment '',
taking_date datetime not null comment '',
user_name varchar(64) comment '',
nick_name varchar(64) comment '',
taking_type varchar(64) not null comment '',
warehouse_id bigint(20) comment 'ID',
warehouse_code varchar(64) comment '',
warehouse_name 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 (taking_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 25、库存盘点明细表
-- ----------------------------
drop table if exists wm_stock_taking_line;
create table wm_stock_taking_line (
line_id bigint(20) not null auto_increment comment 'ID',
taking_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 '',
unit_name varchar(64) comment '',
quantity int(11) not null default 1 comment '',
taking_quantity int(11) 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 '',
taking_status varchar(64) not null default 'LOSS' 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 = '';
-- ----------------------------
-- 26、库存盘点结果表
-- ----------------------------
drop table if exists wm_stock_taking_result;
create table wm_stock_taking_result (
result_id bigint(20) not null auto_increment comment 'ID',
taking_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 '',
unit_name varchar(64) comment '',
quantity int(11) not null default 1 comment '',
taking_quantity int(11) comment '',
taking_status varchar(64) not null default 'LOSS' 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 (result_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 27、外协领料单头表
-- ----------------------------
drop table if exists wm_outsource_issue;
create table wm_outsource_issue (
issue_id bigint(20) not null auto_increment comment 'ID',
issue_code varchar(64) not null comment '',
issue_name varchar(255) not null comment '',
workorder_id bigint(20) comment 'ID',
workorder_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 '',
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 = '';
-- ----------------------------
-- 28、外协领料单行表
-- ----------------------------
drop table if exists wm_outsource_issue_line;
create table wm_outsource_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 = '';
-- ----------------------------
-- 29、外协入库单表
-- ----------------------------
drop table if exists wm_outsource_recpt;
create table wm_outsource_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 '',
workorder_id bigint(20) comment 'ID',
workorder_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 = '';
-- ----------------------------
-- 30、外协入库单行表
-- ----------------------------
drop table if exists wm_outsource_recpt_line;
create table wm_outsource_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 '',
iqc_check char(1) comment '',
iqc_id bigint(20) comment 'ID',
iqc_code 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 (line_id)
) engine=innodb auto_increment=200 comment = '';
-- ----------------------------
-- 31、批次记录表
-- ----------------------------
drop table if exists wm_batch;
create table wm_batch (
batch_id bigint(20) not null auto_increment comment 'ID',
batch_code 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 '',
produce_date datetime comment '',
expire_date datetime comment '',
recpt_date datetime comment '',
vendor_id bigint(20) comment 'ID',
vendor_code varchar(64) comment '',
vendor_name varchar(255) comment '',
vendor_nick varchar(255) comment '',
client_id bigint(20) comment 'ID',
client_code varchar(64) comment '',
client_name varchar(255) comment '',
client_nick varchar(255) comment '',
co_code varchar(64) comment '',
po_code varchar(64) comment '',
workorder_id bigint(20) comment 'ID',
workorder_code varchar(64) comment '',
task_id bigint(20) comment 'ID',
task_code varchar(64) comment '',
workstation_id bigint(20) comment 'ID',
workstation_code varchar(64) comment '',
tool_id bigint(20) comment 'ID',
tool_code varchar(64) comment '',
mold_id bigint(20) comment 'ID',
mold_code varchar(64) comment '',
product_code varchar(128) comment '',
quality_status 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 (batch_id)
) engine=innodb auto_increment=200 comment = '';