|
@@ -10,6 +10,8 @@ from utils.hlm_http_request import forward_request
|
|
|
from sockets.socket_client import socket_manager
|
|
from sockets.socket_client import socket_manager
|
|
|
from mcu.DeviceControl import DeviceControl
|
|
from mcu.DeviceControl import DeviceControl
|
|
|
import time
|
|
import time
|
|
|
|
|
+from sqlalchemy import and_, asc, desc
|
|
|
|
|
+
|
|
|
# from service.base_deal import BaseDealImage
|
|
# from service.base_deal import BaseDealImage
|
|
|
from databases import DeviceConfig, SqlQuery, CRUD, select
|
|
from databases import DeviceConfig, SqlQuery, CRUD, select
|
|
|
|
|
|
|
@@ -212,7 +214,7 @@ def reset_config(params: ModelGetDeviceConfig):
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get("/get_photo_records", description="获取拍照记录")
|
|
@app.get("/get_photo_records", description="获取拍照记录")
|
|
|
-def get_photo_records(page: int=1,size:int=3):
|
|
|
|
|
|
|
+def get_photo_records(page: int=1,size:int=5):
|
|
|
|
|
|
|
|
session = SqlQuery()
|
|
session = SqlQuery()
|
|
|
photos = CRUD(PhotoRecord)
|
|
photos = CRUD(PhotoRecord)
|
|
@@ -220,13 +222,20 @@ def get_photo_records(page: int=1,size:int=3):
|
|
|
select(PhotoRecord)
|
|
select(PhotoRecord)
|
|
|
.offset((page - 1) * size)
|
|
.offset((page - 1) * size)
|
|
|
.limit(size)
|
|
.limit(size)
|
|
|
|
|
+ .order_by(desc("id"))
|
|
|
.group_by("goods_art_no")
|
|
.group_by("goods_art_no")
|
|
|
)
|
|
)
|
|
|
list = []
|
|
list = []
|
|
|
result = session.exec(statement).all()
|
|
result = session.exec(statement).all()
|
|
|
for item in result:
|
|
for item in result:
|
|
|
list_item = photos.read_all(session, conditions={"goods_art_no": item.goods_art_no})
|
|
list_item = photos.read_all(session, conditions={"goods_art_no": item.goods_art_no})
|
|
|
- list.append({"goods_art_no": item.goods_art_no, "items": list_item})
|
|
|
|
|
|
|
+ list.append(
|
|
|
|
|
+ {
|
|
|
|
|
+ "goods_art_no": item.goods_art_no,
|
|
|
|
|
+ "action_time": item.create_time,
|
|
|
|
|
+ "items": list_item,
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
return {
|
|
return {
|
|
|
"code": 0,
|
|
"code": 0,
|
|
|
"msg": "",
|
|
"msg": "",
|
|
@@ -234,6 +243,19 @@ def get_photo_records(page: int=1,size:int=3):
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+@app.get("/get_photo_record_detail", description="通过货号获取拍照记录详情")
|
|
|
|
|
+def get_photo_records(goods_art_no: str = None):
|
|
|
|
|
+ if goods_art_no == None: return {"code": 1, "msg": "参数错误", "data": None}
|
|
|
|
|
+ session = SqlQuery()
|
|
|
|
|
+ photos = CRUD(PhotoRecord)
|
|
|
|
|
+ items = photos.read_all(session, conditions={"goods_art_no": goods_art_no})
|
|
|
|
|
+ return {
|
|
|
|
|
+ "code": 0,
|
|
|
|
|
+ "msg": "",
|
|
|
|
|
+ "data": {"list": items},
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
@app.post("/delect_goods_arts", description="通过货号删除记录")
|
|
@app.post("/delect_goods_arts", description="通过货号删除记录")
|
|
|
def delect_goods_arts(params: PhotoRecordDelete):
|
|
def delect_goods_arts(params: PhotoRecordDelete):
|
|
|
|
|
|