kcw-wx-java/youchain-system/DB_SQL.sql

255 lines
15 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#2023-11-3 AGV
CREATE TABLE `base_agv_scene` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID',
`code` varchar(20) NOT NULL COMMENT '代码',
`name` varchar(20) NOT NULL COMMENT '名称',
`remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '备注',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '修改人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='AGV场景表';
ALTER TABLE `base_area` ADD COLUMN `agv_scene_id` bigint(20) DEFAULT NULL COMMENT 'avg场景id';
ALTER TABLE `base_item` ADD COLUMN `agv_scene_id` bigint(20) DEFAULT NULL COMMENT 'avg场景id';
#
INSERT INTO `sys_dict` (`dict_id`, `name`, `description`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (21, 'item_type', '货物类型', 'admin', 'admin', '2023-11-03 11:49:03', '2023-11-03 11:49:03');
INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (69, 21, '前桶', 'QT', 1, 'admin', 'admin', '2023-11-03 11:49:34', '2023-11-03 11:49:34');
INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (69, 21, '后桶', 'HT', 2, 'admin', 'admin', '2023-11-03 11:49:34', '2023-11-03 11:49:34');
INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (70, 21, '门封', 'MF', 3, 'admin', 'admin', '2023-11-03 13:39:13', '2023-11-03 13:39:13');
INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (71, 21, '小件', 'XJ', 4, 'admin', 'admin', '2023-11-03 13:39:24', '2023-11-03 13:39:24');
INSERT INTO `sys_dict_detail` (`detail_id`, `dict_id`, `label`, `value`, `dict_sort`, `create_by`, `update_by`, `create_time`, `update_time`) VALUES (72, 21, 'ZCZ', '轴承座', 5, 'admin', 'admin', '2023-11-03 13:39:39', '2023-11-03 13:39:39');
#
ALTER table data_asn_detail add point_id bigint(20) DEFAULT NULL COMMENT '点位序号';
#
alter table base_box add `IP` varchar(50) DEFAULT NULL COMMENT 'IP' ;
alter table base_box add `lamp_status` varchar(50) DEFAULT '0' COMMENT '指示灯状态';
alter table base_box add `lamp_code` varchar(50) DEFAULT NULL COMMENT '按钮盒编号';
#
CREATE TABLE `sys_lamp_log` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`ip` varchar(50) DEFAULT NULL COMMENT 'ip',
`button_box` varchar(50) DEFAULT NULL COMMENT '所属按钮盒',
`button_code` varchar(50) DEFAULT NULL COMMENT '按钮编码',
`operation_type` varchar(50) DEFAULT NULL COMMENT '操作类型',
`request_content` varchar(255) DEFAULT NULL COMMENT '请求内容',
`return_content` varchar(255) DEFAULT NULL COMMENT '返回内容',
`return_state` varchar(50) DEFAULT NULL COMMENT '返回状态',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '修改人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='指示灯日志';
#
update base_item it set it.good_type='ZC' where good_type='ZCZ';
#data_agv_task
alter table data_agv_task add `be_scan` int(11) DEFAULT NULL COMMENT '是否扫描' ;
update data_agv_task set be_scan=0 where be_scan is null ;
#
ALTER table base_point add item_code VARCHAR(50) COMMENT '点位物料编码';
#
alter table base_point add rows int(11) DEFAULT NULL COMMENT '' ;
alter table base_point add col int(11) DEFAULT NULL COMMENT '' ;
alter table base_point add line int(11) DEFAULT NULL COMMENT '' ;
update base_point set rows=0,col=0,line=0 where rows is null;
#
CREATE TABLE `base_zcjxb` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`modbus_tcp_task_finish` tinyint(1) DEFAULT '0' COMMENT 'Modbus-tcp的任务是否启用',
`modbus_tcp_point` varchar(255) DEFAULT NULL COMMENT 'Modbus-tcp对应的地标点',
`modbus_tcp_item` varchar(255) DEFAULT NULL COMMENT 'Modbus-tcp对应的物料',
`modbus_tcp_slave_id` int(11) DEFAULT NULL COMMENT '从机ID',
`task_off_on_a` tinyint(1) DEFAULT '0' COMMENT 'a车点位是否有任务',
`task_off_on_b` tinyint(1) DEFAULT '0' COMMENT 'b车点位是否有任务',
`code` int(11) DEFAULT NULL COMMENT '机械臂机台号',
`ip` varchar(100) NOT NULL COMMENT 'ip地址',
`port` int(11) NOT NULL COMMENT '端口号',
`communication_type` varchar(255) DEFAULT NULL COMMENT '通信类型',
`address` int(11) DEFAULT NULL COMMENT '地址',
`data_length` int(11) DEFAULT NULL COMMENT '数据长度',
`offset_a1` int(11) DEFAULT NULL COMMENT '偏移量-A返回空车',
`offset_b1` int(11) DEFAULT NULL COMMENT '偏移量-B返回空车',
`offset_a2` int(11) DEFAULT NULL COMMENT '偏移量-A叫料',
`offset_b2` int(11) DEFAULT NULL COMMENT '偏移量-B叫料',
`offset_a3` int(11) DEFAULT NULL COMMENT '偏移量-A车有料',
`offset_b3` int(11) DEFAULT NULL COMMENT '偏移量-B车有料',
`point_a1` varchar(255) DEFAULT NULL COMMENT 'A车的地标点',
`point_b1` varchar(255) DEFAULT NULL COMMENT 'B车的地标点',
`item_a1` varchar(255) DEFAULT NULL COMMENT 'A车的物料',
`item_b1` varchar(255) DEFAULT NULL COMMENT 'B车的物料',
`enabled` tinyint(1) DEFAULT '0' COMMENT '是否启用',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '更新人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COMMENT='机械臂';
#
ALTER TABLE `base_zcjxb` ADD COLUMN task_name varchar(255) DEFAULT NULL COMMENT '任务名称';
#
alter TABLE base_area add column working_station varchar(50) DEFAULT NULL COMMENT '所属工位';
alter TABLE base_area add column point_id bigint(20) DEFAULT NULL COMMENT '缓存库位';
alter TABLE base_area add column bexb tinyint(1) DEFAULT '0' COMMENT'线边接收';
alter TABLE base_area add column besh tinyint(1) DEFAULT '0' COMMENT'收货仓库';
alter TABLE base_area add column bezz tinyint(1) DEFAULT '0' COMMENT'制造库位耗用';
#
CREATE TABLE `base_production_plan` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID',
`enabled` bit(1) DEFAULT b'0' COMMENT '状态1启用、0禁用',
`big_item_id` bigint(20) DEFAULT NULL COMMENT '完成品番',
`working_station` varchar(50) DEFAULT NULL COMMENT '工位',
`No` int(7) DEFAULT NULL COMMENT 'No',
`machine_no` int(7) DEFAULT NULL COMMENT '机号',
`import_date` datetime DEFAULT NULL COMMENT '导入日期',
`planned_date` datetime DEFAULT NULL COMMENT '计划日期',
`downline_date` datetime DEFAULT NULL COMMENT '下线日期',
`take_up_time` datetime DEFAULT NULL COMMENT '耗用时间',
`IDNO` varchar(50) DEFAULT NULL COMMENT 'IDNO',
`monthly_no` varchar(255) DEFAULT NULL COMMENT '月度序号',
`project_no` varchar(255) DEFAULT NULL COMMENT '计划单号',
`make_line` varchar(255) DEFAULT NULL COMMENT '制造线',
`order_no` bigint(20) DEFAULT NULL COMMENT '序号',
`bom_list_id` bigint(20) DEFAULT NULL COMMENT '工位清单',
`sh_area_id` bigint(20) DEFAULT NULL COMMENT '收货仓库',
`rk_area_id` bigint(20) DEFAULT NULL COMMENT '入库库区',
`off_line_part_id` bigint(20) DEFAULT NULL COMMENT '下线零件ID',
`pick_plan_id` bigint(20) DEFAULT NULL COMMENT '备货计划ID',
`type` varchar(255) DEFAULT NULL COMMENT '出库类型',
`part_variety` varchar(255) DEFAULT NULL COMMENT '部品种类',
`statue` varchar(255) DEFAULT NULL COMMENT '耗用状态',
`auto_production_id` bigint(20) DEFAULT NULL COMMENT '所属自动计划',
`description` varchar(255) DEFAULT NULL COMMENT '描述',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '更新人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改日期',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `bpp_key` (`working_station`,`IDNO`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='生产顺序计划';
#
ALTER table base_item add point_id bigint(20) DEFAULT NULL COMMENT '库位';
#
CREATE TABLE `data_asn` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`code` varchar(20) CHARACTER SET utf8 NOT NULL COMMENT '单号',
`area_id` bigint(20) DEFAULT NULL COMMENT '库区',
`status` varchar(255) DEFAULT NULL COMMENT '状态',
`cus_code` varchar(255) DEFAULT NULL COMMENT '客户订单号',
`related_bill1` varchar(255) DEFAULT NULL COMMENT '相关单号1',
`related_bill2` varchar(255) DEFAULT NULL COMMENT '相关单号2',
`related_bill3` varchar(255) DEFAULT NULL COMMENT '相关单号3',
`order_date`datetime DEFAULT NULL DEFAULT NULL COMMENT '订单日期',
`estimate_date`datetime DEFAULT NULL COMMENT '预计到货日期',
`received_date`datetime DEFAULT NULL COMMENT '收货日期',
`from_name` varchar(255) DEFAULT NULL COMMENT '发货方',
`from_address` varchar(255) DEFAULT NULL COMMENT '发货地址',
`from_man` varchar(255) DEFAULT NULL COMMENT '发货联系人',
`from_tel` varchar(255) DEFAULT NULL COMMENT '发货电话',
`order_quantity` double DEFAULT '0' COMMENT '订单数量',
`received_quantity` double DEFAULT '0' COMMENT '收货数量',
`putaway_quantity` double DEFAULT '0' COMMENT '上架数量',
`vehicle` varchar(255) DEFAULT NULL COMMENT '车牌号',
`bill_type_id` varchar(255) DEFAULT NULL COMMENT '单据类型',
`dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID',
`description` varchar(255) DEFAULT NULL COMMENT '备注',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '修改人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `code` (`code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='收货管理';
#
ALTER table data_pick_detail add pick_ticket bigint(20) DEFAULT NULL COMMENT '出库管理主表';
#
CREATE TABLE `data_pick_ticket` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`area` bigint(20) DEFAULT NULL COMMENT '出库库区',
`sh_area` bigint(20) DEFAULT NULL COMMENT '收货库区',
`code` varchar(20) NOT NULL COMMENT '单号',
`status` varchar(255) DEFAULT NULL COMMENT '状态',
`cus_code` varchar(20) DEFAULT NULL COMMENT '客户订单号',
`related_bill1` varchar(255) DEFAULT NULL COMMENT '相关单号1',
`related_bill2` varchar(255) DEFAULT NULL COMMENT '相关单号2',
`related_bill3` varchar(255) DEFAULT NULL COMMENT '相关单号3',
`order_date` datetime DEFAULT NULL COMMENT '订单日期',
`ship_date` datetime DEFAULT NULL COMMENT '发货日期',
`fh_by` varchar(255) DEFAULT NULL COMMENT '发货人',
`received_date` datetime DEFAULT NULL COMMENT '到达日期',
`sl_by` varchar(255) DEFAULT NULL COMMENT '接收人',
`sl_qty` double DEFAULT '0' COMMENT '收料数量',
`tl_date` time DEFAULT NULL COMMENT '投料日期',
`tl_by` varchar(255) DEFAULT NULL COMMENT '投料人',
`tl_qty` double DEFAULT '0' COMMENT '投料数量',
`ship_to_name` varchar(255) DEFAULT NULL COMMENT '收货方',
`ship_address` varchar(255) DEFAULT NULL COMMENT '收货地址',
`ship_man` varchar(255) DEFAULT NULL COMMENT '收货联系人',
`ship_tel` varchar(255) DEFAULT NULL COMMENT '收货电话',
`order_quantity` double DEFAULT '0' COMMENT '订单数量',
`allocated_quantity` double DEFAULT '0' COMMENT '出单数量',
`picked_quantity` double DEFAULT '0' COMMENT '拣货数量',
`shipped_quantity` double DEFAULT '0' COMMENT '发运数量',
`xb_qty` double DEFAULT '0' COMMENT '线边数量',
`zt_qty` double DEFAULT '0' COMMENT '在途数量',
`xq_qty` double DEFAULT '0' COMMENT '需求数量',
`bh_qty` double DEFAULT '0' COMMENT '备货数量',
`vehicle` varchar(255) DEFAULT NULL COMMENT '车牌号',
`bill_type` bigint(20) DEFAULT NULL COMMENT '单据类型',
`bp_type` bigint(20) DEFAULT NULL COMMENT '部品种类',
`dept_id` bigint(20) DEFAULT NULL COMMENT '仓库ID',
`description` varchar(255) DEFAULT NULL COMMENT '备注',
`create_by` varchar(255) DEFAULT NULL COMMENT '创建人',
`update_by` varchar(255) DEFAULT NULL COMMENT '修改人',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `dpt` (`code`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='出库管理';
#
ALTER table data_pick_detail add `point_id` bigint(20) DEFAULT NULL COMMENT '点位';
# xppRecord
ALTER table `data_xpp_record` add `status` varchar(255) DEFAULT NULL COMMENT '状态';
ALTER TABLE `data_xpp_record` MODIFY COLUMN `nrs` INT(11);
# inventory
ALTER table `data_inventory` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区';
ALTER table `data_inventory` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位';
# InventoryLog
ALTER table `data_inventory_log` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区';
ALTER table `data_inventory_log` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位';
ALTER table `data_inventory_log` add `zckw` bigint(20) DEFAULT NULL COMMENT '暂存库位';
# Task
ALTER table `data_task` add `area_id` bigint(20) DEFAULT NULL COMMENT '库区';
ALTER table `data_task` add `zzkw` bigint(20) DEFAULT NULL COMMENT '制造库位';
# sys_dept
ALTER table `sys_dept` add `code` varchar(255) DEFAULT NULL COMMENT '代码';
#
ALTER table data_pick_ticket add `pure_req_qty` double DEFAULT '0' COMMENT '纯需求数量';
ALTER table data_pick_ticket add `prep_re` double DEFAULT '0' COMMENT '备货需求数量';
ALTER table data_pick_ticket add `out_order_date` datetime DEFAULT NULL COMMENT '出单日期';
ALTER table data_pick_ticket add `stocking_date` datetime DEFAULT NULL COMMENT '备货日期';
#
ALTER table data_pick_detail add `xq_qty` double DEFAULT '0' COMMENT '需求数量';
ALTER table data_pick_detail add `pure_req_qty` double DEFAULT '0' COMMENT '纯需求数量';
ALTER table data_pick_detail add `xb_qty` double DEFAULT '0' COMMENT '线边数量';
ALTER table data_pick_detail add `y_stk_demand_qty` double DEFAULT '0' COMMENT '原备货需求数量';
ALTER table data_pick_detail add `y_req_qty` double DEFAULT '0' COMMENT '原纯需求数';