开启i7
parent
0f27e754d2
commit
e8d9078262
105
tools/t7.py
105
tools/t7.py
|
|
@ -32,6 +32,7 @@ class AutoLayout:
|
||||||
self.chip_type = dict()
|
self.chip_type = dict()
|
||||||
# 芯片barcode
|
# 芯片barcode
|
||||||
self.chip_barcode_recode = defaultdict(set)
|
self.chip_barcode_recode = defaultdict(set)
|
||||||
|
self.chip_barcodei7_recode = defaultdict(set)
|
||||||
# 芯片原始数据读取
|
# 芯片原始数据读取
|
||||||
self.ori_data = self.read_excel()
|
self.ori_data = self.read_excel()
|
||||||
# 当前锚芯片
|
# 当前锚芯片
|
||||||
|
|
@ -63,19 +64,22 @@ class AutoLayout:
|
||||||
self.is_use_balance = is_use_balance
|
self.is_use_balance = is_use_balance
|
||||||
self.is_use_max = is_use_max
|
self.is_use_max = is_use_max
|
||||||
|
|
||||||
def count_barcode_radio(self, data):
|
def count_barcode_radio(self, data, maxt=False):
|
||||||
df = pd.DataFrame(data)
|
df = pd.DataFrame(data)
|
||||||
ratio_sites = dict()
|
ratio_sites = dict()
|
||||||
is_not_balance_list = []
|
is_not_balance_list = []
|
||||||
if df.empty:
|
if df.empty:
|
||||||
return ratio_sites, is_not_balance_list
|
return ratio_sites, is_not_balance_list
|
||||||
|
s, e = 0, 16
|
||||||
df['barcode'] = df['barcode'].str.slice(0, 16)
|
if maxt:
|
||||||
|
s, e = 8, 16
|
||||||
|
num = e - s
|
||||||
|
df['barcode'] = df['barcode'].str.slice(s, e)
|
||||||
barcode_df = pd.DataFrame(df['barcode'].str.split('', expand=True).iloc[:, 1:-1].values,
|
barcode_df = pd.DataFrame(df['barcode'].str.split('', expand=True).iloc[:, 1:-1].values,
|
||||||
columns=['T' + str(x) for x in range(16)]).join(df['data_needed'])
|
columns=['T' + str(x) for x in range(num)]).join(df['data_needed'])
|
||||||
total = barcode_df['data_needed'].sum()
|
total = barcode_df['data_needed'].sum()
|
||||||
|
|
||||||
for i in range(16):
|
for i in range(num):
|
||||||
column = 'T' + str(i)
|
column = 'T' + str(i)
|
||||||
col_df = barcode_df.groupby(column).agg({'data_needed': 'sum'})
|
col_df = barcode_df.groupby(column).agg({'data_needed': 'sum'})
|
||||||
# 去掉N计数
|
# 去掉N计数
|
||||||
|
|
@ -137,6 +141,9 @@ class AutoLayout:
|
||||||
if '华大' in row['classification']:
|
if '华大' in row['classification']:
|
||||||
return 1100
|
return 1100
|
||||||
|
|
||||||
|
if '超加急' in row['priority']:
|
||||||
|
return 1500
|
||||||
|
|
||||||
if row['拆分方式'] == '极致周期' or '极致' in row['拆分方式']:
|
if row['拆分方式'] == '极致周期' or '极致' in row['拆分方式']:
|
||||||
return 2000
|
return 2000
|
||||||
|
|
||||||
|
|
@ -290,7 +297,7 @@ class AutoLayout:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def judge_data(self, chipname, library_data):
|
def judge_data(self, chipname, library_data, max_barcode=False):
|
||||||
"""
|
"""
|
||||||
约束条件
|
约束条件
|
||||||
"""
|
"""
|
||||||
|
|
@ -354,6 +361,21 @@ class AutoLayout:
|
||||||
if (self.chip_speciallib_huada_size[chipname] > self.data_limit / 2) and ('华大' in classification):
|
if (self.chip_speciallib_huada_size[chipname] > self.data_limit / 2) and ('华大' in classification):
|
||||||
use_huada = False
|
use_huada = False
|
||||||
|
|
||||||
|
# 开启i5或者i7
|
||||||
|
if max_barcode:
|
||||||
|
base_balance = True
|
||||||
|
# 开启i7:
|
||||||
|
notrepeatbarcode = True
|
||||||
|
if self.chip_barcodei7_recode[chipname].intersection({item['i7'] for item in library_data['data']}):
|
||||||
|
notrepeatbarcode = False
|
||||||
|
if self.chip_size[chipname] > 900:
|
||||||
|
current_data = copy.deepcopy(self.index_assignments[chipname])
|
||||||
|
new_data = library_data['data']
|
||||||
|
current_data.extend(new_data)
|
||||||
|
ratio_sites, is_not_balance_list = self.count_barcode_radio(current_data, maxt=True)
|
||||||
|
if is_not_balance_list:
|
||||||
|
base_balance = False
|
||||||
|
|
||||||
if sizelimit and notrepeatbarcode and exclusive_classific and exclusive_customer and splibrary and base_balance and spmethylibrary and use_huada:
|
if sizelimit and notrepeatbarcode and exclusive_classific and exclusive_customer and splibrary and base_balance and spmethylibrary and use_huada:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
@ -491,6 +513,7 @@ class AutoLayout:
|
||||||
|
|
||||||
self.combinations_same_barcode()
|
self.combinations_same_barcode()
|
||||||
self.ori_lib_data = sorted(self.ori_lib_data, key=lambda x: (x['level'], x['time']))
|
self.ori_lib_data = sorted(self.ori_lib_data, key=lambda x: (x['level'], x['time']))
|
||||||
|
# self.ori_lib_data = sorted(self.ori_lib_data, key=lambda x: (x['level'] != 100000, -x['size']))
|
||||||
|
|
||||||
while self.ori_lib_data:
|
while self.ori_lib_data:
|
||||||
library_data = self.ori_lib_data[0]
|
library_data = self.ori_lib_data[0]
|
||||||
|
|
@ -520,11 +543,76 @@ class AutoLayout:
|
||||||
if self.chip_size[chipname] > self.data_limit:
|
if self.chip_size[chipname] > self.data_limit:
|
||||||
self.add_loc_num()
|
self.add_loc_num()
|
||||||
|
|
||||||
|
def assign_again(self):
|
||||||
|
"""
|
||||||
|
剩余的数据,开放i5或者i7再排下
|
||||||
|
"""
|
||||||
|
left_data = list()
|
||||||
|
no_need_chipname = list()
|
||||||
|
for chip_idx, chip_assignments in self.index_assignments.items():
|
||||||
|
if not chip_assignments:
|
||||||
|
continue
|
||||||
|
df = pd.DataFrame(chip_assignments)
|
||||||
|
if df['data_needed'].sum() < 1700:
|
||||||
|
left_data.extend(chip_assignments)
|
||||||
|
# del self.index_assignments[chip_idx]
|
||||||
|
no_need_chipname.append(chip_idx)
|
||||||
|
for chip_idx in no_need_chipname:
|
||||||
|
del self.index_assignments[chip_idx]
|
||||||
|
|
||||||
|
ori_library_df = pd.DataFrame(left_data)
|
||||||
|
ori_library_df['level'] = ori_library_df.apply(self.level, axis=1)
|
||||||
|
ori_lib_data = list()
|
||||||
|
for library, library_df in ori_library_df.groupby('#library'):
|
||||||
|
ori_lib_data.append(dict(
|
||||||
|
library=library,
|
||||||
|
is_balance_lib=library_df['is_balance_lib'].values[0],
|
||||||
|
size=library_df['data_needed'].sum(),
|
||||||
|
split_method=library_df['拆分方式'].values[0],
|
||||||
|
time=library_df['time'].values[0],
|
||||||
|
level=library_df['level'].values[0],
|
||||||
|
customer=library_df['customer'].values[0],
|
||||||
|
classification=library_df['classification'].values[0],
|
||||||
|
data=library_df[self.need_cols].to_dict('records')
|
||||||
|
))
|
||||||
|
|
||||||
|
ori_lib_data = sorted(ori_lib_data, key=lambda x: (x['level'], -x['size']))
|
||||||
|
self.loc_chip_num = 100
|
||||||
|
while ori_lib_data:
|
||||||
|
library_data = ori_lib_data[0]
|
||||||
|
chipname = f'chipB{self.loc_chip_num}'
|
||||||
|
|
||||||
|
# 空白芯片直接添加
|
||||||
|
if chipname not in self.index_assignments:
|
||||||
|
self.add_new_data(chipname, library_data)
|
||||||
|
ori_lib_data.remove(library_data)
|
||||||
|
continue
|
||||||
|
|
||||||
|
# 判断条件
|
||||||
|
if self.judge_data(chipname, library_data, max_barcode=True):
|
||||||
|
self.add_new_data(chipname, library_data, newer=False)
|
||||||
|
ori_lib_data.remove(library_data)
|
||||||
|
else:
|
||||||
|
for j in range(len(ori_lib_data)):
|
||||||
|
newlibrary_data = ori_lib_data[j]
|
||||||
|
if self.judge_data(chipname, newlibrary_data, max_barcode=True):
|
||||||
|
ori_lib_data.remove(newlibrary_data)
|
||||||
|
self.add_new_data(chipname, newlibrary_data, newer=False)
|
||||||
|
break
|
||||||
|
j += 1
|
||||||
|
else:
|
||||||
|
self.loc_chip_num += 1
|
||||||
|
|
||||||
|
if self.chip_size[chipname] > self.data_limit:
|
||||||
|
self.loc_chip_num += 1
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
# print('# 测试代码')
|
# print('# 测试代码')
|
||||||
# self.assign_samples()
|
# self.assign_samples()
|
||||||
|
# self.assign_again()
|
||||||
try:
|
try:
|
||||||
self.assign_samples()
|
self.assign_samples()
|
||||||
|
self.assign_again()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.return_log.append(f'T7排样出错, 请联系!{e}')
|
self.return_log.append(f'T7排样出错, 请联系!{e}')
|
||||||
self.index_assignments = {}
|
self.index_assignments = {}
|
||||||
|
|
@ -544,6 +632,9 @@ class AutoLayout:
|
||||||
addname = 'X'
|
addname = 'X'
|
||||||
else:
|
else:
|
||||||
addname = ''
|
addname = ''
|
||||||
|
other_name = ''
|
||||||
|
if 'chipB' in chip_idx and df['barcode'].duplicated().any():
|
||||||
|
other_name = 'i7'
|
||||||
|
|
||||||
if df['data_needed'].sum() < 1600 and not addname:
|
if df['data_needed'].sum() < 1600 and not addname:
|
||||||
df['note'] = '排样数据量不足1600G'
|
df['note'] = '排样数据量不足1600G'
|
||||||
|
|
@ -556,7 +647,7 @@ class AutoLayout:
|
||||||
librarynum += len(set(df['#library'].values))
|
librarynum += len(set(df['#library'].values))
|
||||||
|
|
||||||
self.dec_barcode_radio(chip_idx)
|
self.dec_barcode_radio(chip_idx)
|
||||||
chipname = addname + chip_idx
|
chipname = addname + chip_idx + other_name
|
||||||
|
|
||||||
sum_list = list()
|
sum_list = list()
|
||||||
for library, library_df in df.groupby('#library'):
|
for library, library_df in df.groupby('#library'):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue