|
@@ -1228,17 +1228,23 @@ class DeviceManagement(View):
|
|
|
if file_type == 2:
|
|
|
for item in file:
|
|
|
item = item.decode().strip().replace(" ", "")
|
|
|
+ serial = item[:6]
|
|
|
# 请求序列号系统查询获取序列号记录
|
|
|
url = 'http://{}/serialNumber/checkSerialLog'.format(SERIAL_DOMAIN_NAME)
|
|
|
- params = {'serial': item[:6]}
|
|
|
+ params = {'serial': serial}
|
|
|
r = requests.get(url=url, params=params, timeout=5)
|
|
|
assert r.status_code == 200
|
|
|
result = eval(r.content)
|
|
|
is_reset = 0 if result['code'] == 0 else 1
|
|
|
|
|
|
- uid = CommonService.get_uid_by_serial_number(item[:9])
|
|
|
- # 根据uid查询设备信息
|
|
|
- device_name, ip, username = cls.get_device_info(uid)
|
|
|
+ uid = CommonService.get_uid_by_serial_number(serial)
|
|
|
+ # 序列号没绑定uid,需要重置
|
|
|
+ if uid == serial:
|
|
|
+ is_reset = 1
|
|
|
+ uid, device_name, ip, username = '', '', '', ''
|
|
|
+ else:
|
|
|
+ # 根据uid查询设备信息
|
|
|
+ device_name, ip, username = cls.get_device_info(uid)
|
|
|
|
|
|
device_info_data = {
|
|
|
'isReset': is_reset,
|