Commit 0065abee by 陈森彬

Merge branches 'dev2' and 'master' of ssh://119.23.72.7:22611/lic/bom_identify into dev2

parents 5d2224c9 e6d2daa6
Showing with 20 additions and 20 deletions
......@@ -3,37 +3,37 @@
import grpc
from protobuf import classify_pb2
from protobuf import classify_pb2_grpc
import json
import pandas as pd
def get_test_data():
df = pd.read_excel(r'C:\Users\ICHUNT\Desktop\bomlist\150套标准.xlsx', header=None)
def get_test_data(path):
df = pd.read_excel(path, header=None)
df.fillna('?', inplace=True)
dic_dft = df.to_dict(orient='list')
print(dic_dft)
a=r'{"1":["?","10uF ±10% 16V","0603 ±20% 10V","3.9nF ±10% "],"2":["AC0201FR-0710KL","?","?","?"],"3":["?","?","?","0402"],"4":[2500,3000,1800,3000],"5":["?","?","?","?"],"6":["?","?","?","?"]}'
return json.dumps(dic_dft)
return dic_dft
def run():
# 连接 rpc 服务器
# channel = grpc.insecure_channel('192.168.2.232:50051')
channel = grpc.insecure_channel('localhost:50051')
# 调用 rpc 服务C:\Users\ICHUNT\Pictures\Saved Pictures\1.png
channel = grpc.insecure_channel('192.168.2.232:50051')
stub = classify_pb2_grpc.classifyStub(channel)
test = get_test_data()
test = '1v'
response = stub.Classify(classify_pb2.ClassifyRequest(keyword=test))
print("Classify client received: " + response.message)
if __name__ == '__main__':
run()
# !/usr/bin/env python
# -*- coding:utf-8 -*-
# import requests
# d={"1":["LIEXIN001","STM32L4R9ZIY6TR"],"2":[100,200],"3":["?","?"],"4":["?","?"],"5":["?","?"],"6":["?","?"]}
# js = json.dumps(d)
# # b=requests.post('http://192.168.2.232:50052/dict', data=js).text
# b=requests.post('http://127.0.0.1:50052/dict', data=js).text
# b=json.loads(b)
# print(b)
# run()
import json
import requests
# d=get_test_data(r"C:\Users\ICHUNT\Documents\DZ0901_V1.4_BOM.xlsx")
# print(d)
d = {'3': ['?', '?', '名称', '电阻', '电阻', '电阻', '电阻', '电容', '钽电容', '钽电容', '二极管', '二极管', '发光二极管', '自恢复保险丝', '三极管', 'MOS管', '电源芯片', '逻辑器件', 'WIFI模组', '接线座子', '接线座子', '轻触按键', '?'], '4': ['?', '?', '?', '0402X105K6R3NT', '0402X105K6R3NT', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'JMK105BJ105KV-F'], '5': ['?', '?', '描述', 'RES,0603,10Ω±5%,1/10W', 'RES,0603,1KΩ±5%,1/10W', 'RES,0603,4.7KΩ±5%,1/10W', 'RES,0603,10KΩ±5%,1/10W', 'CAP,SMD0603,100nF±10%,16V', 'CAP,SMD3528,10uF±10%,16V', 'CAP,SMD3528,22uF±10%,16V', 'DIODE,SMB(DO-214AA),SMBJ5.0CA', 'SMA(DO-214AC) ,SS34 肖特基二极管 40V/3A', 'SMD0805 红色LED', '贴片封装1812 6V 3A', 'TRIODE,SOT-23,2N3904', 'N-MOSFET,SOT-23,SI2302', 'IC,CJA1117B-3.3 ,SOT-89-3N', 'IC,SN74HC125PW TSSOP-14', 'ESP-F1 模组', '贴片卧式插座 间距1.25/1.27MM 8PIN', 'KF2EDG-2PIN间距3.81mm 弯脚一对', '侧脚 6*6*5MM 轻触按键 带支架 立式', '1uF(105) ±10% 6.3V'], '6': ['?', '?', '用量', 3, 4, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 10], '7': ['?', '?', 'A面位置', 'R10,R11,R12', 'R2,R4,R7,R8', 'R6', 'R1,R5,R9', 'C3,C4,C6', 'E1', 'E2', 'D1', 'D3', 'D2', 'F1', 'Q2', 'Q1', 'U2', 'U4', 'U3', 'J4', 'J1,J2', 'K1', '?'], '8': ['?', '?', 'B面位置', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?'], '9': ['?', '?', '品牌', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '右侧参考图片', '右侧参考图片', '右侧参考图片', 'TAIYO '], '10': ['?', '?', '备注', '?', 10, 0.3, '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 'https://detail.tmall.com/item.htm?id=555809251133&ali_refid=a3_430673_1006:1109983619:N:%E5%BA%A7%E5%AD%90:6670de4731121049ff6e61b5ac2ad7d1&ali_trackid=1_6670de4731121049ff6e61b5ac2ad7d1&spm=a2e15.8261149.07626516002.6&skuId=3598966783405', '?', 100], '11': ['?', '需求数量', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?']}
# # print('\r\n'.join(d))
d=json.dumps(d)
print(d)
# b=requests.post('http://192.168.2.232:50052/kw?type=param', data=d).text
b=requests.post('http://127.0.0.1:50052/dict', data=d).text
# #
# b=json.loads(b)
print(b)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment