|
@@ -21,7 +21,7 @@ from django.http import QueryDict, HttpResponse
|
|
|
from django.views import View
|
|
|
|
|
|
from Ansjer.config import LOGGER
|
|
|
-from Model.models import ProductsScheme, DeviceScheme
|
|
|
+from Model.models import ProductsScheme, DeviceScheme, DeviceTypeModel, CompanySerialModel
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
|
|
@@ -450,16 +450,41 @@ class ProductsSchemeManageView(View):
|
|
|
# 获取关联的产品方案信息
|
|
|
product_scheme = ProductsScheme.objects.filter(storage_code=device.storage_code).first()
|
|
|
|
|
|
+ device_type_qs = DeviceTypeModel.objects.filter(type=device.device_type).values('name')
|
|
|
+ device_name = device.device_type
|
|
|
+ if device_type_qs.exists():
|
|
|
+ device_name = device_type_qs[0]['name']
|
|
|
+ status = 'N/A'
|
|
|
+ if device.device_type != 0:
|
|
|
+ serial_qs = CompanySerialModel.objects.filter(serial_number=device.serial_number[0:6]).first(
|
|
|
+ 'status')
|
|
|
+ status = '已激活' if serial_qs and serial_qs.status > 1 else '未激活'
|
|
|
device_data = {
|
|
|
'id': device.id,
|
|
|
'serialNumber': device.serial_number,
|
|
|
- 'deviceType': device.device_type,
|
|
|
+ 'deviceType': device_name,
|
|
|
'phoneModel': device.phone_model,
|
|
|
'storageCode': device.storage_code,
|
|
|
'createdTime': device.created_time,
|
|
|
'updatedTime': device.updated_time,
|
|
|
+ 'snStatus': status
|
|
|
}
|
|
|
if product_scheme:
|
|
|
+ # 提取需要拼接的字段值(按顺序)
|
|
|
+ scheme_fields = [
|
|
|
+ product_scheme.flash,
|
|
|
+ product_scheme.ddr,
|
|
|
+ product_scheme.main_controller,
|
|
|
+ product_scheme.wifi,
|
|
|
+ product_scheme.four_g,
|
|
|
+ product_scheme.ad,
|
|
|
+ product_scheme.phy,
|
|
|
+ product_scheme.sensor
|
|
|
+ ]
|
|
|
+
|
|
|
+ # 过滤空值并拼接为字符串
|
|
|
+ scheme_data = '+'.join([str(field) for field in scheme_fields if field])
|
|
|
+
|
|
|
device_data.update({
|
|
|
'orderNumber': product_scheme.order_number if product_scheme.order_number else '',
|
|
|
'type': 'NVR' if product_scheme.device_type == 1 else 'IPC',
|
|
@@ -473,6 +498,7 @@ class ProductsSchemeManageView(View):
|
|
|
'sensor': product_scheme.sensor if product_scheme.sensor else '',
|
|
|
'orderQuantity': product_scheme.order_quantity if product_scheme.order_quantity else '',
|
|
|
'customerCode': product_scheme.customer_code if product_scheme.customer_code else '',
|
|
|
+ 'schemeData': scheme_data,
|
|
|
'remark': product_scheme.remark if product_scheme.remark else ''
|
|
|
})
|
|
|
device_list.append(device_data)
|