feat(project):add CLN_PROJECT_PRICE_REPORT
This commit is contained in:
@@ -18,5 +18,6 @@ class TaskEnv:
|
||||
CLN_DELIVERY = 'delivery'
|
||||
CLN_PROJECT_STS = 'project_sts'
|
||||
CLN_PROJECT = 'project'
|
||||
CLN_PROJECT_PRICE_REPORT = 'price_report'
|
||||
|
||||
|
||||
|
||||
@@ -134,7 +134,12 @@ class ProjectSts(BaseModel):
|
||||
sts: Optional[int] = Field(description='وضعیت مورد نظر در این فیلد قرار می گیرد')
|
||||
description:Optional[str] = Field(description='توضیحات وضعیت در این فیلد قرار می گیرد')
|
||||
|
||||
|
||||
class ProjectPriceReport(BaseModel):
|
||||
id: Optional[uuid.UUID] = Field(alias='_id')
|
||||
project_id: Optional[uuid.UUID] = Field(description="کد شناسایی پروژه در این فیلد قرار می گیرد")
|
||||
amount_status: Optional[int] = Field(description='مبلغ صورت وضعیت')
|
||||
amount_adjust: Optional[int] = Field(description='مبلغ تعدیل')
|
||||
first_amount: Optional[int] = Field(description=' مبلغ اولیه پیمان')
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,12 +35,20 @@ class ProjectRepository(BaseRepository[ProjectModel]):
|
||||
coding.counter = last_project[0]["counter"]+1
|
||||
code = self.create_code(coding)
|
||||
coding.design.code = 'D'+code
|
||||
coding.init_id().cu_at()
|
||||
if coding.monitor:
|
||||
coding.monitor.code = 'S'+code
|
||||
coding.has_monitor = True
|
||||
if coding.monitor.detail and coding.monitor.detail.first_amount :
|
||||
price = {
|
||||
'_id': uuid.uuid4(),
|
||||
'project_id': coding.id,
|
||||
'first_amount': coding.monitor.detail.first_amount
|
||||
}
|
||||
await use_collection(TaskEnv.CLN_PROJECT_PRICE_REPORT).insert_one(price)
|
||||
else:
|
||||
coding.has_monitor = False
|
||||
coding.init_id().cu_at()
|
||||
|
||||
await use_collection(COLLECTION).insert_one(coding.mongo_dict())
|
||||
return await self.get(coding.id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user