Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
oee-services
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
harshavardhan.c
oee-services
Commits
7f43abce
Commit
7f43abce
authored
May 24, 2022
by
hrishikesh.r
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified changes to Oee_handlers.py
parent
45f6bbe8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
15 deletions
+33
-15
scripts/core/handlers/oee_handlers.py
scripts/core/handlers/oee_handlers.py
+28
-11
scripts/services/oee_services.py
scripts/services/oee_services.py
+5
-4
No files found.
scripts/core/handlers/oee_handlers.py
View file @
7f43abce
import
traceback
from
scripts.logging
import
logger
from
scripts.logging
import
logger
from
scripts.utils.mongo_util
import
MongoCollectionBaseClass
from
scripts.utils.mongo_util
import
MongoCollectionBaseClass
from
scripts.schemas.oee_config_schema
import
Oee_Tag_Mapping_List
,
Get_Oee_Tag
,
Update_Oee_Tags
,
Get_Project_Id
from
scripts.schemas.oee_config_schema
import
Oee_Tag_Mapping_List
,
Get_Oee_Tag
,
Update_Oee_Tags
,
Get_Project_Id
...
@@ -7,7 +9,6 @@ from scripts.db.mongo.ilens_configuration.collections import collection_constant
...
@@ -7,7 +9,6 @@ from scripts.db.mongo.ilens_configuration.collections import collection_constant
from
scripts.utils.mongo_util
import
MongoCollectionBaseClass
from
scripts.utils.mongo_util
import
MongoCollectionBaseClass
from
scripts.schemas
import
mongo_schema
from
scripts.schemas
import
mongo_schema
from
scripts.constants.db_connections
import
mongo_client
from
scripts.constants.db_connections
import
mongo_client
...
@@ -16,7 +17,11 @@ class Oee_Services:
...
@@ -16,7 +17,11 @@ class Oee_Services:
try
:
try
:
self
.
connect
=
collection_constants
(
mongo_client
=
mongo_client
)
self
.
connect
=
collection_constants
(
mongo_client
=
mongo_client
)
except
Exception
as
e
:
except
Exception
as
e
:
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
logger
.
exception
(
tb
)
logger
.
exception
(
"Error while connecting to mongodb"
)
logger
.
exception
(
"Error while connecting to mongodb"
)
raise
def
oee_tag_mapping
(
self
,
oee_tag_mapping_list
:
Oee_Tag_Mapping_List
):
def
oee_tag_mapping
(
self
,
oee_tag_mapping_list
:
Oee_Tag_Mapping_List
):
try
:
try
:
...
@@ -31,7 +36,11 @@ class Oee_Services:
...
@@ -31,7 +36,11 @@ class Oee_Services:
else
:
else
:
logger
.
info
(
"Unable to insert data in to Mongodb"
)
logger
.
info
(
"Unable to insert data in to Mongodb"
)
except
Exception
as
e
:
except
Exception
as
e
:
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
logger
.
exception
(
tb
)
logger
.
exception
(
"Error occurred while inserting data"
)
logger
.
exception
(
"Error occurred while inserting data"
)
raise
def
get_oee_tag_mapping
(
self
,
get_oee_tag
:
Get_Oee_Tag
):
def
get_oee_tag_mapping
(
self
,
get_oee_tag
:
Get_Oee_Tag
):
try
:
try
:
...
@@ -41,26 +50,30 @@ class Oee_Services:
...
@@ -41,26 +50,30 @@ class Oee_Services:
no_of_documents
=
self
.
connect
.
count_documents
(
query
=
query
)
no_of_documents
=
self
.
connect
.
count_documents
(
query
=
query
)
result
=
self
.
connect
.
find
(
query
=
query
)
.
skip
(
skips
)
.
limit
(
get_oee_tag
.
page_num
)
result
=
self
.
connect
.
find
(
query
=
query
)
.
skip
(
skips
)
.
limit
(
get_oee_tag
.
page_num
)
if
result
:
if
result
:
if
skips
<
no_of_documents
:
#
if skips < no_of_documents:
return_json
[
"endOfrecords"
]
=
False
#
return_json["endOfrecords"] = False
else
:
#
else:
return_json
[
"endOfrecords"
]
=
True
#
return_json["endOfrecords"] = True
return
result
return
result
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
f
"Exception occured while fetching data as {e}"
)
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
logger
.
exception
(
tb
)
logger
.
exception
(
f
"Exception occurred while fetching data as {e}"
)
raise
def
delete_oee_tags
(
self
,
project_id
:
Get_Project_Id
):
def
delete_oee_tags
(
self
,
project_id
:
Get_Project_Id
):
try
:
try
:
return_json
=
{
"message"
:
"failure"
,
"status"
:
"failure"
,
"data"
:
"data not found"
}
query
=
{
"project_id"
:
project_id
.
project_id
}
query
=
{
"project_id"
:
project_id
.
project_id
}
result
=
self
.
connect
.
delete_one
(
query
=
query
)
result
=
self
.
connect
.
delete_one
(
query
=
query
)
if
result
:
if
result
:
return_json
[
"message"
]
=
"success"
return_json
[
"status"
]
=
"success"
return_json
[
"data"
]
=
result
return
result
return
result
except
Exception
as
e
:
except
Exception
as
e
:
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
logger
.
exception
(
tb
)
logger
.
exception
(
f
"Exception occurred while fetching data as {e}"
)
logger
.
exception
(
f
"Exception occurred while fetching data as {e}"
)
raise
def
update_oee_tags
(
self
,
update_oee_tags
:
Update_Oee_Tags
):
def
update_oee_tags
(
self
,
update_oee_tags
:
Update_Oee_Tags
):
try
:
try
:
...
@@ -69,4 +82,8 @@ class Oee_Services:
...
@@ -69,4 +82,8 @@ class Oee_Services:
if
result
:
if
result
:
return
result
return
result
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
f
"Exception occured while fetching data as {e}"
)
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
logger
.
exception
(
tb
)
logger
.
exception
(
f
"Exception occurred while fetching data as {e}"
)
raise
scripts/services/oee_services.py
View file @
7f43abce
...
@@ -15,7 +15,8 @@ async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices):
...
@@ -15,7 +15,8 @@ async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices):
return
result
return
result
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
"Exception occurred while inserting data"
)
raise
logger
.
exception
(
"Exception occurred while inserting data"
)
...
@@ -28,7 +29,7 @@ async def get_oee_tag_mapping(get_oee_tags: GetOeeServices):
...
@@ -28,7 +29,7 @@ async def get_oee_tag_mapping(get_oee_tags: GetOeeServices):
return
return_json
return
return_json
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
f
"Error while getting information as {e}"
)
raise
logger
.
exception
(
f
"Error while getting information as {e}"
)
...
@@ -40,7 +41,7 @@ async def delete_oee_tagging(delete_oee_tags: GetOeeServices):
...
@@ -40,7 +41,7 @@ async def delete_oee_tagging(delete_oee_tags: GetOeeServices):
return
return_json
return
return_json
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
f
"Error while getting information as {e}"
)
raise
logger
.
exception
(
f
"Error while getting information as {e}"
)
...
@@ -53,6 +54,6 @@ async def update_oee_tagging(update_oee_tags: GetOeeServices):
...
@@ -53,6 +54,6 @@ async def update_oee_tagging(update_oee_tags: GetOeeServices):
return
return_json
return
return_json
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
f
"Error while getting information as {e}"
)
raise
logger
.
exception
(
f
"Error while getting information as {e}"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment