diff --git a/rule/exclusive_customer.xlsx b/rule/exclusive_customer.xlsx new file mode 100644 index 0000000..790f3d1 Binary files /dev/null and b/rule/exclusive_customer.xlsx differ diff --git a/tools/t7.py b/tools/t7.py index a6f4d9c..a6e3c1e 100644 --- a/tools/t7.py +++ b/tools/t7.py @@ -41,6 +41,7 @@ class AutoLayout: # 文库 self.chip_classification = defaultdict(set) self.rule = self.read_rule() + self.rule_exclusive_customer = self.read_rule_exclusive_customer() # 不平衡文库 self.chip_speciallib_size = dict() @@ -162,6 +163,15 @@ class AutoLayout: res = pd.concat([df, newdf]) return res.reset_index() + @staticmethod + def read_rule_exclusive_customer(): + df = pd.read_excel(os.path.join(basedir, 'rule', 'exclusive_customer.xlsx')) + newdf = pd.DataFrame() + newdf['customer1'] = df['customer2'] + newdf['customer2'] = df['customer1'] + res = pd.concat([df, newdf]) + return res.reset_index() + @staticmethod def read_cols(): df = pd.read_excel(os.path.join(basedir, 'rule', 'columns.xlsx')) @@ -230,12 +240,19 @@ class AutoLayout: return True return False + def use_rule_exclusive_customer(self, chipname, customer): + may_classfic = set(self.rule_exclusive_customer[self.rule_exclusive_customer['customer1'] == customer]['customer2']) + if self.chip_customer[chipname].intersection(may_classfic): + return True + return False + def judge_data(self, chipname, library_data): """ 约束条件 """ size = library_data['size'] classification = library_data['classification'] + customer = library_data['customer'] is_balance_lib = library_data['is_balance_lib'] # 芯片大小不能超过设定限制 @@ -257,6 +274,11 @@ class AutoLayout: if self.use_rule(chipname, classification): exclusive_classific = False + # 互斥的用户 + exclusive_customer = True + if self.use_rule_exclusive_customer(chipname, customer): + exclusive_customer = False + # 不平衡文库大于250G 不能添加 splibrary = True if is_balance_lib == '否' and self.chip_speciallib_size[chipname] + size > 250: @@ -282,7 +304,7 @@ class AutoLayout: if is_not_balance_list: base_balance = False - if sizelimit and notrepeatbarcode and exclusive_classific and splibrary and base_balance and spmethylibrary: + if sizelimit and notrepeatbarcode and exclusive_classific and exclusive_customer and splibrary and base_balance and spmethylibrary: return True return False