main
parent
d3173ebb75
commit
41d6e0cc7c
17
tools/t7.py
17
tools/t7.py
|
|
@ -9,6 +9,14 @@ import pandas as pd
|
|||
from tools.common import basedir, log
|
||||
|
||||
|
||||
# 定义一个格式化函数
|
||||
def format_date(date):
|
||||
if isinstance(date, pd.Timestamp):
|
||||
return date.strftime('%Y-%m-%d')
|
||||
else:
|
||||
return str(date)
|
||||
|
||||
|
||||
class AutoLayout:
|
||||
"""
|
||||
自动化派样
|
||||
|
|
@ -286,6 +294,7 @@ class AutoLayout:
|
|||
need_col.append('note')
|
||||
|
||||
no_ori_data = ori_library_df[~(numeric_mask & time_mask) | status_mask]
|
||||
no_ori_data.loc[:, 'time'] = no_ori_data['time'].apply(format_date)
|
||||
self.no_assign_data.extend(no_ori_data.to_dict('records'))
|
||||
|
||||
# 使用布尔索引筛选出不是数字和非日期的行
|
||||
|
|
@ -302,6 +311,13 @@ class AutoLayout:
|
|||
|
||||
size = library_df['data_needed'].sum()
|
||||
|
||||
# 文库内部有重复
|
||||
if len(library_df['barcode'].values) > len(set(library_df['barcode'].values)):
|
||||
library_df['note'] = '文库内部有重复'
|
||||
library_df.loc[:, 'time'] = library_df['time'].apply(format_date)
|
||||
self.no_assign_data.extend(library_df.to_dict('records'))
|
||||
continue
|
||||
|
||||
flag = False
|
||||
if size > (self.data_limit) / 2:
|
||||
library_df['data_needed'] = library_df['data_needed'] / 2
|
||||
|
|
@ -390,6 +406,7 @@ class AutoLayout:
|
|||
df['time'] = df['time'].dt.strftime('%Y-%m-%d')
|
||||
|
||||
if df['data_needed'].sum() < 1600 or librarynum > self.librarynum:
|
||||
df['note'] = '排样数据量不足1600或者排样管数超标'
|
||||
self.no_assign_data.extend(df.to_dict('records'))
|
||||
continue
|
||||
librarynum += len(set(df['#library'].values))
|
||||
|
|
|
|||
Loading…
Reference in New Issue