开放数据上线下限
parent
6225342e33
commit
5f1d326bb1
35
T7_client.py
35
T7_client.py
|
|
@ -22,7 +22,7 @@ def recvdata(conn, filepath):
|
|||
recv_len += len(correntrecv)
|
||||
|
||||
|
||||
def senddata(conn, path, librarynum, is_use_balance, is_use_max):
|
||||
def senddata(conn, path, librarynum, is_use_balance, is_use_max, datalimit, datalower):
|
||||
name = os.path.basename(os.path.realpath(path))
|
||||
try:
|
||||
with open(path, 'rb') as file:
|
||||
|
|
@ -32,7 +32,9 @@ def senddata(conn, path, librarynum, is_use_balance, is_use_max):
|
|||
contentname=name,
|
||||
librarynum=librarynum,
|
||||
is_use_balance=is_use_balance,
|
||||
is_use_max=is_use_max
|
||||
is_use_max=is_use_max,
|
||||
datalimit=datalimit,
|
||||
datalower=datalower
|
||||
)
|
||||
headerjson = json.dumps(headerdic)
|
||||
headerbytes = headerjson.encode('utf-8')
|
||||
|
|
@ -52,9 +54,9 @@ def connect():
|
|||
return client
|
||||
|
||||
|
||||
def transclient(sendfile, resfile, librarynum, is_use_balance, is_use_max):
|
||||
def transclient(sendfile, resfile, librarynum, is_use_balance, is_use_max, datalimit, datalower):
|
||||
conn = connect()
|
||||
senddata(conn, sendfile, librarynum, is_use_balance, is_use_max)
|
||||
senddata(conn, sendfile, librarynum, is_use_balance, is_use_max, datalimit, datalower)
|
||||
recvdata(conn, resfile)
|
||||
|
||||
|
||||
|
|
@ -62,14 +64,17 @@ def make_gui():
|
|||
sg.theme('DarkBlack1')
|
||||
|
||||
layout = [
|
||||
[sg.Text('排样管数'), sg.Spin([i for i in range(150)], initial_value=130, size=(3, 1), key='_LIBRARYNUM_')],
|
||||
[sg.Text('排样管数'), sg.Spin([i for i in range(150)], initial_value=130, size=(3, 1), key='_LIBRARYNUM_'),
|
||||
sg.Text('单芯片量上限'), sg.Spin([i for i in range(2000)], initial_value=1750, size=(4, 1), key='_DATALIMIT_'),
|
||||
sg.Text('单芯片量下限'), sg.Spin([i for i in range(2000)], initial_value=1700, size=(4, 1), key='_DATALOWER_')
|
||||
],
|
||||
[sg.Text()],
|
||||
|
||||
[sg.Text('使用平衡文库'), sg.Radio("是", "is_use_balance", key='is_use_balance', default=True),
|
||||
sg.Radio("否", "is_use_balance", key='is_not_use_balance')],
|
||||
[sg.Text('使用平衡文库'), sg.Radio("是", "is_use_balance", key='is_use_balance_key', default=True),
|
||||
sg.Radio("否", "is_use_balance", key='is_not_use_balance_key')],
|
||||
|
||||
[sg.Text('使用扩容平衡性'), sg.Radio("是", "is_use_max", key='is_use_max'),
|
||||
sg.Radio("否", "is_use_max", key='is_not_use_max', default=True)],
|
||||
[sg.Text('使用扩容平衡性'), sg.Radio("是", "is_use_max", key='is_use_max_key'),
|
||||
sg.Radio("否", "is_use_max", key='is_not_use_max_key', default=True)],
|
||||
[sg.Text()],
|
||||
|
||||
[
|
||||
|
|
@ -86,18 +91,20 @@ def make_gui():
|
|||
sg.OK('生成'), sg.Cancel('取消')]]
|
||||
# iconpath = os.path.join(os.path.abspath(sys.path[0]), 'other', 'icon.ico')
|
||||
window = sg.Window('解码排样T7程序', layout, font='Helvetica 11', icon=r'D:\project\autulayout\other\icon.ico')
|
||||
|
||||
while True:
|
||||
event, values = window.read()
|
||||
is_use_balance = 1 if values['is_use_balance'] else 0
|
||||
is_use_max = 1 if values['is_use_max'] else 0
|
||||
|
||||
if event == sg.WINDOW_CLOSED:
|
||||
# 用户关闭了窗口,终止循环
|
||||
break
|
||||
is_use_balance = 1 if values['is_use_balance_key'] else 0
|
||||
is_use_max = 1 if values['is_use_max_key'] else 0
|
||||
print(is_use_balance, is_use_max)
|
||||
if event == '生成':
|
||||
if not values['_FILE1_'] or not values['_FILE2_']:
|
||||
sg.popup_non_blocking('请正确提供参数')
|
||||
else:
|
||||
transclient(values['_FILE1_'], os.path.join(values['_FILE2_']), values['_LIBRARYNUM_'],
|
||||
is_use_balance, is_use_max)
|
||||
is_use_balance, is_use_max, values['_DATALIMIT_'], values['_DATALOWER_'])
|
||||
sg.Popup('排样成功!')
|
||||
window.Close()
|
||||
else:
|
||||
|
|
|
|||
19
T7_server.py
19
T7_server.py
|
|
@ -25,6 +25,8 @@ def recvdata(conn, path):
|
|||
librarynum = header_dic['librarynum']
|
||||
is_use_balance = header_dic['is_use_balance']
|
||||
is_use_max = header_dic['is_use_max']
|
||||
datalimit = header_dic['datalimit']
|
||||
datalower = header_dic['datalower']
|
||||
recv_len = 0
|
||||
fielpath = os.path.join(path, '%s_%s' % (datetime.now().strftime("%m%d%H%M"), content_name))
|
||||
file = open(fielpath, 'wb')
|
||||
|
|
@ -33,7 +35,7 @@ def recvdata(conn, path):
|
|||
file.write(correntrecv)
|
||||
recv_len += len(correntrecv)
|
||||
file.close()
|
||||
return fielpath, librarynum, is_use_balance, is_use_max
|
||||
return fielpath, librarynum, is_use_balance, is_use_max, datalimit, datalower
|
||||
|
||||
|
||||
def senddata(conn, path, message=None):
|
||||
|
|
@ -70,18 +72,15 @@ def server():
|
|||
myserver.bind(adrss)
|
||||
myserver.listen(5)
|
||||
|
||||
# myclient, adddr = myserver.accept()
|
||||
# recv_content, chipnum = recvdata(myclient, os.path.join(basedir, 'example'))
|
||||
# layout = T7(recv_content, chipnum)
|
||||
# outputpath = layout.run()
|
||||
# senddata(myclient, outputpath)
|
||||
|
||||
while True:
|
||||
try:
|
||||
myclient, adddr = myserver.accept()
|
||||
recv_content, librarynum, is_use_balance, is_use_max = recvdata(myclient, os.path.join(basedir, 'example'))
|
||||
print(recv_content, librarynum, is_use_balance, is_use_max)
|
||||
layout = T7(recv_content, librarynum, is_use_balance, is_use_max)
|
||||
recv_content, librarynum, is_use_balance, is_use_max, datalimit, datalower = recvdata(myclient,
|
||||
os.path.join(basedir,
|
||||
'example'))
|
||||
print(recv_content, librarynum, is_use_balance, is_use_max, datalimit, datalower)
|
||||
layout = T7(recv_content, librarynum, is_use_balance, is_use_max, data_limit=datalimit,
|
||||
data_lower=datalower)
|
||||
outputpath = layout.run()
|
||||
senddata(myclient, outputpath)
|
||||
except Exception as e:
|
||||
|
|
|
|||
12
tools/t7.py
12
tools/t7.py
|
|
@ -19,11 +19,13 @@ class AutoLayout:
|
|||
自动化派样
|
||||
"""
|
||||
|
||||
def __init__(self, path, librarynum, is_use_balance=1, is_use_max=0, output=basedir, data_limit=1750):
|
||||
def __init__(self, path, librarynum, is_use_balance=1, is_use_max=0, output=basedir, data_limit=1750,
|
||||
data_lower=1700):
|
||||
self.path = path
|
||||
self.output = output
|
||||
self.librarynum = int(librarynum)
|
||||
self.data_limit = data_limit
|
||||
self.data_lower = data_lower
|
||||
|
||||
# 芯片原始数据读取
|
||||
self.ori_data = self.read_excel()
|
||||
|
|
@ -358,7 +360,7 @@ class AutoLayout:
|
|||
if is_balance_lib == '甲基化' and self.chip_methylib_size[chipname] + size > 100:
|
||||
spmethylibrary = False
|
||||
|
||||
# 不使用平衡文库
|
||||
# 不使用不平衡文库的判断
|
||||
if not self.is_use_balance:
|
||||
splibrary = True
|
||||
spmethylibrary = True
|
||||
|
|
@ -603,7 +605,7 @@ class AutoLayout:
|
|||
if not chip_assignments:
|
||||
continue
|
||||
df = pd.DataFrame(chip_assignments)
|
||||
if df['data_needed'].sum() < 1700:
|
||||
if df['data_needed'].sum() < self.data_lower:
|
||||
left_data.extend(chip_assignments)
|
||||
no_need_chipname.append(chip_idx)
|
||||
for chip_idx in no_need_chipname:
|
||||
|
|
@ -692,8 +694,8 @@ class AutoLayout:
|
|||
# if 'chipB' in chip_idx and df['barcode'].duplicated().any():
|
||||
# other_name = '_i7'
|
||||
|
||||
if df['data_needed'].sum() < 1600 and not addname:
|
||||
df['note'] = '排样数据量不足1600G'
|
||||
if df['data_needed'].sum() < (self.data_lower - 50) and not addname:
|
||||
df['note'] = f'排样数据量不足{self.data_lower - 50}G'
|
||||
self.no_assign_data.extend(df.to_dict('records'))
|
||||
continue
|
||||
if librarynum > self.librarynum:
|
||||
|
|
|
|||
Loading…
Reference in New Issue