from static_data_process import *
from settings import *
import numpy as np

from data.dispatchInfo import DispatchInfo
from bidict import bidict
from alg.algorithm import AlgorithmBase

if __name__ == '__main__':
    # dynamic_excavator_set = set(update_autodisp_excavator())
    # dynamic_excavator_num = len(dynamic_excavator_set)
    #
    # dynamic_dump_set = set(update_autodisp_dump())
    # dynamic_dump_num = len(dynamic_dump_set)
    #
    # dynamic_excavator_list = []
    # for item in (
    #         session_mysql.query(Dispatch).filter_by(isdeleted=0, isauto=1).all()
    # ):
    #     dynamic_excavator_list.append(item.exactor_id)
    # if len(dynamic_excavator_list) < 1:
    #     raise Exception("无动态派车计划可用-动态派车挖机/卸载设备集合读取异常")

    # 更新数据库缓存
    DispatchInfo.renew_set()

    DispatchInfo.update_device_group_structure()

    DispatchInfo.update_route_distance()

    DispatchInfo.update_group_mode()

    a = DispatchInfo.get_group_mode('9bb14655-4fd5-49da-a31a-13f6ced88d6c')
    a_excavator = DispatchInfo.get_excavator_dict('9bb14655-4fd5-49da-a31a-13f6ced88d6c')
    a_dump = DispatchInfo.get_dump_dict('9bb14655-4fd5-49da-a31a-13f6ced88d6c')
    a_truck = DispatchInfo.get_truck_set('9bb14655-4fd5-49da-a31a-13f6ced88d6c')
    bb = DispatchInfo.get_to_excavator_distance('9bb14655-4fd5-49da-a31a-13f6ced88d6c')
    cc = DispatchInfo.get_to_dump_distance('9bb14655-4fd5-49da-a31a-13f6ced88d6c')

    # print(bb)
    # print(cc)
    #
    # hh = DispatchInfo.group_excavator_dict
    # print(hh)
    # print(a)
    # print(a_excavator)
    # print(a_dump)
    print(a_truck)
    # for i in a_excavator:
    #     load = DispatchInfo.get_load_area(i)
    #     print(load)



