added qrcode to shopfloor
parent
ecbebd4ea0
commit
6c3ca2314f
|
@ -1411,6 +1411,7 @@ Result
|
||||||
| contact | Object | Contact Object |
|
| contact | Object | Contact Object |
|
||||||
| cost_center | Object | Cost Center Object |
|
| cost_center | Object | Cost Center Object |
|
||||||
| description | string | Shopfloor description |
|
| description | string | Shopfloor description |
|
||||||
|
| qrcode | string | QRCode in String |
|
||||||
|
|
||||||
* GET All Shopfloors
|
* GET All Shopfloors
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -21,18 +21,6 @@ class ShopfloorCollection:
|
||||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||||
cursor = cnx.cursor(dictionary=True)
|
cursor = cnx.cursor(dictionary=True)
|
||||||
|
|
||||||
query = (" SELECT id, name, uuid "
|
|
||||||
" FROM tbl_shopfloors ")
|
|
||||||
cursor.execute(query)
|
|
||||||
rows_shopfloors = cursor.fetchall()
|
|
||||||
|
|
||||||
shopfloor_dict = dict()
|
|
||||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
|
||||||
for row in rows_shopfloors:
|
|
||||||
shopfloor_dict[row['id']] = {"id": row['id'],
|
|
||||||
"name": row['name'],
|
|
||||||
"uuid": row['uuid']}
|
|
||||||
|
|
||||||
query = (" SELECT id, name, uuid "
|
query = (" SELECT id, name, uuid "
|
||||||
" FROM tbl_contacts ")
|
" FROM tbl_contacts ")
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
|
@ -77,7 +65,8 @@ class ShopfloorCollection:
|
||||||
"is_input_counted": bool(row['is_input_counted']),
|
"is_input_counted": bool(row['is_input_counted']),
|
||||||
"contact": contact,
|
"contact": contact,
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
"description": row['description']}
|
"description": row['description'],
|
||||||
|
"qrcode": "shopfloor:" + row['uuid']}
|
||||||
result.append(meta_result)
|
result.append(meta_result)
|
||||||
|
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
@ -210,23 +199,11 @@ class ShopfloorItem:
|
||||||
def on_get(req, resp, id_):
|
def on_get(req, resp, id_):
|
||||||
if not id_.isdigit() or int(id_) <= 0:
|
if not id_.isdigit() or int(id_) <= 0:
|
||||||
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
|
||||||
description='API.INVALID_METER_ID')
|
description='API.INVALID_SHOPFLOOR_ID')
|
||||||
|
|
||||||
cnx = mysql.connector.connect(**config.myems_system_db)
|
cnx = mysql.connector.connect(**config.myems_system_db)
|
||||||
cursor = cnx.cursor(dictionary=True)
|
cursor = cnx.cursor(dictionary=True)
|
||||||
|
|
||||||
query = (" SELECT id, name, uuid "
|
|
||||||
" FROM tbl_shopfloors ")
|
|
||||||
cursor.execute(query)
|
|
||||||
rows_shopfloors = cursor.fetchall()
|
|
||||||
|
|
||||||
shopfloor_dict = dict()
|
|
||||||
if rows_shopfloors is not None and len(rows_shopfloors) > 0:
|
|
||||||
for row in rows_shopfloors:
|
|
||||||
shopfloor_dict[row['id']] = {"id": row['id'],
|
|
||||||
"name": row['name'],
|
|
||||||
"uuid": row['uuid']}
|
|
||||||
|
|
||||||
query = (" SELECT id, name, uuid "
|
query = (" SELECT id, name, uuid "
|
||||||
" FROM tbl_contacts ")
|
" FROM tbl_contacts ")
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
|
@ -273,7 +250,8 @@ class ShopfloorItem:
|
||||||
"is_input_counted": bool(row['is_input_counted']),
|
"is_input_counted": bool(row['is_input_counted']),
|
||||||
"contact": contact,
|
"contact": contact,
|
||||||
"cost_center": cost_center,
|
"cost_center": cost_center,
|
||||||
"description": row['description']}
|
"description": row['description'],
|
||||||
|
"qrcode": "shopfloor:" + row['uuid']}
|
||||||
|
|
||||||
resp.text = json.dumps(meta_result)
|
resp.text = json.dumps(meta_result)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue