Commit 14588e42 authored by Allvey's avatar Allvey

Merge branch 'master' of github.com:Allvey/integrated-scheduling

# 绑定关系与物料类型控制
parent 13a2e9cf
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -14,6 +14,8 @@ from settings import * ...@@ -14,6 +14,8 @@ from settings import *
# 卸载设备类 # 卸载设备类
class DumpInfo(WalkManage): class DumpInfo(WalkManage):
def __init__(self): def __init__(self):
# # 卸载设备集合
# self.dynamic_dump_set = set(update_autodisp_dump())
# 卸载设备数量 # 卸载设备数量
self.dynamic_dump_num = len(dynamic_dump_set) self.dynamic_dump_num = len(dynamic_dump_set)
# 目标产量 # 目标产量
...@@ -38,6 +40,12 @@ class DumpInfo(WalkManage): ...@@ -38,6 +40,12 @@ class DumpInfo(WalkManage):
self.entrance_time = np.zeros(self.dynamic_dump_num) self.entrance_time = np.zeros(self.dynamic_dump_num)
# 出场时间 # 出场时间
self.exit_time = np.zeros(self.dynamic_dump_num) self.exit_time = np.zeros(self.dynamic_dump_num)
# 卸载点物料类型
self.dump_material = {}
# 初始化读取映射及路网
self.period_map_para_load()
self.period_walk_para_load()
def get_unloading_time(self): def get_unloading_time(self):
return self.unloading_time return self.unloading_time
...@@ -110,7 +118,7 @@ class DumpInfo(WalkManage): ...@@ -110,7 +118,7 @@ class DumpInfo(WalkManage):
self.entrance_time[self.dump_uuid_to_index_dict[dump_id]] = 0.50 self.entrance_time[self.dump_uuid_to_index_dict[dump_id]] = 0.50
self.exit_time[self.dump_uuid_to_index_dict[dump_id]] = 0.50 self.exit_time[self.dump_uuid_to_index_dict[dump_id]] = 0.50
# 读取出入场时间 # 读取卸载任务时间
def get_unloading_task_time(self): def get_unloading_task_time(self):
unloading_time = self.unloading_time unloading_time = self.unloading_time
...@@ -141,9 +149,17 @@ class DumpInfo(WalkManage): ...@@ -141,9 +149,17 @@ class DumpInfo(WalkManage):
+ query.load_weight + query.load_weight
) )
def period_update(self): def update_dump_material(self):
for dump_id in dynamic_dump_set:
unload_area_id = session_mysql.query(Dispatch).filter_by(dump_id=dump_id).first().unload_area_id
dump_material_id = session_postgre.query(DumpArea).filter_by(Id=unload_area_id).first().Material
self.dump_material[dump_id] = dump_material_id
def para_period_update(self):
# print("Dump update!")
print("Dump update!") logger.info("Dump update!")
# 装载周期参数 # 装载周期参数
self.period_map_para_load() self.period_map_para_load()
......
...@@ -14,6 +14,8 @@ from settings import * ...@@ -14,6 +14,8 @@ from settings import *
# 挖机设备类 # 挖机设备类
class ExcavatorInfo(WalkManage): class ExcavatorInfo(WalkManage):
def __init__(self): def __init__(self):
# # 挖机集合
# self.dynamic_excavator_set = set(update_autodisp_excavator())
# 装载设备数量 # 装载设备数量
self.dynamic_excavator_num = len(dynamic_excavator_set) self.dynamic_excavator_num = len(dynamic_excavator_set)
# 目标产量 # 目标产量
...@@ -38,6 +40,12 @@ class ExcavatorInfo(WalkManage): ...@@ -38,6 +40,12 @@ class ExcavatorInfo(WalkManage):
self.entrance_time = np.zeros(self.dynamic_excavator_num) self.entrance_time = np.zeros(self.dynamic_excavator_num)
# 出场时间 # 出场时间
self.exit_time = np.zeros(self.dynamic_excavator_num) self.exit_time = np.zeros(self.dynamic_excavator_num)
# 挖机对应物料类型
self.excavator_material = {}
# 初始化读取映射及路网
self.period_map_para_load()
self.period_walk_para_load()
# def period_map_para_load(self): # def period_map_para_load(self):
# # 关系映射 # # 关系映射
...@@ -166,9 +174,17 @@ class ExcavatorInfo(WalkManage): ...@@ -166,9 +174,17 @@ class ExcavatorInfo(WalkManage):
+ query.load_weight + query.load_weight
) )
def period_update(self): def update_excavator_material(self):
for excavator_id in dynamic_excavator_set:
load_area_id = session_mysql.query(Dispatch).filter_by(exactor_id=excavator_id).first().load_area_id
excavator_material_id = session_postgre.query(DiggerArea).filter_by(Id=load_area_id).first().Material
self.excavator_material[excavator_id] = excavator_material_id
def para_period_update(self):
# print("Excavator update!")
print("Excavator update!") logger.info("Excavator update!")
# 装载周期参数 # 装载周期参数
self.period_map_para_load() self.period_map_para_load()
......
This diff is collapsed.
This diff is collapsed.
...@@ -81,12 +81,20 @@ try: ...@@ -81,12 +81,20 @@ try:
# 创建DBsession_mysql类型: # 创建DBsession_mysql类型:
DBsession_mysql = sessionmaker(bind=engine_mysql) DBsession_mysql = sessionmaker(bind=engine_mysql)
DBsession_mysql = scoped_session(DBsession_mysql)
DBsession_postgre = sessionmaker(bind=engine_postgre) DBsession_postgre = sessionmaker(bind=engine_postgre)
DBsession_postgre = scoped_session(DBsession_postgre)
# 创建session_mysql对象: # 创建session_mysql对象:
session_mysql = DBsession_mysql() session_mysql = DBsession_mysql()
session_mysql.expire_on_commit = False
session_postgre = DBsession_postgre() session_postgre = DBsession_postgre()
session_postgre.expire_on_commit = False
except Exception as es: except Exception as es:
logger.error("数据库连接失败") logger.error("数据库连接失败")
logger.error(es) logger.error(es)
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
from sqlalchemy import Column, create_engine from sqlalchemy import Column, create_engine
from sqlalchemy import VARCHAR, DateTime, Float, Integer, BOOLEAN from sqlalchemy import VARCHAR, DateTime, Float, Integer, BOOLEAN
from sqlalchemy.orm import sessionmaker from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
# import numpy as np # import numpy as np
# from redis import StrictRedis, ConnectionPool # from redis import StrictRedis, ConnectionPool
...@@ -35,8 +35,12 @@ engine_postgre = create_engine('postgresql://postgres:Huituo@123@192.168.28.111: ...@@ -35,8 +35,12 @@ engine_postgre = create_engine('postgresql://postgres:Huituo@123@192.168.28.111:
# 创建DBsession_mysql类型: # 创建DBsession_mysql类型:
DBsession_mysql = sessionmaker(bind=engine_mysql) DBsession_mysql = sessionmaker(bind=engine_mysql)
DBsession_mysql = scoped_session(DBsession_mysql)
DBsession_postgre = sessionmaker(bind=engine_postgre) DBsession_postgre = sessionmaker(bind=engine_postgre)
DBsession_postgre = scoped_session(DBsession_postgre)
# 创建session_mysql对象: # 创建session_mysql对象:
session_mysql = DBsession_mysql() session_mysql = DBsession_mysql()
...@@ -298,8 +302,10 @@ class Equipment(Base): ...@@ -298,8 +302,10 @@ class Equipment(Base):
disabled = Column(Integer) disabled = Column(Integer)
bind_list = Column(VARCHAR(1000)) bind_list = Column(VARCHAR(1000))
only_allowed = Column(Integer) only_allowed = Column(Integer)
priority = Column(Integer)
def __init__(self, id, equipment_id, device_name, device_type, equipment_spec, equipment_state, isdeleted, disabled, bind_list, only_allowed): def __init__(self, id, equipment_id, device_name, device_type, equipment_spec, equipment_state, isdeleted, \
disabled, bind_list, only_allowed, priority):
self.id = id self.id = id
self.equipment_id = equipment_id self.equipment_id = equipment_id
self.device_name = device_name self.device_name = device_name
...@@ -310,6 +316,7 @@ class Equipment(Base): ...@@ -310,6 +316,7 @@ class Equipment(Base):
self.disabled = disabled self.disabled = disabled
self.bind_list = bind_list self.bind_list = bind_list
self.only_allowed = only_allowed self.only_allowed = only_allowed
self.priority = priority
class EquipmentSpec(Base): class EquipmentSpec(Base):
__tablename__ = 'sys_equipment_spec' __tablename__ = 'sys_equipment_spec'
...@@ -377,9 +384,21 @@ class DumpArea(Base): ...@@ -377,9 +384,21 @@ class DumpArea(Base):
BindList = Column(VARCHAR(1000)) BindList = Column(VARCHAR(1000))
UnloadAbililty = Column(Float) UnloadAbililty = Column(Float)
Disabled = Column(Integer) Disabled = Column(Integer)
Material = Column(VARCHAR(36))
def __init__(self, Id, BindList, UnloadAbililty, Disabled): def __init__(self, Id, BindList, UnloadAbililty, Disabled, Material):
self.Id = Id self.Id = Id
self.BindList = BindList self.BindList = BindList
self.UnloadAbililty = UnloadAbililty self.UnloadAbililty = UnloadAbililty
self.Disabled = Disabled self.Disabled = Disabled
self.Material = Material
class DiggerArea(Base):
__tablename__ = 'Geo_DiggingWorkArea'
Id = Column(VARCHAR(50), primary_key=True)
Material = Column(VARCHAR(36))
def __init__(self, Id, Material):
self.Id = Id
self.Material = Material
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment