/*
 Navicat Premium Data Transfer

 Source Server         : localhost-57
 Source Server Type    : MySQL
 Source Server Version : 50743
 Source Host           : localhost:3306
 Source Schema         : ma_sgzb_bns

 Target Server Type    : MySQL
 Target Server Version : 50743
 File Encoding         : 65001

 Date: 25/09/2024 14:47:27
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for back_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `back_apply_details`;
CREATE TABLE `back_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料单号',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '规格ID',
  `pre_num` int(11) NULL DEFAULT 0 COMMENT '申请数量',
  `audit_num` int(11) NULL DEFAULT 0 COMMENT '审批数量',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态(0待审批，1进行中，2已出库，3已驳回)',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '退料任务详细表back_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for back_apply_info
-- ----------------------------
DROP TABLE IF EXISTS `back_apply_info`;
CREATE TABLE `back_apply_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料单号',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `back_person` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料人',
  `phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `direct_audit_by` int(11) NULL DEFAULT 0 COMMENT '机具公司审批人',
  `direct_audit_time` datetime NULL DEFAULT NULL COMMENT '机具公司审批时间',
  `direct_audit_remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具公司审批备注',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `back_time` datetime NULL DEFAULT NULL COMMENT '预退料时间',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '1.机具分公司审核通过，2.机具分公司审批不通过，3.调试分公司审批通过，4.调试分公司审批不通过，5.出库进行中，6.出库完成',
  `direct_id` int(11) NULL DEFAULT NULL COMMENT '直转id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '退料任务表back_apply_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for back_check_details
-- ----------------------------
DROP TABLE IF EXISTS `back_check_details`;
CREATE TABLE `back_check_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '规格ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `back_num` int(11) NULL DEFAULT 0 COMMENT '退料数量',
  `back_status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料状态(1合格，2维修，3待报废)',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `is_finished` tinyint(4) NULL DEFAULT NULL COMMENT '0:未完成退料,可以撤回 1:已完成退料,不能撤回',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '退料核查back_check_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_agreement_info
-- ----------------------------
DROP TABLE IF EXISTS `bm_agreement_info`;
CREATE TABLE `bm_agreement_info`  (
  `agreement_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '协议ID',
  `agreement_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '协议编号',
  `sign_time` datetime NOT NULL COMMENT '签订日期',
  `unit_id` int(11) NULL DEFAULT NULL COMMENT '往来单位id',
  `project_id` int(11) NULL DEFAULT 0 COMMENT '工程标段ID',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `lease_day` int(11) NULL DEFAULT NULL COMMENT '租赁天数',
  `plan_start_time` datetime NULL DEFAULT NULL COMMENT '计划开始时间',
  `contract_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '合同',
  `auth_person` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '授权人',
  `phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `file_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名',
  `file_url` varchar(5000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件URL',
  `status` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '0删除1启用',
  `protocol` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '1内部单位  2外部单位',
  `is_slt` int(11) NULL DEFAULT 0 COMMENT '是否结算（0 结算中 1已结算）',
  PRIMARY KEY (`agreement_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '协议管理bm_agreement_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_config
-- ----------------------------
DROP TABLE IF EXISTS `bm_config`;
CREATE TABLE `bm_config`  (
  `config_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '参数主键',
  `config_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数名称',
  `config_key` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键名',
  `config_value` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '参数键值',
  `config_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'N' COMMENT '系统内置（Y是 N否）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`config_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '功能参数配置表ma_config' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_file_info
-- ----------------------------
DROP TABLE IF EXISTS `bm_file_info`;
CREATE TABLE `bm_file_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `model_id` int(11) NULL DEFAULT NULL COMMENT '模块id',
  `file_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名称',
  `file_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件路径',
  `dic_id` int(11) NULL DEFAULT NULL COMMENT '数据字典',
  `create_by` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 570 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '附件表\r\n' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_notice_info
-- ----------------------------
DROP TABLE IF EXISTS `bm_notice_info`;
CREATE TABLE `bm_notice_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `task_id` int(11) NOT NULL COMMENT '任务ID',
  `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '通知内容',
  `notice_user` int(11) NULL DEFAULT NULL COMMENT '被通知人',
  `phone` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '手机号',
  `model_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模块名称',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '短信通知表bm_notice_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_project
-- ----------------------------
DROP TABLE IF EXISTS `bm_project`;
CREATE TABLE `bm_project`  (
  `pro_id` int(11) NOT NULL COMMENT '主键ID',
  `pro_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工程项目名称',
  `external_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '关联外部(第三方)的工程ID',
  `external_info` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '外部(第三方)的工程详情json',
  `pro_type_id` varchar(244) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工程类型(0线路,1变电,2施工)',
  `lon` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '经度',
  `lat` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维度',
  `pro_manager` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '项目经理',
  `telphone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `plan_start_date` date NULL DEFAULT NULL COMMENT '计划开工日期',
  `plan_end_date` date NULL DEFAULT NULL COMMENT '计划结束日期',
  `actual_start_date` date NULL DEFAULT NULL COMMENT '实际开工日期',
  `actual_end_date` date NULL DEFAULT NULL COMMENT '实际完工日期',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  PRIMARY KEY (`pro_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '标段工程管理bm_project' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_qrcode_info
-- ----------------------------
DROP TABLE IF EXISTS `bm_qrcode_info`;
CREATE TABLE `bm_qrcode_info`  (
  `qr_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '二维码ID',
  `qr_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '二维码',
  `type_id` int(11) NOT NULL COMMENT '类型ID',
  `qr_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '二维码类型',
  `task_id` int(11) NULL DEFAULT 0 COMMENT '任务ID',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`qr_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '二维码管理bm_qrcode_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_storage_log
-- ----------------------------
DROP TABLE IF EXISTS `bm_storage_log`;
CREATE TABLE `bm_storage_log`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `model_title` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '模块',
  `method` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '方法',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '规格id',
  `pre_store_num` int(11) NULL DEFAULT NULL COMMENT '操作前库存数量',
  `in_num` int(11) NULL DEFAULT NULL COMMENT '入库数量',
  `out_num` int(11) NULL DEFAULT NULL COMMENT '出库数量',
  `back_num` int(11) NULL DEFAULT NULL COMMENT '退库接收-总数量',
  `pass_num` int(11) NULL DEFAULT NULL COMMENT '退库接收-合格数量',
  `maintenance_num` int(11) NULL DEFAULT NULL COMMENT '退库接收-维修数量',
  `scrap_num` int(11) NULL DEFAULT NULL COMMENT '退库接收-报废数量',
  `post_store_num` int(11) NULL DEFAULT NULL COMMENT '操作后库存',
  `task_id` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '任务id',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议id',
  `manage_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出库类型 0编码出库  1数量出库 2成套出库',
  `type_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型名称',
  `type_model_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格型号',
  `result_code` int(11) NULL DEFAULT NULL COMMENT 'http code',
  `result_msg` varchar(3000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT 'http msg',
  `remark` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `status` int(11) NULL DEFAULT NULL COMMENT '状态：默认0，其他为异常状态',
  `json_result` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'json_result',
  `creator` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '库存日志bm_storage_log' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for bm_unit
-- ----------------------------
DROP TABLE IF EXISTS `bm_unit`;
CREATE TABLE `bm_unit`  (
  `unit_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
  `unit_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '单位类型名称',
  `status` char(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `type_id` bigint(20) NULL DEFAULT NULL COMMENT '单位类型',
  `link_man` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人',
  `telphone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属组织',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`unit_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '往来单位管理bm_unit' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for bm_unit_person
-- ----------------------------
DROP TABLE IF EXISTS `bm_unit_person`;
CREATE TABLE `bm_unit_person`  (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `unit_id` bigint(20) NOT NULL COMMENT '类型ID',
  `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`, `unit_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '往来单位管理bm_unit_person' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for input_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `input_apply_details`;
CREATE TABLE `input_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '规格ID',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '上级任务ID',
  `input_num` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `input_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '入库类型（1新购，2退料，3修试后，4盘点）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '入库任务详细表input_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for iot_machine
-- ----------------------------
DROP TABLE IF EXISTS `iot_machine`;
CREATE TABLE `iot_machine`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'iot设备id',
  `iot_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'iot设备类型',
  `iot_code` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'iot设备编码',
  `iot_status` tinyint(1) NULL DEFAULT NULL COMMENT 'iot设备状态（0 在线， 1 下线）',
  `qr_code` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'iot设备二维码',
  `bind_status` tinyint(1) NULL DEFAULT NULL COMMENT 'iot设备绑定状态（0 已绑定，1 未绑定）',
  `del_flag` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'iot设备管理表iot_machine' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for iot_machine_bind
-- ----------------------------
DROP TABLE IF EXISTS `iot_machine_bind`;
CREATE TABLE `iot_machine_bind`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `iot_id` bigint(20) NOT NULL COMMENT 'iot设备id',
  `type_id` bigint(20) NULL DEFAULT NULL COMMENT '设备类型id',
  `ma_code` varchar(90) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '被绑定机具编号',
  `binder` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '绑定人',
  `bind_time` datetime NULL DEFAULT NULL COMMENT '绑定时间',
  `unbinder` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '解绑人',
  `unbind_time` datetime NULL DEFAULT NULL COMMENT '解绑时间',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'iot设备类型绑定表iot_machine_bind' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_agreement_record
-- ----------------------------
DROP TABLE IF EXISTS `lease_agreement_record`;
CREATE TABLE `lease_agreement_record`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态',
  `out_time` datetime NULL DEFAULT NULL COMMENT '领料时间',
  `pick_id` int(11) NULL DEFAULT NULL COMMENT '领料任务',
  `back_time` datetime NULL DEFAULT NULL COMMENT '退料时间',
  `back_id` int(11) NULL DEFAULT NULL COMMENT '退料任务',
  `is_slt` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否结算',
  `slt_time` datetime NULL DEFAULT NULL COMMENT '结算时间',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目领退表lease_agreement_record' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `lease_apply_details`;
CREATE TABLE `lease_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `parennt_id` int(11) NOT NULL COMMENT '任务ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `pre_num` int(11) NULL DEFAULT 0 COMMENT '预领料数',
  `audit_num` int(11) NULL DEFAULT 0 COMMENT '审批数量',
  `al_num` int(11) NULL DEFAULT 0 COMMENT '已领数量',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态（0待审批，1进行中，2已出库）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '领料任务详细表lease_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_apply_info
-- ----------------------------
DROP TABLE IF EXISTS `lease_apply_info`;
CREATE TABLE `lease_apply_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料单号',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `lease_person` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料人',
  `phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '1：1级审批，2：2级审批',
  `company_audit_by` int(11) NULL DEFAULT 0 COMMENT '公司审批人',
  `company_audit_time` datetime NULL DEFAULT NULL COMMENT '公司审批时间',
  `company_audit_remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '公司审批备注',
  `dept_audit_by` int(11) NULL DEFAULT NULL COMMENT '分管审批人',
  `dept_audit_time` datetime NULL DEFAULT NULL COMMENT '分管审批时间',
  `dept_audit_remark` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '分管审批备注',
  `direct_audit_by` int(11) NULL DEFAULT NULL COMMENT '机具分公司审批',
  `direct_audit_time` datetime NULL DEFAULT NULL COMMENT '机具分公司审批时间',
  `direct_audit_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具分公司审批备注',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `status` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '1机具分公司审核通过，2调试分公司审核通过3机具分公司审核驳回4调试分公司审核驳回5出库进行中5出库完成',
  `direct_id` int(11) NULL DEFAULT NULL,
  `lease_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0工程1长期',
  `estimate_lease_time` datetime NULL DEFAULT NULL COMMENT '预领料时间',
  `cost_bearing_party` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '费用承担方(01项目03分包)',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '领料任务表lease_apply_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_out_details
-- ----------------------------
DROP TABLE IF EXISTS `lease_out_details`;
CREATE TABLE `lease_out_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '规格ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `out_num` int(11) NULL DEFAULT 0 COMMENT '预领料数',
  `out_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出库类型',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `car_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '车牌号',
  `push_notifications` int(11) NULL DEFAULT 0 COMMENT '是否推送到智慧工程0：否，1:是',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '领料出库详细表lease_out_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_scene_regist
-- ----------------------------
DROP TABLE IF EXISTS `lease_scene_regist`;
CREATE TABLE `lease_scene_regist`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议ID',
  `team_id` int(11) NULL DEFAULT NULL COMMENT '班组ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `create_time` datetime NULL DEFAULT NULL COMMENT '时间',
  `type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型1领料2退料',
  `registrant` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '登记人',
  `telephone` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目部出入记录表lease_agreement_storage' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_team_info
-- ----------------------------
DROP TABLE IF EXISTS `lease_team_info`;
CREATE TABLE `lease_team_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `team_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组名称',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '项目部班组管理lease_team_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for lease_user_book
-- ----------------------------
DROP TABLE IF EXISTS `lease_user_book`;
CREATE TABLE `lease_user_book`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格ID',
  `book_num` int(11) NULL DEFAULT 0 COMMENT '预约数量',
  `book_time` datetime NULL DEFAULT NULL COMMENT '预约时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '预约车lease_user_book' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_device_manage
-- ----------------------------
DROP TABLE IF EXISTS `ma_device_manage`;
CREATE TABLE `ma_device_manage`  (
  `device_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `item_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物品种类',
  `device_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备类型',
  `specs_model` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格型号',
  `device_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号',
  `device_status` int(11) NULL DEFAULT NULL COMMENT '设备状态(1,在库 2,在用)',
  `fixed_assets_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '固定资产编号',
  `device_original_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备原编号',
  `purchase_batch` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '购置批次',
  `lebel_id` bigint(20) NULL DEFAULT NULL COMMENT '绑定标签id',
  `house_id` bigint(20) NULL DEFAULT NULL COMMENT '仓库id',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`device_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具设备管理ma_device_manage' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_input_record
-- ----------------------------
DROP TABLE IF EXISTS `ma_input_record`;
CREATE TABLE `ma_input_record`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `type_id` int(11) NOT NULL COMMENT '类型ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `input_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '入库类型(1新购入库，2退料入库，3修试后入库)',
  `input_num` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态（0删除，1正常）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_create_time`(`create_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '入库记录表ma_input_record' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_label_bind
-- ----------------------------
DROP TABLE IF EXISTS `ma_label_bind`;
CREATE TABLE `ma_label_bind`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `ma_id` bigint(20) NOT NULL COMMENT '机具ID',
  `label_code` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签编号',
  `type_id` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型ID',
  `bind_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '绑定时间',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `binder` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '绑定人',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '0已解绑 1已绑定',
  `label_type` bigint(20) NULL DEFAULT NULL COMMENT '标签类型(数据字典)',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具设备标签ma_label_bind' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_machine
-- ----------------------------
DROP TABLE IF EXISTS `ma_machine`;
CREATE TABLE `ma_machine`  (
  `ma_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '机具ID',
  `type_id` bigint(20) NOT NULL COMMENT '类型ID',
  `ma_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具编号',
  `pre_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原编号',
  `ma_status` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具状态（数据字典）',
  `qr_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '二维码',
  `buy_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '购置价格',
  `ma_vender` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂家',
  `out_fac_time` datetime NULL DEFAULT NULL COMMENT '出厂日期',
  `out_fac_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '出厂编号',
  `assets_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '固定资产编号',
  `check_man` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '本次检验人',
  `this_check_time` datetime NULL DEFAULT NULL COMMENT '本次检验日期',
  `next_check_time` datetime NULL DEFAULT NULL COMMENT '下次检验日期',
  `gps_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'gps编号',
  `rfid_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'rfid编号',
  `erp_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'erp编号',
  `transfer_code` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '调拨编号',
  `in_out_num` int(11) NULL DEFAULT 0 COMMENT '出入库次数',
  `buy_task` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '购置批次',
  `own_house` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所在仓库',
  `company_id` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `inspect_man` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检验人员',
  `inspect_status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '检验结论',
  `phone` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
  PRIMARY KEY (`ma_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具设备管理ma_machine' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_machine_append
-- ----------------------------
DROP TABLE IF EXISTS `ma_machine_append`;
CREATE TABLE `ma_machine_append`  (
  `ma_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '机具ID',
  `pick_id` bigint(20) NOT NULL COMMENT '领料任务ID',
  `back_id` bigint(20) NULL DEFAULT NULL COMMENT '退料任务ID',
  `agreement_id` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具编号',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`ma_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具设备最近领退信息ma_machine' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_machine_label
-- ----------------------------
DROP TABLE IF EXISTS `ma_machine_label`;
CREATE TABLE `ma_machine_label`  (
  `label_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '标签ID',
  `label_code` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '标签编号',
  `ma_id` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具ID',
  `is_bind` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否绑定',
  `label_type` bigint(20) NULL DEFAULT NULL COMMENT '标签类型(数据字典)',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`label_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具设备标签ma_machine_label' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_part_repair
-- ----------------------------
DROP TABLE IF EXISTS `ma_part_repair`;
CREATE TABLE `ma_part_repair`  (
  `part_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`part_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修班配件配置ma_part_repair' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_part_type
-- ----------------------------
DROP TABLE IF EXISTS `ma_part_type`;
CREATE TABLE `ma_part_type`  (
  `pa_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
  `pa_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型名称',
  `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '上级ID',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `storage_num` int(11) NULL DEFAULT 0 COMMENT '实时库存',
  `unit_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计量单位ID',
  `buy_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '原值',
  `level` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '层级',
  `warn_num` int(11) NULL DEFAULT 0 COMMENT '库存预警数量',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `year` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '框架年份',
  PRIMARY KEY (`pa_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '配件类型管理ma_part_type' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_prop_info
-- ----------------------------
DROP TABLE IF EXISTS `ma_prop_info`;
CREATE TABLE `ma_prop_info`  (
  `prop_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '资产ID',
  `prop_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '资产名称',
  `code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '资产编号',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `dept_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '组织ID',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`prop_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产管理ma_prop_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_prop_set
-- ----------------------------
DROP TABLE IF EXISTS `ma_prop_set`;
CREATE TABLE `ma_prop_set`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `prop_id` bigint(20) NOT NULL COMMENT '资产ID',
  `type_id` bigint(20) NULL DEFAULT NULL COMMENT '类型ID',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '资产属性配置ma_prop_set' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_supplier_info
-- ----------------------------
DROP TABLE IF EXISTS `ma_supplier_info`;
CREATE TABLE `ma_supplier_info`  (
  `supplier_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '仓库ID',
  `supplier` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '名称',
  `address` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '地址',
  `legal_person` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '法人代表',
  `primary_contact` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '主要联系人',
  `phone` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系方式',
  `business_scope` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '经营范围',
  `business_license` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '营业执照',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` char(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `status` int(11) NULL DEFAULT NULL COMMENT '状态(0开 1关)',
  PRIMARY KEY (`supplier_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '供应商管理ma_supplier_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type
-- ----------------------------
DROP TABLE IF EXISTS `ma_type`;
CREATE TABLE `ma_type`  (
  `type_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
  `type_name` varchar(90) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '类型名称',
  `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '上级ID',
  `storage_num` int(11) NULL DEFAULT 0 COMMENT '实时库存',
  `type_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型编号',
  `model_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格编号',
  `unit_id` int(11) NULL DEFAULT NULL COMMENT '计量单位ID',
  `manage_type` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '管理方式(0编号 1计数)',
  `lease_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '内部租赁单价',
  `eff_time` datetime NULL DEFAULT NULL COMMENT '租赁费用生效时间',
  `rent_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '外部租赁单价',
  `buy_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '采购价原值',
  `pay_ratio` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '丢失赔偿比率',
  `level` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '层级',
  `rated_load` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '额定载荷',
  `test_load` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '试验载荷',
  `holding_time` datetime NULL DEFAULT NULL COMMENT '持荷时间',
  `warn_num` int(11) NULL DEFAULT 0 COMMENT '库存预警数量',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `is_plan` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否计划管理（0代表否 1代表是）',
  `is_ancuo` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否安措费机具（0代表否1代表是）',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `fac_model` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂家规格型号',
  `intelligent_code` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '推送智慧工程定义的门类分类机具编码',
  PRIMARY KEY (`type_id`) USING BTREE,
  INDEX `idx_parent_id`(`parent_id`) USING BTREE,
  INDEX `idx_level`(`level`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具类型管理ma_type' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_keeper
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_keeper`;
CREATE TABLE `ma_type_keeper`  (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `type_id` bigint(20) NOT NULL COMMENT '类型ID',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`ID`, `type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '库管员配置ma_type_keeper' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_lease_price_his
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_lease_price_his`;
CREATE TABLE `ma_type_lease_price_his`  (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `type_id` bigint(20) NOT NULL COMMENT '类型ID',
  `lease_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '内部租赁价格',
  `new_lease_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '内部租赁价格(新)',
  `price_prop` tinyint(4) NULL DEFAULT 0 COMMENT '价格属性(0当前价格 1历史价格)',
  `start_date` date NULL DEFAULT NULL COMMENT '生效开始日期',
  `end_date` date NULL DEFAULT NULL COMMENT '生效结束日期',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`, `type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具类型历史价格ma_type_lease_price_his' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_num_his
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_num_his`;
CREATE TABLE `ma_type_num_his`  (
  `type_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
  `storage_num` int(11) NULL DEFAULT 0 COMMENT '历史库存',
  `save_time` datetime NULL DEFAULT NULL COMMENT '存入日期',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '机具类型历史库存ma_type_num_his' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_put_in_storage_details
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_put_in_storage_details`;
CREATE TABLE `ma_type_put_in_storage_details`  (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `INFO` int(11) NULL DEFAULT NULL COMMENT '主信息',
  `NUM` int(11) NULL DEFAULT 0 COMMENT '数量',
  `RAM` int(11) NULL DEFAULT NULL COMMENT '库房',
  `TYPE` int(11) NULL DEFAULT NULL COMMENT '设备工器具类型',
  `MACODE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备编号',
  `MACHINE` int(11) NULL DEFAULT NULL COMMENT '设备主键',
  `REMARKS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '盘点入库详情ma_type_put_in_storage_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_put_in_storage_info
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_put_in_storage_info`;
CREATE TABLE `ma_type_put_in_storage_info`  (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `PUT_IN_TYPE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '入库形式（库存盘点入库，退料入库）',
  `NUM` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `CREATOR` int(11) NULL DEFAULT NULL COMMENT '创建者',
  `CODE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '盘点入库单号',
  `UNIT_ID` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单位名称',
  `PROJECT_ID` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '工程名称',
  `CREATE_DATE` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建日期',
  `REMARKS` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `TYPE` int(11) NULL DEFAULT NULL COMMENT '设备工器具类型',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '盘点入库信息ma_type_put_in_storage_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_type_repair
-- ----------------------------
DROP TABLE IF EXISTS `ma_type_repair`;
CREATE TABLE `ma_type_repair`  (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `type_id` bigint(20) NOT NULL COMMENT '类型ID',
  `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`ID`, `type_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修班机具配置ma_type_repair' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for ma_whole_set
-- ----------------------------
DROP TABLE IF EXISTS `ma_whole_set`;
CREATE TABLE `ma_whole_set`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `whole_type_name` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配套名称',
  `ascription_type` int(11) NULL DEFAULT NULL COMMENT '1：主体设备  2：配套设备',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具类型配件id',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '父级id',
  `part_num` int(11) NULL DEFAULT 0 COMMENT '整套配件数',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '是否启用(0 否，1 是)',
  `create_by` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '成套设备ma_whole_set' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for plan_borrow_details
-- ----------------------------
DROP TABLE IF EXISTS `plan_borrow_details`;
CREATE TABLE `plan_borrow_details`  (
  `id` int(11) NULL DEFAULT NULL COMMENT 'ID',
  `plan_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '计划ID',
  `type_id` int(11) NULL DEFAULT 0 COMMENT '物资类型ID',
  `plan_num` int(11) NULL DEFAULT 0 COMMENT '计划数',
  `borrow_num` int(11) NULL DEFAULT 0 COMMENT '借出数',
  `plan_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '计划单价',
  `plan_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '计划总价',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`plan_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '年度借调计划详细表plan_borrow_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for plan_borrow_info
-- ----------------------------
DROP TABLE IF EXISTS `plan_borrow_info`;
CREATE TABLE `plan_borrow_info`  (
  `borrow_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '借调计划ID',
  `need_unit_id` int(11) NOT NULL COMMENT '需求单位id',
  `borrow_unit_id` int(11) NULL DEFAULT NULL COMMENT '借出单位id',
  `code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '编号',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`borrow_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '年度借调表表plan_borrow_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for plan_need_details
-- ----------------------------
DROP TABLE IF EXISTS `plan_need_details`;
CREATE TABLE `plan_need_details`  (
  `id` int(11) NULL DEFAULT NULL COMMENT 'ID',
  `plan_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '计划ID',
  `type_id` int(11) NULL DEFAULT 0 COMMENT '物资类型ID',
  `plan_num` int(11) NULL DEFAULT 0 COMMENT '计划数',
  `plan_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '计划单价',
  `plan_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '计划总价',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`plan_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '年度计划详细表plan_need_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for plan_need_info
-- ----------------------------
DROP TABLE IF EXISTS `plan_need_info`;
CREATE TABLE `plan_need_info`  (
  `plan_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '计划ID',
  `unit_id` int(11) NOT NULL COMMENT '需求单位id',
  `code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '编号',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`plan_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '年度计划表plan_need_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_check_details
-- ----------------------------
DROP TABLE IF EXISTS `purchase_check_details`;
CREATE TABLE `purchase_check_details`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `task_id` bigint(20) NOT NULL COMMENT '任务ID',
  `type_id` int(11) NOT NULL COMMENT '规格id',
  `purchase_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '采购单价',
  `purchase_num` int(11) NULL DEFAULT 0 COMMENT '采购数量',
  `check_num` int(11) NULL DEFAULT 0 COMMENT '验收数量',
  `bind_num` int(11) NULL DEFAULT 0 COMMENT '绑定数量',
  `check_result` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收结论',
  `supplier_id` int(11) NULL DEFAULT NULL COMMENT '供应商id',
  `status` int(11) NULL DEFAULT NULL COMMENT '0-未验收,1-已验收,2-待通知,3-验收不通过,4-已入库,5-入库驳回,6-综合服务中心审核通过，7-综合服务中心不通过',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `production_time` datetime NULL DEFAULT NULL COMMENT '出厂日期',
  `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `check_url_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收图片',
  `check_url` varchar(4000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收图片名称',
  `input_num` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `input_status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否入库',
  `input_time` datetime NULL DEFAULT NULL COMMENT '入库时间',
  `file_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收附件名称',
  `file_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收附件',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_task_id`(`task_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购验收任务详细表purchase_check_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_check_info
-- ----------------------------
DROP TABLE IF EXISTS `purchase_check_info`;
CREATE TABLE `purchase_check_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `task_id` bigint(20) NOT NULL COMMENT '任务ID',
  `purchase_time` datetime NOT NULL COMMENT '采购日期',
  `arrival_time` datetime NULL DEFAULT NULL COMMENT '到货日期',
  `purchaser` int(11) NULL DEFAULT NULL COMMENT '采购员',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `idx_task_id`(`task_id`) USING BTREE,
  INDEX `idx_arrival_time`(`arrival_time`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购验收任务表purchase_check_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_macode_info
-- ----------------------------
DROP TABLE IF EXISTS `purchase_macode_info`;
CREATE TABLE `purchase_macode_info`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `task_id` int(11) NOT NULL COMMENT '任务ID',
  `type_id` int(11) NOT NULL COMMENT '类型ID',
  `ma_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机具编号',
  `qr_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '二维码',
  `fix_code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否是固定资产编号(0,是 1,否)',
  `code_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '编号类型',
  `status` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态（0,待入库 1,已入库）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购验收编号管理purchase_macode_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_notice_person
-- ----------------------------
DROP TABLE IF EXISTS `purchase_notice_person`;
CREATE TABLE `purchase_notice_person`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `user_id` int(11) NULL DEFAULT NULL COMMENT '用户id',
  `user_name` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名',
  `telphone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购短信通知人员purchase_notice_person' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_part_details
-- ----------------------------
DROP TABLE IF EXISTS `purchase_part_details`;
CREATE TABLE `purchase_part_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `part_id` int(11) NULL DEFAULT NULL COMMENT '配件id',
  `purchase_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '采购单价',
  `purchase_num` int(11) NULL DEFAULT 0 COMMENT '采购数量',
  `supplier_id` int(11) NULL DEFAULT NULL COMMENT '供应商id',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `production_time` datetime NULL DEFAULT NULL COMMENT '出厂日期',
  `check_num` int(11) NULL DEFAULT 0 COMMENT '验收数量',
  `check_result` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '验收结论',
  `input_num` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `input_time` datetime NULL DEFAULT NULL COMMENT '入库时间',
  `file_name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件',
  `file_url` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '附件路径',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `status` int(11) NULL DEFAULT 0 COMMENT '0待验收，1已验收 , 2,验收不通过 3,已入库 4，审核不通过',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购配件验收任务详细表purchase_part_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for purchase_part_info
-- ----------------------------
DROP TABLE IF EXISTS `purchase_part_info`;
CREATE TABLE `purchase_part_info`  (
  `ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `purchase_time` datetime NOT NULL COMMENT '采购日期',
  `arrival_time` datetime NULL DEFAULT NULL COMMENT '到货日期',
  `purchaser` int(11) NULL DEFAULT NULL COMMENT '采购员',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '新购配件验收任务表purchase_part_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for push_data_receive_detail
-- ----------------------------
DROP TABLE IF EXISTS `push_data_receive_detail`;
CREATE TABLE `push_data_receive_detail`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `receive_id` int(11) NULL DEFAULT NULL COMMENT '推送ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具类型id',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具编码ID',
  `rent_time` datetime NULL DEFAULT NULL COMMENT '租赁时间',
  `rent_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '租赁价格',
  `unit_id` int(11) NULL DEFAULT NULL COMMENT '所属单位',
  `supplier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生产厂家',
  `out_factory_time` datetime NULL DEFAULT NULL COMMENT '出厂时间',
  `is_new` int(11) NULL DEFAULT NULL COMMENT '是否新装备（0 是  1否）',
  `check_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检验证编号',
  `check_unit` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '检验单位',
  `check_date` datetime NULL DEFAULT NULL COMMENT '检验日期',
  `next_check_date` datetime NULL DEFAULT NULL COMMENT '下次检验时间',
  `ma_user_name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机手姓名',
  `status` int(11) NULL DEFAULT 0 COMMENT '状态（0 未接收  1已接收）',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '推送接收明细表push_data_receive_detail' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for push_data_receive_info
-- ----------------------------
DROP TABLE IF EXISTS `push_data_receive_info`;
CREATE TABLE `push_data_receive_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `receive_status` int(11) NULL DEFAULT 0 COMMENT '接收状态(0：未完成 1 已完成)',
  `push_num` int(11) NULL DEFAULT NULL COMMENT '推送数量',
  `receive_date` datetime NULL DEFAULT NULL COMMENT '推送时间',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '推送接收表push_data_receive_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `repair_apply_details`;
CREATE TABLE `repair_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `repair_num` int(11) NULL DEFAULT 0 COMMENT '维修总量',
  `repaired_num` int(11) NULL DEFAULT 0 COMMENT '维修合格数量',
  `scrap_num` int(11) NULL DEFAULT 0 COMMENT '维修报废数量',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0未完成，1已完成',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `back_id` int(11) NULL DEFAULT NULL COMMENT '退料ID',
  `repairer` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修人',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修详细表repair_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_apply_record
-- ----------------------------
DROP TABLE IF EXISTS `repair_apply_record`;
CREATE TABLE `repair_apply_record`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `repair_num` int(11) NULL DEFAULT 0 COMMENT '维修数量',
  `scrap_num` int(11) NULL DEFAULT 0 COMMENT '报废数量',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `repair_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修方式（1内部2返厂3报废）',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `scrap_reason` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报废原因',
  `scrap_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '报废（0：自然报废，1任务报废）',
  `supplier_id` int(11) NULL DEFAULT NULL COMMENT '返厂id',
  `part_num` int(11) NULL DEFAULT 0 COMMENT '配件数量',
  `part_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '配件单价',
  `repair_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修内容',
  `part_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型（0不收费，1收费）',
  `part_name` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '配件名称',
  `file_ids` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '损坏照片id',
  `repairer` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修人',
  `part_id` int(11) NULL DEFAULT NULL COMMENT '配件id',
  `status` int(11) NULL DEFAULT 0 COMMENT '0 未审核  1已审核',
  `is_slt` int(11) NULL DEFAULT 0 COMMENT '是否结算（0 未结算 1已结算）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修记录表repair_apply_record' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_audit_details
-- ----------------------------
DROP TABLE IF EXISTS `repair_audit_details`;
CREATE TABLE `repair_audit_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `repair_id` int(11) NULL DEFAULT NULL COMMENT '维修ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `repair_num` int(11) NULL DEFAULT 0 COMMENT '维修总量',
  `repaired_num` int(11) NULL DEFAULT 0 COMMENT '维修合格数量',
  `scrap_num` int(11) NULL DEFAULT 0 COMMENT '维修报废数量',
  `audit_by` int(11) NULL DEFAULT NULL COMMENT '审核人',
  `audit_time` datetime NULL DEFAULT NULL COMMENT '审核时间',
  `audit_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注备注',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '0未审核1已审核2驳回',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '修试审核详细表repair_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_cost
-- ----------------------------
DROP TABLE IF EXISTS `repair_cost`;
CREATE TABLE `repair_cost`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `repair_id` int(11) NULL DEFAULT NULL COMMENT '维修ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `repair_num` int(11) NULL DEFAULT 0 COMMENT '维修数量',
  `costs` decimal(10, 2) NULL DEFAULT NULL COMMENT '维修费用',
  `part_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型（0不收费，1收费）',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0未审核，1已审核，2已驳回',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `out_source_costs` decimal(10, 2) NULL DEFAULT NULL COMMENT '委外维修费用',
  `repair_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修方式（1内部2返厂3报废）',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修详细表repair_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_input_details
-- ----------------------------
DROP TABLE IF EXISTS `repair_input_details`;
CREATE TABLE `repair_input_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `audit_id` int(11) NULL DEFAULT NULL COMMENT '维修审核ID',
  `repair_id` int(11) NULL DEFAULT NULL COMMENT '维修ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `repair_num` int(11) NULL DEFAULT 0 COMMENT '维修合格数量',
  `input_num` int(11) NULL DEFAULT 0 COMMENT '入库数量',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '0未审核，1已入库，2驳回',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '修试后入库repair_input_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for repair_part_details
-- ----------------------------
DROP TABLE IF EXISTS `repair_part_details`;
CREATE TABLE `repair_part_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `part_id` int(11) NULL DEFAULT NULL COMMENT '配件ID',
  `part_num` int(11) NULL DEFAULT 0 COMMENT '配件数量',
  `part_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '配件费用',
  `part_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '类型（0不收费，1收费）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `repair_content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '维修内容',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修配件详细表repair_part_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for scrap_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `scrap_apply_details`;
CREATE TABLE `scrap_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '上级ID',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
  `type_id` int(11) NOT NULL COMMENT '规格ID',
  `scrap_num` int(11) NULL DEFAULT 0 COMMENT '报废数量',
  `scrap_source` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '(1退料2,维修审核，3盘点)',
  `scrap_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '（0自然，1人为）',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态（0进行中，1已审核，2驳回）',
  `audit_by` int(11) NULL DEFAULT NULL COMMENT '审核人',
  `audit_time` datetime NULL DEFAULT NULL COMMENT '审核时间',
  `audit_remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核备注',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `file_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名',
  `file_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件url',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '报废任务详细表scrap_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for scrap_auditor_set
-- ----------------------------
DROP TABLE IF EXISTS `scrap_auditor_set`;
CREATE TABLE `scrap_auditor_set`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `task_id` int(11) NULL DEFAULT NULL COMMENT '报废任务id',
  `dept_id` int(11) NULL DEFAULT NULL COMMENT '部门id',
  `user_id` int(11) NULL DEFAULT NULL COMMENT '审核人id',
  `status` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0未审核1审核通过，2驳回',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '所属公司',
  `audit_time` datetime NULL DEFAULT NULL COMMENT '审核时间',
  `reason_rejection` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '驳回原因',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '报废审核人员配置scrap_auditor_set' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for slt_agreement_apply
-- ----------------------------
DROP TABLE IF EXISTS `slt_agreement_apply`;
CREATE TABLE `slt_agreement_apply`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结算单号（例如：JS202402-1）',
  `creator` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `auditor` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核人',
  `audit_time` datetime NULL DEFAULT NULL COMMENT '审核时间',
  `status` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态0待审核1审核通过2审核驳回',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属',
  `cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '结算总费用',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '结算协议申请slt_agreement_apply' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for slt_agreement_details
-- ----------------------------
DROP TABLE IF EXISTS `slt_agreement_details`;
CREATE TABLE `slt_agreement_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `apply_id` int(11) NULL DEFAULT NULL COMMENT '申请id',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格id',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具id',
  `slt_type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '费用类型：1租赁2丢失3维修4报废',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `start_time` datetime NULL DEFAULT NULL COMMENT '开始时间',
  `end_time` datetime NULL DEFAULT NULL COMMENT '结束时间',
  `price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '单价',
  `money` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '金额',
  `is_charge` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '是否收费：0不收费1收费',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '结算协议详情slt_agreement_details' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for slt_agreement_info
-- ----------------------------
DROP TABLE IF EXISTS `slt_agreement_info`;
CREATE TABLE `slt_agreement_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议id',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格id',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具id',
  `num` int(11) NULL DEFAULT 0 COMMENT '领料数量',
  `start_time` datetime NULL DEFAULT NULL COMMENT '领料时间',
  `end_time` datetime NULL DEFAULT NULL COMMENT '退料时间',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0在用1退回',
  `lease_id` int(11) NULL DEFAULT NULL COMMENT '领料id',
  `back_id` int(11) NULL DEFAULT NULL COMMENT '退料id',
  `lease_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '租赁单价',
  `buy_price` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '原值',
  `is_slt` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否结算',
  `slt_time` datetime NULL DEFAULT NULL COMMENT '结算时间',
  `company_id` int(11) NULL DEFAULT NULL,
  `lease_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用类型（0工程1长期）',
  `trim_day` int(11) NULL DEFAULT NULL COMMENT '调整天数',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '结算信息slt_agreement_info' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for slt_agreement_relation
-- ----------------------------
DROP TABLE IF EXISTS `slt_agreement_relation`;
CREATE TABLE `slt_agreement_relation`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `apply_id` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结算id',
  `agreement_id` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '协议id',
  `add_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '增加费用',
  `sub_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '减免费用',
  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '增减原因',
  `lease_one_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '费用承担方1费用',
  `repair_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '维修费用',
  `scrap_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '报废费用',
  `lose_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '丢失费用',
  `cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '总费用',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '状态0待审核1审核通过2审核驳回',
  `lease_three_cost` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '费用承担方3费用',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '计算关系slt_agreement_info' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for slt_project_month
-- ----------------------------
DROP TABLE IF EXISTS `slt_project_month`;
CREATE TABLE `slt_project_month`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `month` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '月份',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '月结算任务索引表slt_project_month' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for slt_project_month_costs
-- ----------------------------
DROP TABLE IF EXISTS `slt_project_month_costs`;
CREATE TABLE `slt_project_month_costs`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议id',
  `unit_id` int(11) NULL DEFAULT NULL COMMENT '单位id',
  `project_id` int(11) NULL DEFAULT NULL COMMENT '工程id',
  `month` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '结算月份',
  `cost_bearing_party` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '费用承担方',
  `costs` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '结算金额',
  `task_id` int(11) NOT NULL COMMENT '结算记录关联taskId',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '月结算费用表slt_project_month_costs' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for slt_project_month_detail
-- ----------------------------
DROP TABLE IF EXISTS `slt_project_month_detail`;
CREATE TABLE `slt_project_month_detail`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '类型id',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '编码id',
  `unit` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单位',
  `start_time` datetime NULL DEFAULT NULL COMMENT '开始日期',
  `end_time` datetime NULL DEFAULT NULL COMMENT '结束日期',
  `slt_days` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '结算天数',
  `slt_costs` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '结算金额',
  `month_temporarily_costs` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '本月暂计金额',
  `pro_month_cost_id` int(11) NULL DEFAULT NULL COMMENT '月结算关联id',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `lease_price` decimal(10, 2) NULL DEFAULT NULL COMMENT '单价',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '月结算费用详情slt_project_month_detail' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for tm_task
-- ----------------------------
DROP TABLE IF EXISTS `tm_task`;
CREATE TABLE `tm_task`  (
  `task_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `task_type` int(11) NULL DEFAULT NULL COMMENT '任务类型(定义数据字典)',
  `task_status` int(11) NULL DEFAULT NULL COMMENT '任务状态(定义数据字典)',
  `code` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '编号',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  `status` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '1' COMMENT '0不启用 1启用',
  PRIMARY KEY (`task_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务表tm_task' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for tm_task_agreement
-- ----------------------------
DROP TABLE IF EXISTS `tm_task_agreement`;
CREATE TABLE `tm_task_agreement`  (
  `task_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '任务ID',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议ID',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属组织',
  PRIMARY KEY (`task_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '任务表tm_task_agreement' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for tm_task_storage_analyze
-- ----------------------------
DROP TABLE IF EXISTS `tm_task_storage_analyze`;
CREATE TABLE `tm_task_storage_analyze`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `cal_date` date NULL DEFAULT NULL COMMENT '计算日期',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '类型id',
  `pre_storage_num` int(11) NULL DEFAULT NULL COMMENT '上期库存量',
  `input_sum` int(11) NULL DEFAULT NULL COMMENT '入库汇总',
  `output_sum` int(11) NULL DEFAULT 1 COMMENT '出库汇总',
  `current_stroage_num` int(11) NULL DEFAULT 0 COMMENT '本期库存量',
  `storage_num_diff` int(11) NULL DEFAULT NULL COMMENT '库存差额(上期库存+入库-出库-本期库存)',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '定期库存分析表tm_task_storage_analyze' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_direct_apply_details
-- ----------------------------
DROP TABLE IF EXISTS `wh_direct_apply_details`;
CREATE TABLE `wh_direct_apply_details`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `direct_id` int(11) NULL DEFAULT NULL COMMENT '直转单号',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具类型',
  `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具id',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `direct_num` int(11) NULL DEFAULT 0 COMMENT '直转数量',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工地直转详情wh_direct_apply_details' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_direct_apply_info
-- ----------------------------
DROP TABLE IF EXISTS `wh_direct_apply_info`;
CREATE TABLE `wh_direct_apply_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '直转单号（ZZ20240226-1）',
  `back_agreement_id` int(11) NULL DEFAULT NULL COMMENT '退料单位协议',
  `back_man` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料人',
  `back_phone` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `back_remark` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退料备注',
  `lease_agreement_id` int(11) NULL DEFAULT NULL COMMENT '领料单位协议',
  `lease_man` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料人',
  `lease_phone` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料联系电话',
  `lease_remark` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料备注',
  `dir_url` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '直转附件',
  `status` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '0待审批1审批同意2驳回',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `auditor` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核人',
  `audit_time` datetime NULL DEFAULT NULL COMMENT '审核时间',
  `audit_remark` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核备注',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '工地直转信息wh_direct_apply_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_house_info
-- ----------------------------
DROP TABLE IF EXISTS `wh_house_info`;
CREATE TABLE `wh_house_info`  (
  `house_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '仓库ID',
  `house_name` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '工程项目名称',
  `parent_id` bigint(20) NULL DEFAULT NULL COMMENT '上级ID',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属上级',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据所属组织',
  `sort` int(11) NULL DEFAULT NULL COMMENT '排序',
  `concat` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系人',
  `phone` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '联系电话',
  PRIMARY KEY (`house_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仓库管理wh_house_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_house_set
-- ----------------------------
DROP TABLE IF EXISTS `wh_house_set`;
CREATE TABLE `wh_house_set`  (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  `house_id` bigint(20) NOT NULL COMMENT '仓库ID',
  `type_id` bigint(20) NOT NULL COMMENT '机具类型ID',
  `ma_id` bigint(20) NULL DEFAULT NULL COMMENT '机具ID',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `status` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '帐号状态（0正常 1停用）',
  `dept_id` bigint(20) NULL DEFAULT NULL COMMENT '所属上级',
  `del_flag` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '删除标志（0代表存在 2代表删除）',
  `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
  `company_id` bigint(20) NULL DEFAULT NULL COMMENT '数据所属组织',
  `shelf_num` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '货架编号',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '仓库货架配置wh_house_set' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_team_lease_info
-- ----------------------------
DROP TABLE IF EXISTS `wh_team_lease_info`;
CREATE TABLE `wh_team_lease_info`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `agreement_id` int(11) NULL DEFAULT NULL COMMENT '协议id',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '机具规格id',
  `team_name` varchar(120) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '班组名称',
  `lease_man` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料人',
  `phone` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `num` int(11) NULL DEFAULT 0 COMMENT '数量',
  `create_by` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
  `type` varchar(1) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '1出库2退库',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '二级库租赁信息wh_team_lease_info' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for wh_team_receive_detail
-- ----------------------------
DROP TABLE IF EXISTS `wh_team_receive_detail`;
CREATE TABLE `wh_team_receive_detail`  (
  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `type_id` int(11) NULL DEFAULT NULL COMMENT '类型名称',
  `out_num` int(11) NULL DEFAULT NULL COMMENT '出库数量',
  `pick_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '领料人员',
  `out_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出库人员',
  `out_time` datetime NULL DEFAULT NULL COMMENT '出库时间',
  `parent_id` int(11) NULL DEFAULT NULL COMMENT '出库父id',
  `type` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '1出库 2退库',
  `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
  `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '二级库接收详情wh_team_receive_detail' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- View structure for v_ma_storage_num_by_type_id
-- ----------------------------
DROP VIEW IF EXISTS `v_ma_storage_num_by_type_id`;
CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `v_ma_storage_num_by_type_id` AS select `mt`.`type_id` AS `type_id`,(case `mt`.`manage_type` when 0 then ifnull(`subquery`.`num`,0) else ifnull(`mt`.`storage_num`,0) end) AS `storage_num` from (`ma_sgzb_bns`.`ma_type` `mt` left join (select `mt`.`type_id` AS `type_id`,`mt2`.`type_name` AS `typeName`,`mt`.`type_name` AS `typeModelName`,count(`mm`.`ma_id`) AS `num` from ((`ma_sgzb_bns`.`ma_machine` `mm` left join `ma_sgzb_bns`.`ma_type` `mt` on((`mt`.`type_id` = `mm`.`type_id`))) left join `ma_sgzb_bns`.`ma_type` `mt2` on((`mt2`.`type_id` = `mt`.`parent_id`))) where ((`mm`.`ma_code` is not null) and (`mm`.`ma_status` = 15)) group by `mt`.`type_id`) `subquery` on((`subquery`.`type_id` = `mt`.`type_id`))) where (`mt`.`del_flag` = '0');

SET FOREIGN_KEY_CHECKS = 1;
