hns
3 years ago
25 changed files with 84 additions and 35 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,41 @@ |
|||
import frappe |
|||
from frappe.model.document import Document |
|||
import json |
|||
import os |
|||
|
|||
current_db_name = frappe.conf.get("db_name") |
|||
|
|||
@frappe.whitelist() |
|||
def check_vehicle_update(vehicle_list): |
|||
Vehicle_req_list = [] |
|||
response = {} |
|||
v_list = json.loads(vehicle_list) |
|||
vehi = v_list['Vehicle'] |
|||
iid = v_list['InstallationId'] |
|||
vehicle_data = v_list['VehicleReqList'] |
|||
publish_type = frappe.db.sql( |
|||
'''SELECT publish_type FROM {}.`tabApp Device` where name='{}';'''.format(current_db_name,iid), as_list=True) |
|||
|
|||
creation_times = [] |
|||
publish_list = [] |
|||
|
|||
if publish_type[0][0] != None: |
|||
publish_type = publish_type[0][0] |
|||
for v in vehicle_data: |
|||
l_id = v['LanguageID'] |
|||
current_version = v['CurrentVersion'] |
|||
# version_creation_time = frappe.db.sql(''' select creation FROM {}.tabPublish where version = '{}' and language= '{}';'''.format(current_db_name,current_version,l_id)) |
|||
# publish_data = frappe.db.sql('''select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and version > {} and publish_type= '{}' and vehicle_status = 'Active';''' |
|||
# .format(current_db_name,v,l_id,current_version,l_id),as_dict=True) |
|||
|
|||
publish_data = frappe.db.sql(''' select name,version from {}.tabPublish where vehicle= '{}' and language='{}' and version > {} and publish_type= '{}' and vehicle_status = 'Active'; |
|||
'''.format(current_db_name,vehi,l_id,current_version,publish_type),as_dict= True) |
|||
# for d in publish_data: |
|||
|
|||
publish_list.append(publish_data) |
|||
|
|||
|
|||
return publish_list |
|||
|
|||
|
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue