|
@@ -119,7 +119,7 @@ async def update_dispatch(
|
|
|
db.add(new_detail)
|
|
|
detail_list.append(new_detail.id)
|
|
|
else:
|
|
|
- detail = detail_id_get_declaration_detail_info(db,info['id'])
|
|
|
+ detail = detail_id_get_dispatch_detail_info(db,info['id'])
|
|
|
if detail is None:
|
|
|
new_detail = ResourceProvisionDispatchDetail(
|
|
|
id=new_guid(),
|
|
@@ -149,7 +149,7 @@ async def update_dispatch(
|
|
|
detail.update_by = user_id
|
|
|
detail_list.append(info['id'])
|
|
|
query = db.query(ResourceProvisionDispatchDetail)
|
|
|
- query = query.filter_by(declaration_id=id, del_flag='0').filter(~ResourceProvisionDispatchDetail.id.in_(detail_list))
|
|
|
+ query = query.filter_by(dispatch_id=id, del_flag='0').filter(~ResourceProvisionDispatchDetail.id.in_(detail_list))
|
|
|
for i in query.all():
|
|
|
i.del_flag='2'
|
|
|
db.commit()
|
|
@@ -168,19 +168,19 @@ async def get_pattern_info(
|
|
|
info = dispatch_id_get_dispatch_info(db,id)
|
|
|
if not info:
|
|
|
return JSONResponse(status_code=404,content={"code":404,"msg":"dispatch not found"})
|
|
|
- dept_info = dept_id_get_dept_info(db,info.declaration_unit)
|
|
|
- user_info = user_id_get_user_info(db,info.declaration_person)
|
|
|
+ dept_info = dept_id_get_dept_info(db,info.dispatch_unit)
|
|
|
+ user_info = user_id_get_user_info(db,info.dispatch_person)
|
|
|
review_info = dispatch_id_get_dispatch_review_info(db,id)
|
|
|
if review_info is None:
|
|
|
dispatch_status = info.dispatch_status
|
|
|
else:
|
|
|
dispatch_status = review_info.review_result
|
|
|
data = {"id": info.id,
|
|
|
- "dispatch_date": info.declaration_date,
|
|
|
- "dispatch_purpose": info.declaration_amount,
|
|
|
- "dispatch_unit": info.declaration_unit,
|
|
|
+ "dispatch_date": info.dispatch_date,
|
|
|
+ "dispatch_purpose": info.dispatch_purpose,
|
|
|
+ "dispatch_unit": info.dispatch_unit,
|
|
|
"dispatch_unit_name": dept_info.dept_name,
|
|
|
- "dispatch_person": info.declaration_person,
|
|
|
+ "dispatch_person": info.dispatch_person,
|
|
|
"dispatch_person_name": user_info.nick_name,
|
|
|
"dispatch_status": dispatch_status,
|
|
|
"create_time": info.create_time}
|
|
@@ -210,7 +210,6 @@ async def get_pattern_info(
|
|
|
"material_code":detail_info.material_code,
|
|
|
"material_name":detail_info.material_name,
|
|
|
"material_quantity":detail_info.material_quantity,
|
|
|
- "material_unit_price":detail_info.material_unit_price,
|
|
|
"material_purpose":detail_info.material_purpose})
|
|
|
data['detail']=detail
|
|
|
return {"code": 200, "msg": "获取成功", "data": data}
|
|
@@ -220,7 +219,7 @@ async def get_pattern_info(
|
|
|
|
|
|
@router.get("/list")
|
|
|
async def get_pattern_list(
|
|
|
- # declaration_details: str = Query(None, description='名称'),
|
|
|
+ # dispatch_details: str = Query(None, description='名称'),
|
|
|
page: int = Query(1, gt=0, description='页码'),
|
|
|
pageSize: int = Query(None, gt=0, description='每页条目数量'),
|
|
|
db: Session = Depends(get_db)
|
|
@@ -233,14 +232,14 @@ async def get_pattern_list(
|
|
|
# 排序
|
|
|
if pageSize is None:
|
|
|
pageSize=total_items
|
|
|
- query = query.order_by(ResourceProvisionDispatch.declaration_date.desc())
|
|
|
+ query = query.order_by(ResourceProvisionDispatch.dispatch_date.desc())
|
|
|
# 执行分页查询
|
|
|
lists = query.offset((page - 1) * pageSize).limit(pageSize).all()
|
|
|
data = []
|
|
|
for info in lists:
|
|
|
dept_info = dept_id_get_dept_info(db, info.dispatch_unit)
|
|
|
- user_info = user_id_get_user_info(db, info.declaration_person)
|
|
|
- review_info = declaration_id_get_declaration_review_info(db, info.id)
|
|
|
+ user_info = user_id_get_user_info(db, info.dispatch_person)
|
|
|
+ review_info = dispatch_id_get_dispatch_review_info(db, info.id)
|
|
|
if review_info is None:
|
|
|
dispatch_status = info.dispatch_status
|
|
|
else:
|
|
@@ -250,7 +249,7 @@ async def get_pattern_list(
|
|
|
"dispatch_purpose": info.dispatch_purpose,
|
|
|
"dispatch_unit": info.dispatch_unit,
|
|
|
"dispatch_unit_name": dept_info.dept_name,
|
|
|
- "dispatch_person": info.declaration_person,
|
|
|
+ "dispatch_person": info.dispatch_person,
|
|
|
"dispatch_person_name": user_info.nick_name,
|
|
|
"dispatch_status": dispatch_status,
|
|
|
"create_time": info.create_time})
|
|
@@ -276,9 +275,9 @@ async def get_pattern_list(
|
|
|
# if not info:
|
|
|
# return JSONResponse(status_code=404, content={"code": 404, "msg": "type not found"})
|
|
|
# info.del_flag='2'
|
|
|
-# review_info = declaration_id_get_declaration_review_info(db, id)
|
|
|
+# review_info = dispatch_id_get_dispatch_review_info(db, id)
|
|
|
# review_info.del_flag ='2'
|
|
|
-# for detail_info in declaration_id_get_declaration_detail_list(db, id):
|
|
|
+# for detail_info in dispatch_id_get_dispatch_detail_list(db, id):
|
|
|
# detail_info.del_flag='2'
|
|
|
# db.commit()
|
|
|
# return {"code": 200, "msg": "删除成功"}
|
|
@@ -297,7 +296,7 @@ async def create_pattern(
|
|
|
new_review = ResourceProvisionDispatchReview(
|
|
|
id=new_guid(),
|
|
|
reviewer=user_id,
|
|
|
- declaration_id=body['dispatch_id'],
|
|
|
+ dispatch_id=body['dispatch_id'],
|
|
|
review_result=body['review_result'],
|
|
|
review_comments=body['review_comments'],
|
|
|
create_by = user_id
|
|
@@ -317,7 +316,7 @@ async def get_pattern_list(
|
|
|
db: Session = Depends(get_db)
|
|
|
):
|
|
|
try:
|
|
|
- review_list = [info.declaration_id for info in get_declaration_review_list(db)]
|
|
|
+ review_list = [info.dispatch_id for info in get_dispatch_review_list(db)]
|
|
|
query = db.query(ResourceProvisionDispatch)
|
|
|
query = query.filter_by(del_flag='0')
|
|
|
query = query.filter(~ResourceProvisionDispatch.id.in_(review_list))
|
|
@@ -325,18 +324,18 @@ async def get_pattern_list(
|
|
|
# 排序
|
|
|
if pageSize is None:
|
|
|
pageSize=total_items
|
|
|
- query = query.order_by(ResourceProvisionDispatch.declaration_date.desc())
|
|
|
+ query = query.order_by(ResourceProvisionDispatch.dispatch_date.desc())
|
|
|
# 执行分页查询
|
|
|
lists = query.offset((page - 1) * pageSize).limit(pageSize).all()
|
|
|
data = []
|
|
|
for info in lists:
|
|
|
dept_info = dept_id_get_dept_info(db, info.dispatch_unit)
|
|
|
user_info = user_id_get_user_info(db, info.dispatch_person)
|
|
|
- # review_info = declaration_id_get_declaration_review_info(db, info.id)
|
|
|
+ # review_info = dispatch_id_get_dispatch_review_info(db, info.id)
|
|
|
# if review_info is None:
|
|
|
- # declaration_details = info.declaration_details
|
|
|
+ # dispatch_details = info.dispatch_details
|
|
|
# else:
|
|
|
- # declaration_details = review_info.review_result
|
|
|
+ # dispatch_details = review_info.review_result
|
|
|
data = {"id": info.id,
|
|
|
"dispatch_date": info.dispatch_date,
|
|
|
"dispatch_purpose": info.dispatch_purpose,
|