代码拉取完成,页面将自动刷新
import sys
import math
from data import whichmap
import order9
sell1=[]
sell2=[]
sell3=[]
sell4=['1', '2']
sell5=['1', '3']
sell6=['2', '3']
sell7=['4', '5', '6']
sell8=['7']
sell9=['1', '2', '3', '4', '5', '6', '7']
# only9机器人指令类
class Order9():
def __init__(self, frame_id, WB, WB_indexnumber, robot, stat, WBlist, needlist, distance_dic, distance_roboteachother, \
distance_9to456, distance_7to456, free_set, WB_lock, WB_distribution_stat, dic_countneed, exist):
self.frame_id = frame_id
self.stat = stat
self.WBlist = WBlist
self.WB = WB
self.WB_indexnumber = WB_indexnumber
self.robot = robot
self.needlist = needlist
self.distance_dic = distance_dic
self.distance_roboteachother = distance_roboteachother
self.distance_9to456 = distance_9to456
self.distance_7to456 = distance_7to456
self.robot_stat = free_set
self.WB_lock = WB_lock
self.WB_distribution_stat = WB_distribution_stat
self.dic_countneed = dic_countneed
self.exist = exist
self.exist456 = self.exist[3:6]
self.exist123 = self.exist[0:3]
def changeNeedlist_only9(self):
for i in range(4):
if self.robot[str(i)][1] == '0':
if self.robot[str(i)][1] == '1' or self.robot[str(i)][1] == '2' or self.robot[str(i)][1] == '3':
for k, v in self.WB.items():
if k == self.robot_stat[i]:
self.needlist[int(v[0])-1] -= 1
# if stat == only9
def goto9_goods4(self, robot_id):
for i in range(self.WBlist[8]): # 所有9号工作台无脑送
if '9_'+str(i) not in self.ls_alive:
continue
self.robot_start[robot_id] = self.laststat[robot_id]
self.robot_stat[robot_id] = '9_'+str(i)
self.laststat[robot_id] = self.robot_stat[robot_id]
break
def goto9_goods5(self, robot_id):
for i in range(self.WBlist[8]): # 所有9号工作台无脑送
if '9_'+str(i) not in self.ls_alive:
continue
self.robot_start[robot_id] = self.laststat[robot_id]
self.robot_stat[robot_id] = '9_'+str(i)
self.laststat[robot_id] = self.robot_stat[robot_id]
break
def goto9_goods6(self, robot_id):
for i in range(self.WBlist[8]): # 所有9号工作台无脑送
if '9_'+str(i) not in self.ls_alive:
continue
self.robot_start[robot_id] = self.laststat[robot_id]
self.robot_stat[robot_id] = '9_'+str(i)
self.laststat[robot_id] = self.robot_stat[robot_id]
break
#############################################################################
################# if stat == only9 分配规则和9的距离优先 #####################
#############################################################################
# 如果只有1个9,默认是self.distance_9to456[0]
# 456无脑送给9
def goto9_goods4_last(self, robot_id):
for i in range(self.WBlist[8]):
aim = '9_'+str(i)
break
return aim
def goto9_goods5_last(self, robot_id):
for i in range(self.WBlist[8]):
aim = '9_'+str(i)
break
return aim
def goto9_goods6_last(self, robot_id):
for i in range(self.WBlist[8]):
aim = '9_'+str(i)
break
return aim
def test6_only9(self):
# 若有任一6号生产完,派一个空闲机器人过去
for i in range(self.WBlist[5]):
if self.WB['6_'+str(i)][5] == '1' and self.WB['6_'+str(i)][4] == '12' and self.WB['6_'+str(i)][3] == '0' and self.WB_lock['6_'+str(i)][2] == 'OK':
for j in range(4):
if self.robot_stat[j] == 'free' and self.robot[str(j)][1] == '0':
self.robot_stat[j] = '6_'+str(i)
self.WB_lock['6_'+str(i)][2] = 'NO'
break
for i in range(self.WBlist[5]):
if self.frame_id > 8500 and self.frame_id < 8700 and (self.WB['6_'+str(i)][5] == '1' or (int(self.WB['6_'+str(i)][3]) < 200 and int(self.WB['6_'+str(i)][3]) > 0)) and self.WB_lock['6_'+str(i)][2] == 'OK':
for j in range(4):
if self.robot_stat[j] == 'free' and self.needlist[5] > 0 and self.robot[str(j)][1] == '0':
self.robot_stat[j] = '6_'+str(i)
self.WB_lock['6_'+str(i)][2] = 'NO'
self.needlist[5] -= 1
break
def test5_only9(self):
# 若有任一5号生产完,派一个机器人过去
for i in range(self.WBlist[4]):
if self.WB['5_'+str(i)][5] == '1' and self.WB['5_'+str(i)][4] == '10' and self.WB['5_'+str(i)][3] == '0' and self.WB_lock['5_'+str(i)][2] == 'OK':
for j in range(4):
if self.robot_stat[j] == 'free' and self.robot[str(j)][1] == '0':
self.robot_stat[j] = '5_'+str(i)
self.WB_lock['5_'+str(i)][2] = 'NO'
break
def test4_only9(self):
# 若有任一4号生产完,派一个机器人过去
for i in range(self.WBlist[3]):
if self.WB['4_'+str(i)][5] == '1' and self.WB['4_'+str(i)][4] == '6' and self.WB['4_'+str(i)][3] == '0' and self.WB_lock['4_'+str(i)][2] == 'OK':
for j in range(4):
if self.robot_stat[j] == 'free' and self.robot[str(j)][1] == '0':
self.robot_stat[j] = '4_'+str(i)
self.WB_lock['4_'+str(i)][2] = 'NO'
break
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。