
create table kwf_driver_conduct_rules
(
    id                               bigint         NOT NULL AUTO_INCREMENT COMMENT '主键',
    ent_id                           bigint         NOT NULL DEFAULT '-1'comment '企业id',
    unload_serious_timeout_score     int            NOT NULL DEFAULT '-1'comment '单趟严重超时分数',
    unload_serious_timeout_multiple  decimal(8,2)   NOT NULL DEFAULT '00.00' comment '单趟严重超时倍数',
    document_error_missing_score     int            NOT NULL DEFAULT '-1'comment '单据错误/缺失分数',
    not_on_time_arrive_score         int            NOT NULL DEFAULT '-1'comment '未按时到场分数',
    fake_unload_score                int            NOT NULL DEFAULT '-1'comment '虚假卸货分数',
    fake_unload_distance             int            NOT NULL DEFAULT '-1'comment '虚假卸货偏差距离',
    illegal_cancel_order_score       int            NOT NULL DEFAULT '-1'comment '违规取消运单分数',
    illegal_cancel_order_minutes     int            NOT NULL DEFAULT '-1'comment '违规取消运单分钟数',
    continuous_on_time_arrive_score  int            NOT NULL DEFAULT '-1'comment '连续按时到场分数',
    continuous_on_time_arrive_times  int            NOT NULL DEFAULT '-1'comment '连续按时到场次数',
    continuous_on_time_unload_score  int            NOT NULL DEFAULT '-1'comment '连续准时卸货分数',
    continuous_on_time_unload_times  int            NOT NULL DEFAULT '-1'comment '连续准时卸货次数',
    continuous_accurate_unload_score int            NOT NULL DEFAULT '-1'comment '连续准确填写卸货信息分数',
    continuous_accurate_unload_times int            NOT NULL DEFAULT '-1'comment '连续准确填写卸货信息次数',
    create_time                     datetime        NOT NULL default CURRENT_TIMESTAMP comment '创建时间',
    update_time                     datetime        NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间',
    create_user                     bigint          NOT NULL DEFAULT '-1' comment '创建人',
    update_user                     bigint          NOT NULL DEFAULT '-1' comment '更新人',
    PRIMARY KEY (`id`) USING BTREE
) comment '司机行为规则表';



create table kwf_driver_conduct_rules_log
(
    id                              bigint          NOT NULL AUTO_INCREMENT COMMENT '主键',
    biz_id                          bigint          NOT NULL DEFAULT '-1' comment '司机行为规则id',
    status                          int             NOT NULL DEFAULT '0' COMMENT '状态(0-自动派单，1-司机行为规则)',
    description                     varchar(255)    CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci   DEFAULT NULL COMMENT '日志内容',
    create_time                     datetime        NOT NULL default CURRENT_TIMESTAMP comment '创建时间',
    create_user                     bigint          NOT NULL DEFAULT '-1' comment '创建人',
    update_user                     bigint          NOT NULL DEFAULT '-1' comment '更新人',
    PRIMARY KEY (`id`) USING BTREE
) comment '司机行为规则日志表';


create table kwf_truck_dispatch_coefficient
(
    id                              bigint          NOT NULL AUTO_INCREMENT COMMENT '主键',
    ent_id                          bigint          NOT NULL DEFAULT '-1' comment '企业id',
    vehicle_work_hours              int             NOT NULL DEFAULT '-1' comment  '车辆工作时长',
    vehicle_loading_hours           int             NOT NULL DEFAULT '-1' comment  '车辆装货时长',
    vehicle_unloading_hours         int             NOT NULL DEFAULT '-1' comment '车辆卸货时长',
    driver_timeout_limit            int             NOT NULL DEFAULT '-1' comment '司机超时限制',
    vehicle_avg_load                int             NOT NULL DEFAULT '-1' comment '车辆平均载重',
    vehicle_avg_speed               int             NOT NULL DEFAULT '-1' comment '车辆平均速度',
    vehicle_max_tasks               int             NOT NULL DEFAULT '-1' comment '车辆最大任务数',
    driver_order_limit              int             NOT NULL DEFAULT '-1' comment '司机接单限制',
    yard_vehicle_capacity           int             NOT NULL DEFAULT '-1' comment '场内车辆容量',
    max_ratio                       int             NOT NULL DEFAULT '-1' comment '最大占比',
    buffer_coefficient              decimal(8,2)    NOT NULL DEFAULT '00.00' comment '缓冲系数',
    create_time                     datetime        NOT NULL DEFAULT CURRENT_TIMESTAMP comment '创建时间',
    update_time                     datetime        NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP comment '更新时间',
    create_user                     bigint          NOT NULL DEFAULT '-1' comment '创建人',
    update_user                     bigint          NOT NULL DEFAULT '-1' comment '更新人',
    PRIMARY KEY (`id`) USING BTREE
) comment '自动派单系数表';


ALTER TABLE kwo_trade_order ADD add_vehicles tinyint NOT NULL DEFAULT '0' COMMENT '是否需要增派运力（0-不需要，1-需要）';


