-- 是否结算（0 未结算 1已结算）
alter table bm_agreement_info
    add is_slt int default 0 null comment '是否结算（0 未结算 1已结算）';

-- 调整天数
alter table slt_agreement_info
    add trim_day int null comment '调整天数';

-- 费用承担方
alter table lease_apply_info
    add cost_bearing_party varchar(255) null comment '费用承担方';


-- 领用类型（0工程1长期）
alter table slt_agreement_info
    add lease_type varchar(10) null comment '领用类型（0工程1长期）';

-- 委外维修费用
alter table repair_cost
    add out_source_costs decimal(10, 2) null comment '委外维修费用';


-- 维修方式（1内部2返厂3报废）
alter table repair_cost
    add repair_type varchar(10) null comment '维修方式（1内部2返厂3报废）';



/*
 Navicat Premium Data Transfer

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

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

 Date: 09/08/2024 12:10:18
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for repair_cost
-- ----------------------------
DROP TABLE IF EXISTS `repair_cost`;
CREATE TABLE `repair_cost`  (
                                `id` int(11) NOT NULL AUTO_INCREMENT,
                                `task_id` int(11) NULL DEFAULT NULL COMMENT '任务ID',
                                `repair_id` int(11) NULL DEFAULT NULL,
                                `type_id` int(11) NOT NULL COMMENT '规格ID',
                                `ma_id` int(11) NULL DEFAULT NULL COMMENT '机具ID',
                                `repair_num` decimal(10, 3) NULL DEFAULT NULL COMMENT '维修数量',
                                `costs` decimal(10, 0) 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 '委外维修费用',
                                PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 200 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '维修详细表repair_apply_details' 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` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建时间',
                                        `auditor` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '审核人',
                                        `audit_time` 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 NULL COMMENT '状态0待审核1审核通过2审核驳回',
                                        `company_id` int(11) NULL DEFAULT NULL COMMENT '数据所属',
                                        `cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 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 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,
                                          `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` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数量',
                                          `start_time` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '开始时间',
                                          `end_time` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结束时间',
                                          `price` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单价',
                                          `money` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL 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 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,
                                       `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` float NULL DEFAULT NULL COMMENT '领料数量',
                                       `start_time` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领料时间',
                                       `end_time` 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 '0' COMMENT '0在用1退回',
                                       `lease_id` int(11) NULL DEFAULT NULL COMMENT '领料id',
                                       `back_id` int(11) NULL DEFAULT NULL COMMENT '退料id',
                                       `lease_price` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租赁单价',
                                       `buy_price` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原值',
                                       `is_slt` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '是否结算',
                                       `slt_time` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '结算时间',
                                       `company_id` int(11) NULL DEFAULT NULL,
                                       `trim_day` int(11) NULL DEFAULT NULL COMMENT '调整天数',
                                       `lease_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领用类型（0工程1长期）',
                                       PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 303 CHARACTER SET = utf8 COLLATE = utf8_general_ci 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,
                                           `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` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '增加费用',
                                           `sub_cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '减免费用',
                                           `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '增减原因',
                                           `lease_cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                           `repair_cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                           `scrap_cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                           `lose_cost` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
                                           `cost` 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审核通过2审核驳回',
                                           PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;

SET FOREIGN_KEY_CHECKS = 1;
