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
c4e18dcf
Commit
c4e18dcf
authored
Jun 01, 2022
by
hemanthkumar.pasham
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding project to tz function
parent
12236604
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
7 deletions
+22
-7
scripts/constants/__init__.py
scripts/constants/__init__.py
+4
-2
scripts/constants/db_connections.py
scripts/constants/db_connections.py
+3
-1
scripts/core/handlers/oee_handlers.py
scripts/core/handlers/oee_handlers.py
+11
-0
scripts/services/oee_services.py
scripts/services/oee_services.py
+4
-4
No files found.
scripts/constants/__init__.py
View file @
c4e18dcf
...
...
@@ -21,8 +21,10 @@ class Endpoints:
# OEE SERVICES
oee_services
=
"/oee"
oee_services
=
"/oee_post"
oee_services_mapping
=
"/oee_mapping"
oee_services_getting
=
"/oee_getting"
delete_oee_service
=
"/oee_service_update"
update_oee_services
=
"/oee_services_delete"
# tag_lists
api_tags_lists
=
"/tag_lists"
api_tags
=
"/tags"
...
...
scripts/constants/db_connections.py
View file @
c4e18dcf
from
scripts.config
import
DBConf
from
scripts.utils.mongo_util
import
MongoConnect
from
scripts.utils.mongo_util
import
MongoConnect
,
MongoCollectionBaseClass
mongo_client
=
MongoConnect
(
uri
=
DBConf
.
MONGO_URI
)()
mongo_connection
=
MongoCollectionBaseClass
(
mongo_client
=
mongo_client
,
database
=
"ilens_configuration"
,
collection
=
"customer_projects"
)
scripts/core/handlers/oee_handlers.py
View file @
c4e18dcf
...
...
@@ -4,12 +4,14 @@ from scripts.constants.db_connections import mongo_client
from
scripts.db.mongo.ilens_configuration.collections
import
collection_constants
from
scripts.logging
import
logger
from
scripts.schemas.oee_config_schema
import
Oee_Tag_Mapping_List
,
Get_Oee_Tag
,
Update_Oee_Tags
,
Get_Project_Id
from
scripts.constants.db_connections
import
mongo_connection
class
Oee_Services
:
def
__init__
(
self
,
project_id
=
Get_Project_Id
.
project_id
):
try
:
self
.
connect
=
collection_constants
(
mongo_client
=
mongo_client
)
self
.
mongo_connect
=
mongo_connection
except
Exception
as
e
:
tb
=
traceback
.
format_exc
()
logger
.
exception
(
e
)
...
...
@@ -81,3 +83,12 @@ class Oee_Services:
logger
.
exception
(
tb
)
logger
.
exception
(
f
"Exception occurred while fetching data as {e}"
)
raise
def
get_project_tz
(
self
):
connection
=
self
.
mongo_connect
project_tz
=
connection
.
find
()
return_json
=
{}
for
each_project
in
project_tz
:
for
each_tz
in
each_project
:
return_json
.
update
({
str
(
each_tz
.
get
(
"customer_project_name"
)):
str
(
each_tz
.
get
(
"timezone"
))})
return
return_json
scripts/services/oee_services.py
View file @
c4e18dcf
...
...
@@ -7,7 +7,7 @@ from scripts.core.handlers import oee_handlers
oee_services
=
APIRouter
(
prefix
=
Endpoints
.
oee_services
,
tags
=
[
"OEE Calculator"
])
@
oee_services
.
post
(
Endpoints
.
oee_services
)
@
oee_services
.
post
(
Endpoints
.
oee_services
_mapping
)
async
def
oee_tag_mapping
(
oee_tag_mapping_list
:
GetOeeServices
):
try
:
tag_mapping
=
oee_tag_mapping_list
.
dict
()
...
...
@@ -18,7 +18,7 @@ async def oee_tag_mapping(oee_tag_mapping_list: GetOeeServices):
raise
logger
.
exception
(
"Exception occurred while inserting data"
)
@
oee_services
.
post
(
Endpoints
.
oee_services
)
@
oee_services
.
post
(
Endpoints
.
oee_services
_getting
)
async
def
get_oee_tag_mapping
(
get_oee_tags
:
GetOeeServices
):
try
:
get_oee_tags
=
get_oee_tags
.
dict
()
...
...
@@ -29,7 +29,7 @@ async def get_oee_tag_mapping(get_oee_tags: GetOeeServices):
raise
logger
.
exception
(
f
"Error while getting information as {e}"
)
@
oee_services
.
post
(
Endpoints
.
oee_services
)
@
oee_services
.
post
(
Endpoints
.
delete_oee_service
)
async
def
delete_oee_tagging
(
delete_oee_tags
:
GetOeeServices
):
try
:
delete_oee_tags
=
delete_oee_tags
.
dict
()
...
...
@@ -40,7 +40,7 @@ async def delete_oee_tagging(delete_oee_tags: GetOeeServices):
raise
logger
.
exception
(
f
"Error while getting information as {e}"
)
@
oee_services
.
post
(
Endpoints
.
oee_services
)
@
oee_services
.
post
(
Endpoints
.
update_
oee_services
)
async
def
update_oee_tagging
(
update_oee_tags
:
GetOeeServices
):
try
:
update_oee_tags
=
update_oee_tags
.
dict
()
...
...
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