添加汇总,barcode非16位,则按后8位处理
parent
82c31b8d56
commit
796b2deef4
24
tools/t7.py
24
tools/t7.py
|
|
@ -493,12 +493,14 @@ class AutoLayout:
|
|||
|
||||
# 非正常barcode
|
||||
barcode_mask = ori_library_df['indexi5i7'].str.len() != 16
|
||||
ori_library_df.loc[barcode_mask, 'indexi5i7'] = ori_library_df.loc[barcode_mask, 'indexi5'].str[-8:] + \
|
||||
ori_library_df.loc[barcode_mask, 'indexi7'].str[-8:]
|
||||
|
||||
ori_library_df['note'] = ''
|
||||
ori_library_df.loc[~numeric_mask, 'note'] = 'data_needed 列非数字'
|
||||
ori_library_df.loc[~time_mask, 'note'] = 'time 列非日期'
|
||||
ori_library_df.loc[barcode_mask, 'note'] = '非16位barcode'
|
||||
no_ori_data = ori_library_df[~(numeric_mask & time_mask) | barcode_mask]
|
||||
# ori_library_df.loc[barcode_mask, 'note'] = '非16位barcode'
|
||||
no_ori_data = ori_library_df[~(numeric_mask & time_mask)]
|
||||
|
||||
self.no_assign_data.extend(no_ori_data.to_dict('records'))
|
||||
|
||||
|
|
@ -693,6 +695,7 @@ class AutoLayout:
|
|||
writer = pd.ExcelWriter(outputpath)
|
||||
|
||||
res = list()
|
||||
sum_res = list()
|
||||
chip_loc = 1
|
||||
librarynum = 0
|
||||
for chip_idx, chip_assignments in self.index_assignments.items():
|
||||
|
|
@ -725,10 +728,27 @@ class AutoLayout:
|
|||
# df.to_excel(writer, sheet_name=chipname, index=False)
|
||||
res.extend(df.to_dict('records'))
|
||||
chip_loc += 1
|
||||
|
||||
sum_list = list()
|
||||
for library, library_df in df.groupby('samplename'):
|
||||
sum_list.append(dict(
|
||||
二次拆分=library,
|
||||
客户=library_df['companynamea'].values[0],
|
||||
类型=library_df['classification'].values[0],
|
||||
打折前=library_df['orderdatavolume'].sum()
|
||||
))
|
||||
df_sum = pd.DataFrame(sum_list)
|
||||
sum_res.append({'sheetname': chipname, 'data': df_sum})
|
||||
|
||||
res_df = pd.DataFrame(res)
|
||||
res_df = pd.concat([pd.DataFrame(self.items), res_df]).reset_index(drop=True)
|
||||
res_df.to_excel(writer, sheet_name='assignment', index=False)
|
||||
|
||||
for sum_sheet in sum_res:
|
||||
sheetname = sum_sheet.get('sheetname')
|
||||
df_data = sum_sheet.get('data')
|
||||
df_data.to_excel(writer, sheet_name=sheetname, index=False)
|
||||
|
||||
no_assign_df = pd.DataFrame(self.no_assign_data)
|
||||
if not no_assign_df.empty:
|
||||
no_assign_df = no_assign_df.applymap(lambda x: format_date(x) if isinstance(x, pd.Timestamp) else x)
|
||||
|
|
|
|||
Loading…
Reference in New Issue