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
baccf752
Commit
baccf752
authored
May 25, 2022
by
harshavardhan.c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag_hierarchy.py db file addition.
parent
f8692e94
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
320 additions
and
10 deletions
+320
-10
main.py
main.py
+3
-0
scripts/constants/__init__.py
scripts/constants/__init__.py
+28
-1
scripts/core/handlers/batch_oee_calc_handler.py
scripts/core/handlers/batch_oee_calc_handler.py
+10
-4
scripts/db/db_models/__init__.py
scripts/db/db_models/__init__.py
+1
-0
scripts/db/mongo/ilens_configuration/collections/lookup_table.py
.../db/mongo/ilens_configuration/collections/lookup_table.py
+1
-1
scripts/db/mongo/ilens_configuration/collections/tag_hierarchy.py
...db/mongo/ilens_configuration/collections/tag_hierarchy.py
+259
-0
scripts/schemas/batch_oee.py
scripts/schemas/batch_oee.py
+2
-0
scripts/services/__init__.py
scripts/services/__init__.py
+8
-0
scripts/services/calculate_oee.py
scripts/services/calculate_oee.py
+5
-2
scripts/services/ui_services.py
scripts/services/ui_services.py
+3
-2
No files found.
main.py
View file @
baccf752
...
@@ -6,6 +6,7 @@ from fastapi import FastAPI, Depends
...
@@ -6,6 +6,7 @@ from fastapi import FastAPI, Depends
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.cors
import
CORSMiddleware
from
scripts.db.psql.create_default_tables
import
create_default_psql_dependencies
from
scripts.db.psql.create_default_tables
import
create_default_psql_dependencies
from
scripts.services
import
route
from
scripts.utils.security_utils.decorators
import
CookieAuthentication
from
scripts.utils.security_utils.decorators
import
CookieAuthentication
auth
=
CookieAuthentication
()
auth
=
CookieAuthentication
()
...
@@ -41,6 +42,8 @@ if os.environ.get("ENABLE_CORS") in (True, "true", "True") and os.environ.get(
...
@@ -41,6 +42,8 @@ if os.environ.get("ENABLE_CORS") in (True, "true", "True") and os.environ.get(
)
)
print
(
os
.
environ
.
get
(
"CORS_URLS"
)
.
split
(
","
))
print
(
os
.
environ
.
get
(
"CORS_URLS"
)
.
split
(
","
))
app
.
include_router
(
route
)
@
app
.
on_event
(
"startup"
)
@
app
.
on_event
(
"startup"
)
async
def
startup_event
():
async
def
startup_event
():
...
...
scripts/constants/__init__.py
View file @
baccf752
...
@@ -60,7 +60,8 @@ class DBConstants:
...
@@ -60,7 +60,8 @@ class DBConstants:
db_ilens_assistant
=
"ilens_assistant"
db_ilens_assistant
=
"ilens_assistant"
collection_constants
=
"constants"
collection_constants
=
"constants"
lookup_table
=
"lookup_table"
collection_lookup_table
=
"lookup_table"
collection_tag_hierarchy
=
"tag_hierarchy"
class
CommonConstants
:
class
CommonConstants
:
...
@@ -95,3 +96,29 @@ class CommonStatusCode:
...
@@ -95,3 +96,29 @@ class CommonStatusCode:
201
,
201
,
204
,
204
,
)
)
class
TagHierarchyKeys
:
KEY_ID
=
"id"
KEY_SITE_ID
=
"site_id"
KEY_SITE_NAME
=
"site_name"
KEY_DEPT_ID
=
"dept_id"
KEY_DEPT_NAME
=
"dept_name"
KEY_LINE_ID
=
"line_id"
KEY_LINE_NAME
=
"line_name"
KEY_EQUIPMENT_ID
=
"equipment_id"
KEY_EQUIPMENT_NAME
=
"equipment_name"
KEY_PARAMETER_ID
=
"parameter_id"
KEY_PROJECT_ID
=
"project_id"
KEY_LOWER_LIMIT
=
"lower_limit"
KEY_UPPER_LIMIT
=
"upper_limit"
KEY_DETAILS_LEVEL
=
"kpi_details"
KEY_KPI_LEVEL
=
"kpi_level_list"
KEY_KPI_PARENT
=
"kpi_parent_list"
KEY_TAG_CATEGORY_ID
=
"tag_category_id"
KEY_TAG_CODE
=
"tag_code"
KEY_TAG_REGISTER
=
"tag_register"
KEY_STARRED
=
"starred"
KEY_ASSET_MODEL_ID
=
"asset_model_id"
KEY_ASSET_VERSION
=
"asset_version"
KEY_additional_fields
=
"additional_fields"
scripts/core/handlers/batch_oee_calc_handler.py
View file @
baccf752
...
@@ -4,19 +4,23 @@ from datetime import datetime
...
@@ -4,19 +4,23 @@ from datetime import datetime
import
pytz
import
pytz
from
sqlalchemy.orm
import
Session
from
sqlalchemy.orm
import
Session
from
scripts.constants
import
ResponseCodes
,
CommonConstants
from
scripts.constants
import
ResponseCodes
from
scripts.core.engine.oee_calculator
import
OEEEngine
from
scripts.core.engine.oee_calculator
import
OEEEngine
from
scripts.db.psql.oee_discrete
import
DiscreteOEE
from
scripts.db.psql.oee_discrete
import
DiscreteOEE
from
scripts.db.redis_connections
import
oee_production_db
from
scripts.db.redis_connections
import
oee_production_db
from
scripts.logging
import
logger
from
scripts.logging
import
logger
from
scripts.schemas.batch_oee
import
OEEDataInsertRequest
,
BatchOEEData
,
OEEDataSaveRequest
from
scripts.schemas.batch_oee
import
OEEDataInsertRequest
,
BatchOEEData
,
OEEDataSaveRequest
from
scripts.schemas.response_models
import
DefaultResponse
from
scripts.schemas.response_models
import
DefaultResponse
from
scripts.utils.common_utils
import
CommonUtils
oee_engine
=
OEEEngine
()
oee_engine
=
OEEEngine
()
class
CalculateBatchOEEHandler
:
class
CalculateBatchOEEHandler
:
def
__init__
(
self
,
project_id
=
None
):
self
.
common_util
=
CommonUtils
()
def
calculate_oee
(
self
,
db
,
request_data
:
OEEDataInsertRequest
):
def
calculate_oee
(
self
,
db
,
request_data
:
OEEDataInsertRequest
):
table_obj
=
DiscreteOEE
(
db
=
db
)
table_obj
=
DiscreteOEE
(
db
=
db
)
try
:
try
:
...
@@ -30,10 +34,12 @@ class CalculateBatchOEEHandler:
...
@@ -30,10 +34,12 @@ class CalculateBatchOEEHandler:
request_data
.
prod_start_time
=
datetime
.
now
()
.
astimezone
(
request_data
.
prod_start_time
=
datetime
.
now
()
.
astimezone
(
tz
=
pytz
.
timezone
(
request_data
.
tz
))
.
isoformat
()
tz
=
pytz
.
timezone
(
request_data
.
tz
))
.
isoformat
()
request_data
=
OEEDataSaveRequest
(
**
request_data
.
dict
(
exclude_none
=
True
))
request_data
=
OEEDataSaveRequest
(
**
request_data
.
dict
(
exclude_none
=
True
))
request_data
.
downtime
=
self
.
common_util
.
get_downtime_details_by_hierarchy
(
hierarchy
=
request_data
.
hierarchy
,
project_id
=
request_data
.
project_id
)
oee_calculation
=
oee_engine
.
start_batch_oee_calc
(
request_data
=
request_data
)
oee_calculation
=
oee_engine
.
start_batch_oee_calc
(
request_data
=
request_data
)
self
.
save_oee_data
(
oee_calculation
,
db
)
self
.
save_oee_data
(
oee_calculation
,
db
)
oee_production_db
.
set
(
name
=
redis_key
,
value
=
json
.
dumps
(
oee_production_db
.
set
(
name
=
redis_key
,
{
"created_on"
:
datetime
.
now
()
.
strftime
(
CommonConstants
.
__ui_datetime_format__
)}
))
value
=
json
.
dumps
(
BatchOEEData
(
**
request_data
.
dict
(
exclude_none
=
True
))
))
response
=
DefaultResponse
(
response
=
DefaultResponse
(
status
=
ResponseCodes
.
SUCCESS
,
status
=
ResponseCodes
.
SUCCESS
,
data
=
oee_calculation
,
data
=
oee_calculation
,
...
@@ -47,7 +53,7 @@ class CalculateBatchOEEHandler:
...
@@ -47,7 +53,7 @@ class CalculateBatchOEEHandler:
oee_production_db
.
delete
(
redis_key
)
oee_production_db
.
delete
(
redis_key
)
else
:
else
:
oee_production_db
.
set
(
name
=
redis_key
,
oee_production_db
.
set
(
name
=
redis_key
,
value
=
json
.
dumps
(
BatchOEEData
(
**
request_data
.
dict
(
exclude_none
=
True
))
))
value
=
json
.
dumps
(
record_presence
))
response
=
DefaultResponse
(
response
=
DefaultResponse
(
status
=
ResponseCodes
.
SUCCESS
,
status
=
ResponseCodes
.
SUCCESS
,
data
=
status
,
data
=
status
,
...
...
scripts/db/db_models/__init__.py
View file @
baccf752
...
@@ -28,5 +28,6 @@ class OEEDiscreteTable(Base):
...
@@ -28,5 +28,6 @@ class OEEDiscreteTable(Base):
calculated_on
=
Column
(
TIMESTAMP
(
timezone
=
True
),
nullable
=
False
)
calculated_on
=
Column
(
TIMESTAMP
(
timezone
=
True
),
nullable
=
False
)
uom
=
Column
(
String
,
default
=
"mins"
)
uom
=
Column
(
String
,
default
=
"mins"
)
setup_time
=
Column
(
Float
,
default
=
0
)
setup_time
=
Column
(
Float
,
default
=
0
)
tz
=
Column
(
String
,
default
=
"Asia/Kolkata"
)
trigger_by
=
Column
(
String
,
nullable
=
False
)
trigger_by
=
Column
(
String
,
nullable
=
False
)
project_id
=
Column
(
String
,
nullable
=
False
)
project_id
=
Column
(
String
,
nullable
=
False
)
scripts/db/mongo/ilens_configuration/collections/lookup_table.py
View file @
baccf752
...
@@ -21,7 +21,7 @@ class LookupTableSchema(MongoBaseSchema):
...
@@ -21,7 +21,7 @@ class LookupTableSchema(MongoBaseSchema):
class
LookupTable
(
MongoCollectionBaseClass
):
class
LookupTable
(
MongoCollectionBaseClass
):
def
__init__
(
self
,
mongo_client
,
project_id
=
None
):
def
__init__
(
self
,
mongo_client
,
project_id
=
None
):
super
()
.
__init__
(
mongo_client
,
database
=
DBConstants
.
db_metadata
,
super
()
.
__init__
(
mongo_client
,
database
=
DBConstants
.
db_metadata
,
collection
=
DBConstants
.
lookup_table
)
collection
=
DBConstants
.
collection_
lookup_table
)
self
.
project_id
=
project_id
self
.
project_id
=
project_id
@
property
@
property
...
...
scripts/db/mongo/ilens_configuration/collections/tag_hierarchy.py
0 → 100644
View file @
baccf752
import
re
from
typing
import
Optional
,
Any
from
scripts.constants
import
TagHierarchyKeys
,
DBConstants
from
scripts.db.mongo.schema
import
MongoBaseSchema
from
scripts.utils.mongo_util
import
MongoCollectionBaseClass
class
TagHierarchySchema
(
MongoBaseSchema
):
"""
This is the Schema for the Mongo DB Collection.
All datastore and general responses will be following the schema.
"""
project_id
:
Optional
[
str
]
id
:
Optional
[
str
]
site_id
:
Optional
[
str
]
site_name
:
Optional
[
str
]
dept_id
:
Optional
[
str
]
dept_name
:
Optional
[
str
]
line_id
:
Optional
[
str
]
line_name
:
Optional
[
str
]
equipment_id
:
Optional
[
str
]
equipment_name
:
Optional
[
str
]
parameter_id
:
Optional
[
str
]
lower_limit
:
Optional
[
float
]
upper_limit
:
Optional
[
float
]
kpi_level_list
:
Optional
[
list
]
kpi_parent_list
:
Optional
[
list
]
kpi_details
:
Optional
[
Any
]
tag_category_id
:
Optional
[
list
]
tag_code
:
Optional
[
str
]
tag_register
:
Optional
[
str
]
product_limits
:
Optional
[
dict
]
=
{}
enable_product
:
Optional
[
bool
]
=
False
starred
:
Optional
[
bool
]
=
False
additional_fields
:
Optional
[
dict
]
=
{}
additional_fields_mapping
:
Optional
[
list
]
=
[]
class
TagHierarchy
(
MongoCollectionBaseClass
):
def
__init__
(
self
,
mongo_client
,
project_id
=
None
):
super
()
.
__init__
(
mongo_client
,
database
=
DBConstants
.
db_metadata
,
collection
=
DBConstants
.
collection_tag_hierarchy
)
self
.
project_id
=
project_id
@
property
def
key_id
(
self
):
return
TagHierarchyKeys
.
KEY_ID
@
property
def
key_site_id
(
self
):
return
TagHierarchyKeys
.
KEY_SITE_ID
@
property
def
key_dept_id
(
self
):
return
TagHierarchyKeys
.
KEY_DEPT_ID
@
property
def
key_line_id
(
self
):
return
TagHierarchyKeys
.
KEY_LINE_ID
@
property
def
key_equipment_id
(
self
):
return
TagHierarchyKeys
.
KEY_EQUIPMENT_ID
@
property
def
key_parameter_id
(
self
):
return
TagHierarchyKeys
.
KEY_PARAMETER_ID
@
property
def
key_dept_name
(
self
):
return
TagHierarchyKeys
.
KEY_DEPT_NAME
@
property
def
key_site_name
(
self
):
return
TagHierarchyKeys
.
KEY_SITE_NAME
@
property
def
key_line_name
(
self
):
return
TagHierarchyKeys
.
KEY_LINE_NAME
@
property
def
key_equipment_name
(
self
):
return
TagHierarchyKeys
.
KEY_EQUIPMENT_NAME
@
property
def
key_project_id
(
self
):
return
TagHierarchyKeys
.
KEY_PROJECT_ID
@
property
def
key_tag_code
(
self
):
return
TagHierarchyKeys
.
KEY_TAG_CODE
@
property
def
key_tag_register
(
self
):
return
TagHierarchyKeys
.
KEY_TAG_REGISTER
@
property
def
key_tag_category_id
(
self
):
return
TagHierarchyKeys
.
KEY_TAG_CATEGORY_ID
@
property
def
key_starred
(
self
):
return
TagHierarchyKeys
.
KEY_STARRED
@
property
def
key_asset_model_id
(
self
):
return
TagHierarchyKeys
.
KEY_ASSET_MODEL_ID
@
property
def
key_asset_version
(
self
):
return
TagHierarchyKeys
.
KEY_ASSET_VERSION
def
find_all_tag_hierarchy
(
self
,
filter_dict
=
None
,
sort
=
None
,
skip
=
0
,
limit
=
None
,
**
query
):
"""
The following function will give all tag_hierarchy for the given set of
search parameters as keyword arguments
:param filter_dict:
:param sort:
:param skip:
:param limit:
:param query:
:return:
"""
if
query
is
None
:
query
=
{}
all_tag_hierarchy
=
self
.
find
(
filter_dict
=
filter_dict
,
sort
=
sort
,
skip
=
skip
,
limit
=
limit
,
query
=
query
)
if
not
all_tag_hierarchy
:
return
list
()
return
list
(
all_tag_hierarchy
)
def
find_by_query
(
self
,
query
,
filter_dict
=
None
):
return
list
(
self
.
find
(
query
=
query
,
filter_dict
=
filter_dict
))
def
find_one_tag_hierarchy
(
self
,
filter_dict
=
None
,
**
query
)
->
TagHierarchySchema
:
"""
The following function will give one tag_hierarchy for a given set of
search parameters as keyword arguments
:param filter_dict:
:param query:
:return:
"""
tag_hierarchy
=
self
.
find_one
(
filter_dict
=
filter_dict
,
query
=
query
)
if
tag_hierarchy
:
return
TagHierarchySchema
(
**
tag_hierarchy
)
else
:
return
tag_hierarchy
def
insert_one_tag_hierarchy
(
self
,
data
):
"""
The following function will insert one tag_hierarchy in the
tag_hierarchy collections
:param data:
:return:
"""
return
self
.
insert_one
(
data
)
def
insert_many_tag_hierarchy
(
self
,
data
):
"""
The following function will insert many tag_hierarchy in the
tag_hierarchy collection
:param data:
:return:
"""
return
self
.
insert_many
(
data
)
def
update_one_tag_hierarchy
(
self
,
data
,
upsert
=
False
,
**
query
):
"""
The following function will update one tag_hierarchy in
tag_hierarchy collection based on the given query
:param data:
:param upsert:
:param query:
:return:
"""
return
self
.
update_one
(
data
=
data
,
upsert
=
upsert
,
query
=
query
)
def
update_many_tag_hierarchy
(
self
,
data
,
query
,
upsert
=
False
):
"""
The following function will update many tag_hierarchy in
tag_hierarchy collection based on the given query
:param data:
:param upsert:
:param query:
:return:
"""
return
self
.
update_many
(
data
=
data
,
upsert
=
upsert
,
query
=
query
)
def
delete_many_tag_hierarchy
(
self
,
query
):
"""
The following function will delete many tag_hierarchy in
tag_hierarchy collection based on the given query
:param query:
:return:
"""
return
self
.
delete_many
(
query
=
query
)
def
delete_one_tag_hierarchy
(
self
,
**
query
):
"""
The following function will delete one tag_hierarchy in
tag_hierarchy collection based on the given query
:param query:
:return:
"""
return
self
.
delete_one
(
query
=
query
)
def
distinct_tag_hierarchy
(
self
,
query_key
):
"""
Get a list of distinct values for `key` among all documents
in the result set of this query.
:param query_key:
:return:
"""
return
self
.
distinct
(
query_key
=
query_key
)
def
find_tag_hierarchy_by_ids
(
self
,
tag_hierarchy_category_id
,
tag_hierarchy_list
):
query
=
{
"$or"
:
[{
self
.
key_id
:
tag_hierarchy_category_id
},
{
self
.
key_id
:
{
"$in"
:
tag_hierarchy_list
}}]}
tag_hierarchy
=
self
.
find
(
query
=
query
)
if
not
tag_hierarchy
:
return
list
()
return
list
(
tag_hierarchy
)
def
find_tag_code
(
self
,
project_id
,
tag_code
,
site_id
):
query
=
{
"$and"
:
[{
self
.
key_project_id
:
project_id
},
{
self
.
key_tag_code
:
tag_code
},
{
"site_id"
:
site_id
}]}
tag_record
=
self
.
find_one
(
query
=
query
)
if
not
tag_record
:
return
dict
()
return
dict
(
tag_record
)
def
find_tag_hierarchy_by_aggregate
(
self
,
query
):
tag_hierarchy
=
self
.
aggregate
(
query
)
if
not
tag_hierarchy
:
return
list
()
return
list
(
tag_hierarchy
)
def
get_tag_hierarchy_by_aggregate
(
self
,
query
:
list
):
return
list
(
self
.
aggregate
(
pipelines
=
query
))
def
find_by_aggregate
(
self
,
query
):
tag_hierarchy
=
self
.
aggregate
(
query
)
if
not
tag_hierarchy
:
return
list
()
return
list
(
tag_hierarchy
)
def
find_tag_hierarchy_by_id
(
self
,
project_id
,
tag_id
):
query
=
{
"$and"
:
[{
self
.
key_project_id
:
project_id
},
{
self
.
key_id
:
tag_id
}]}
tag_hierarchy_record
=
self
.
find_one
(
query
=
query
)
if
not
tag_hierarchy_record
:
return
dict
()
return
dict
(
tag_hierarchy_record
)
def
get_parameter_ids
(
self
,
project_id
,
regex_string
):
query
=
{
self
.
key_project_id
:
project_id
,
'tag_code'
:
{
'$regex'
:
re
.
escape
(
regex_string
),
'$options'
:
'i'
}}
tag_list
=
self
.
distinct
(
'id'
,
query
)
if
not
tag_list
:
return
[]
return
tag_list
scripts/schemas/batch_oee.py
View file @
baccf752
...
@@ -2,6 +2,7 @@ from typing import Optional, Union, List
...
@@ -2,6 +2,7 @@ from typing import Optional, Union, List
from
pydantic
import
BaseModel
,
validator
from
pydantic
import
BaseModel
,
validator
# from scripts.utils.common_utils import CommonUtils
# from scripts.utils.common_utils import CommonUtils
#
#
# common_utils = CommonUtils()
# common_utils = CommonUtils()
...
@@ -107,6 +108,7 @@ class OEEDataInsertRequest(BaseModel):
...
@@ -107,6 +108,7 @@ class OEEDataInsertRequest(BaseModel):
reject_units
:
Optional
[
Union
[
float
,
int
]]
reject_units
:
Optional
[
Union
[
float
,
int
]]
tz
:
Optional
[
str
]
=
'Asia/Kolkata'
tz
:
Optional
[
str
]
=
'Asia/Kolkata'
project_id
:
str
project_id
:
str
trigger_by
:
Optional
[
str
]
uom
:
Optional
[
str
]
uom
:
Optional
[
str
]
class
Config
:
class
Config
:
...
...
scripts/services/__init__.py
View file @
baccf752
from
fastapi
import
APIRouter
from
scripts.services.calculate_oee
import
calc_oee_router
# from scripts.services.ui_services import ui_service_router
route
=
APIRouter
()
route
.
include_router
(
calc_oee_router
)
# route.include_router(ui_service_router)
scripts/services/calculate_oee.py
View file @
baccf752
...
@@ -12,17 +12,20 @@ from scripts.errors import ILensError
...
@@ -12,17 +12,20 @@ from scripts.errors import ILensError
from
scripts.logging
import
logger
from
scripts.logging
import
logger
from
scripts.schemas.batch_oee
import
OEEDataInsertRequest
from
scripts.schemas.batch_oee
import
OEEDataInsertRequest
from
scripts.schemas.response_models
import
DefaultFailureResponse
from
scripts.schemas.response_models
import
DefaultFailureResponse
from
scripts.utils.security_utils.cookie_decorator
import
MetaInfoCookie
,
MetaInfoSchema
batch_oee_handler
=
CalculateBatchOEEHandler
()
batch_oee_handler
=
CalculateBatchOEEHandler
()
get_cookies
=
MetaInfoCookie
()
calc_oee_router
=
APIRouter
(
prefix
=
Endpoints
.
calc_oee_base
,
tags
=
[
"OEE Calculator"
])
calc_oee_router
=
APIRouter
(
prefix
=
Endpoints
.
calc_oee_base
,
tags
=
[
"OEE Calculator"
])
@
calc_oee_router
.
post
(
Endpoints
.
calculate_batch_oee
)
@
calc_oee_router
.
post
(
Endpoints
.
calculate_batch_oee
)
def
calculate_oee_for_batch
(
def
calculate_oee_for_batch
(
product_info
:
OEEDataInsertRequest
,
db
:
Session
=
Depends
(
get_db
)
request_data
:
OEEDataInsertRequest
,
db
:
Session
=
Depends
(
get_db
),
meta
:
MetaInfoSchema
=
Depends
(
get_cookies
)
):
):
try
:
try
:
return
batch_oee_handler
.
calculate_oee
(
request_data
=
product_info
,
db
=
db
)
request_data
.
trigger_by
=
meta
.
user_id
return
batch_oee_handler
.
calculate_oee
(
request_data
=
request_data
,
db
=
db
)
except
ILensError
as
error_code
:
except
ILensError
as
error_code
:
return
DefaultFailureResponse
(
error
=
error_code
.
args
[
0
])
return
DefaultFailureResponse
(
error
=
error_code
.
args
[
0
])
except
ValidationError
as
e
:
except
ValidationError
as
e
:
...
...
scripts/services/ui_services.py
View file @
baccf752
...
@@ -6,8 +6,9 @@ from sqlalchemy.orm import Session
...
@@ -6,8 +6,9 @@ from sqlalchemy.orm import Session
from
scripts.constants
import
Endpoints
,
ResponseCodes
from
scripts.constants
import
Endpoints
,
ResponseCodes
from
scripts.core.handlers.api_handler
import
APIHandler
from
scripts.core.handlers.api_handler
import
APIHandler
from
scripts.core.handlers.layout_handler
import
LayoutHandler
from
scripts.core.handlers.layout_handler
import
LayoutHandler
from
scripts.db.databases
import
get_db
from
scripts.db.psql.databases
import
get_db
from
scripts.logging.logging
import
logger
from
scripts.logging
import
logger
from
scripts.schemas.batch_oee
import
GetProducts
,
ChartRequest
from
scripts.schemas.batch_oee
import
GetProducts
,
ChartRequest
from
scripts.schemas.layout
import
GetLayoutRequest
,
SaveLayoutRequest
from
scripts.schemas.layout
import
GetLayoutRequest
,
SaveLayoutRequest
from
scripts.schemas.response_models
import
DefaultFailureResponse
,
DefaultResponse
from
scripts.schemas.response_models
import
DefaultFailureResponse
,
DefaultResponse
...
...
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