Browse Source

uplaod 3

master
hns 3 years ago
parent
commit
6e13f6dcf9
  1. BIN
      smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc
  2. 16
      smart_service/add_ons/report/model_hit_report/model_hit_report.js
  3. 31
      smart_service/add_ons/report/model_hit_report/model_hit_report.py
  4. BIN
      smart_service/apis/__pycache__/app_user_login.cpython-38.pyc
  5. BIN
      smart_service/apis/__pycache__/publish_api.cpython-38.pyc
  6. BIN
      smart_service/apis/__pycache__/testPublish.cpython-38.pyc
  7. BIN
      smart_service/apis/__pycache__/transaction_api.cpython-38.pyc
  8. BIN
      smart_service/apis/__pycache__/update_validation.cpython-38.pyc
  9. 2
      smart_service/apis/app_user_login.py
  10. 41
      smart_service/apis/testPublish.py
  11. 7
      smart_service/apis/update_validation.py
  12. BIN
      smart_service/mahindra_smart_service/report/_drive_translation/__pycache__/_drive_translation.cpython-38.pyc
  13. BIN
      smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc
  14. BIN
      smart_service/mahindra_smart_service/report/_procedure_report/__pycache__/_procedure_report.cpython-38.pyc
  15. BIN
      smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc
  16. 8
      smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py
  17. BIN
      smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc
  18. 4
      smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py
  19. BIN
      smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc
  20. BIN
      smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc
  21. BIN
      smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc
  22. 2
      smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py
  23. BIN
      smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc
  24. 2
      smart_service/masters/doctype/vehi_master/vehi_master.json
  25. 4
      smart_service/templates/includes/login/_login.js

BIN
smart_service/add_ons/report/model_hit_report/__pycache__/model_hit_report.cpython-38.pyc

Binary file not shown.

16
smart_service/add_ons/report/model_hit_report/model_hit_report.js

@ -19,18 +19,18 @@ frappe.query_reports["Model Hit Report"] = {
default: frappe.datetime.year_end(),
"reqd": 0
},
{
"fieldname":"model",
"label": __("Model"),
"fieldtype": "Link",
"options" : "App Users",
"reqd": 0
},
// {
// "fieldname":"model",
// "label": __("Model"),
// "fieldtype": "Link",
// "options" : "Vehicle",
// "reqd": 0
// },
{
"fieldname":"variant",
"label": __("Variant"),
"fieldtype": "Link",
"options" : "App Device",
"options" : "Variant",
"reqd": 0
}

31
smart_service/add_ons/report/model_hit_report/model_hit_report.py

@ -6,7 +6,9 @@ from __future__ import unicode_literals
import frappe
from frappe.utils import cstr, cint, getdate
from frappe import msgprint, _
import datetime
current_db_name = frappe.conf.get("db_name")
def execute(filters=None):
columns, data = [], []
@ -16,14 +18,14 @@ def execute(filters=None):
def get_data(filters):
variantfilter=filters['variant']
if filters.get('model') and filters.get('variant'):
data = frappe.db.sql("""select dealer.zone,au.user_id,au.first_name,dealer.dealer_code,dealer.dealer_name,dealer.area,ad.os,ad.os_version,
al.device,ad.device_id,ad.app_current_version,al.type,al.date_time_stamp,al.creation,date(al.date_time_stamp) as date,time(al.date_time_stamp) as time,time(al.date_time_stamp) as last_time
from `tabApp Log` al,`tabApp Device` ad,`tabModel Hit` au,`tabApp Dealer` dealer
where
ad.name = %s and al.device = %s and au.name = %s and au.dealer = dealer.name and al.type = 'Installed' and
(al.modified between %s and %s)""",(filters.get('device'),filters.get('device'),filters.get('user'),filters.get('from_date'), filters.get('to_date')), as_dict=1)
if filters.get('variant'):
data = frappe.db.sql("""SELECT date(date) as date, device_id, module_id, vehicle_id, variant_id, system_id, sub_system_id, procedure_id, steps_id, count(*) as count
FROM {0}.`tabModel Usage`
GROUP BY user_id, device_id, vehicle_id, variant_id, variant_mapping_id, system_id, sub_system_id, procedure_id, steps_id;""".format(current_db_name), as_dict=1)
frappe.msgprint(str(filters))
if data:
return data
else:
@ -38,13 +40,14 @@ def get_columns():
{"label": _("Dealer Name"), "fieldname": "dealer_name", "fieldtype": "Data", "width": 100},
{"label": _("Dealer Location"), "fieldname": "area", "fieldtype": "Data", "width": 100},
{"label": _("Zone"), "fieldname": "zone", "fieldtype": "Data", "width": 100},
{"label": _("Device"), "fieldname": "device_type", "fieldtype": "Data", "width": 100},
{"label": _("Module"), "fieldname": "module", "fieldtype": "Data", "width": 150},
{"label": _("Model"), "fieldname": "model", "fieldtype": "Data", "width": 100},
{"label": _("Variant"), "fieldname": "variant", "fieldtype": "Data", "width": 100},
{"label": _("System"), "fieldname": "system", "fieldtype": "Data", "width": 100},
{"label": _("Procedure"), "fieldname": "procedure", "fieldtype": "Data", "width": 100},
{"label": _("Steps"), "fieldname": "steps", "fieldtype": "Data", "width": 100},
{"label": _("Device"), "fieldname": "device_id", "fieldtype": "Data", "width": 100},
{"label": _("Module"), "fieldname": "module_id", "fieldtype": "Data", "width": 150},
{"label": _("Model"), "fieldname": "vehicle_id", "fieldtype": "Data", "width": 100},
{"label": _("Variant"), "fieldname": "variant_id", "fieldtype": "Data", "width": 100},
{"label": _("System"), "fieldname": "system_id", "fieldtype": "Data", "width": 100},
{"label": _("Sub System"), "fieldname": "sub_system_id", "fieldtype": "Data", "width": 100},
{"label": _("Procedure"), "fieldname": "procedure_id", "fieldtype": "Data", "width": 100},
{"label": _("Steps"), "fieldname": "steps_id", "fieldtype": "Data", "width": 100},
{"label": _("Count"), "fieldname": "count", "fieldtype": "Data", "width": 100}
]
return columns

BIN
smart_service/apis/__pycache__/app_user_login.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/publish_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/testPublish.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/transaction_api.cpython-38.pyc

Binary file not shown.

BIN
smart_service/apis/__pycache__/update_validation.cpython-38.pyc

Binary file not shown.

2
smart_service/apis/app_user_login.py

@ -41,7 +41,7 @@ def app_user_validation(usr, pwd):
dictValue = xml_to_dict(node)
dicData={
"ID": "",
"ID": "{}@email.com".format(usr),
"LoginName": usr,
"FirstName": "",
"LastName": "",

41
smart_service/apis/testPublish.py

@ -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

7
smart_service/apis/update_validation.py

@ -74,14 +74,15 @@ def check_vehicle_update(vehicle_list):
if publish_type[0][0] == 'Internal':
data = frappe.db.sql('''SELECT name,CAST(version AS DECIMAL(10,2)) as version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(current_db_name,vehi, l_id, publish_type[0][0], current_version), as_dict=True)
else:
data = frappe.db.sql('''SELECT name,version,language FROM {}.tabPublish where vehicle='{}' and language='{}' and publish_status='Published'
and publish_type='{}' and vehicle_status='Active' and version > '{}' order by version ASC;'''.format(current_db_name,vehi, l_id, publish_type[0][0], current_version), as_dict=True)
list1 = []
dict1 = {}
base_url = '/home/frappe_srv_01/frappe-bench/sites/ss.hnsonline.com/public'
base_url = '/home/frappe_srv_01/frappe-bench/sites/ss.hnsonline.com/public'
for d in data:
ver = str(d['version'])
file_name = 'files/json_files/'+vehi + "-" + \
@ -95,8 +96,8 @@ def check_vehicle_update(vehicle_list):
f_name = "/files/json_files/temp/%s-%s_%s.json" % (
iid, vehi, l_id)
# with open(base_url+f_name, 'w') as outfile:
# outfile.write(json.dumps(dict1))
with open(base_url+f_name, 'w') as outfile:
outfile.write(json.dumps(dict1))
# res = {}
# res['Name'] = '%s-%s_%s' % (iid, vehi, l_id)

BIN
smart_service/mahindra_smart_service/report/_drive_translation/__pycache__/_drive_translation.cpython-38.pyc

Binary file not shown.

BIN
smart_service/mahindra_smart_service/report/_fuel_translation/__pycache__/_fuel_translation.cpython-38.pyc

Binary file not shown.

BIN
smart_service/mahindra_smart_service/report/_procedure_report/__pycache__/_procedure_report.cpython-38.pyc

Binary file not shown.

BIN
smart_service/mahindra_smart_service/report/_sub_systems_translation/__pycache__/_sub_systems_translation.cpython-38.pyc

Binary file not shown.

8
smart_service/mahindra_smart_service/report/_sub_systems_translation/_sub_systems_translation.py

@ -23,7 +23,7 @@ def get_data():
queryAppendLang = ""
for d in custom_lang:
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN '%s'.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
q = ", (CASE WHEN tabLang.languageCode = '%s' THEN %s.tabTranslation.translated_text ELSE null END) as %s" %(d[0],current_db_name,d[0])
queryAppendLang += q
sel = ""
@ -33,9 +33,9 @@ def get_data():
actualQuery = """Select
`tabSub Systems`.modified as "Modified On",
`tabSub Systems`.active_status as "Status",
`tabSub Systems`.sub_system_name as 'Vehicle Segment'
{0}.`tabSub Systems`.modified as "Modified On",
{0}.`tabSub Systems`.active_status as "Status",
{0}.`tabSub Systems`.sub_system_name as 'Vehicle Segment'
{1}
From {0}.`tabSub Systems`
LEFT JOIN {0}.`tabTranslation` as tabTrans

BIN
smart_service/mahindra_smart_service/report/_systems_translation/__pycache__/_systems_translation.cpython-38.pyc

Binary file not shown.

4
smart_service/mahindra_smart_service/report/_systems_translation/_systems_translation.py

@ -17,7 +17,7 @@ def execute(filters=None):
def get_data():
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name""",as_list=True)
custom_lang = frappe.db.sql("""SELECT lang_code FROM %s.`tabCustom Languages` where lang_code <> "en" order by lang_name"""%(current_db_name),as_list=True)
queryAppendLang = ""
@ -50,7 +50,7 @@ def get_data():
, tanLang.language_code as languageCode
FROM %s.tabLanguage as tanLang) as tabLang
ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation
ON %s.`tabSystems`.system_name = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,)
ON %s.`tabSystems`.system_name = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
data = frappe.db.sql(actualQuery,as_list=True)

BIN
smart_service/mahindra_smart_service/report/_transmission_translation/__pycache__/_transmission_translation.cpython-38.pyc

Binary file not shown.

BIN
smart_service/mahindra_smart_service/report/_variant_translation/__pycache__/_variant_translation.cpython-38.pyc

Binary file not shown.

BIN
smart_service/mahindra_smart_service/report/_vehicle_segment_translation/__pycache__/_vehicle_segment_translation.cpython-38.pyc

Binary file not shown.

2
smart_service/mahindra_smart_service/report/_vehicle_segment_translation/_vehicle_segment_translation.py

@ -50,7 +50,7 @@ def get_data():
, tanLang.language_code as languageCode
FROM %s.tabLanguage as tanLang) as tabLang
ON %s.tabTranslation.language = tabLang.languageCode) as tabTranslation
ON %s.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
ON %s.`tabVehicle Segment`.vehicle_segment = tabTranslation.sourceText;""" % (sel,current_db_name,current_db_name,current_db_name,current_db_name,current_db_name ,queryAppendLang,current_db_name,current_db_name,current_db_name,current_db_name)
data = frappe.db.sql(actualQuery,as_list=True)

BIN
smart_service/mahindra_smart_service/report/_vehicle_translation/__pycache__/_vehicle_translation.cpython-38.pyc

Binary file not shown.

2
smart_service/masters/doctype/vehi_master/vehi_master.json

@ -39,7 +39,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-01-18 10:24:48.167310",
"modified": "2022-01-19 13:15:26.726841",
"modified_by": "Administrator",
"module": "Masters",
"name": "Vehi_master",

4
smart_service/templates/includes/login/_login.js

@ -52,6 +52,7 @@ login.bind_events = function () {
$('.login-captcha-refresh').css('z-index', '2');
$('.toggle-password').css('z-index', '2');
captchaNumGen();
$("#login_captcha").val('');
login.set_status('{{ _("Invalid Captcha. Try Again.") }}', 'red');
return false;
}
@ -116,6 +117,7 @@ isSubmit=1;
if (!args.email || !validate_email(args.email) || !args.full_name) {
login.set_status('{{ _("Valid email and name required") }}', 'red');
captchaNumGen();
$("#login_captcha").val('');
return false;
}
login.call(args);
@ -130,6 +132,7 @@ isSubmit=1;
if (!args.user) {
login.set_status('{{ _("Valid Login id required.") }}', 'red');
captchaNumGen();
$("#login_captcha").val('');
return false;
}
login.call(args);
@ -336,6 +339,7 @@ login.login_handlers = (function () {
401: function (data) {
login.set_status('{{ _("Invalid Login. Try again.") }}', 'red');
captchaNumGen();
$("#login_captcha").val('');
},
417: get_error_handler('{{ _("Oops! Something went wrong") }}')
};

Loading…
Cancel
Save