|
@@ -1,6 +1,7 @@
|
|
|
from pydantic import BaseModel
|
|
|
from typing import Optional
|
|
|
-from ..models.quota_input import QuotaInputModel
|
|
|
+from core.models.quota_input import QuotaInputModel
|
|
|
+from core.dtos.project_quota import ProjectQuotaDto
|
|
|
|
|
|
class QuotaInputDto(BaseModel):
|
|
|
"""定额输入DTO"""
|
|
@@ -8,44 +9,44 @@ class QuotaInputDto(BaseModel):
|
|
|
budget_id: int
|
|
|
item_id: int
|
|
|
quota_code: str
|
|
|
- sequence_number: Optional[int] = None
|
|
|
+ # sequence_number: Optional[int] = None
|
|
|
project_name: Optional[str] = None
|
|
|
unit: Optional[str] = None
|
|
|
project_quantity: Optional[float] = None
|
|
|
- project_quantity_input: Optional[str] = None
|
|
|
- quota_adjustment: Optional[str] = None
|
|
|
+ # project_quantity_input: Optional[str] = None
|
|
|
+ # quota_adjustment: Optional[str] = None
|
|
|
unit_price: Optional[float] = None
|
|
|
- compilation_unit_price: Optional[float] = None
|
|
|
+ # compilation_unit_price: Optional[float] = None
|
|
|
total_price: Optional[float] = None
|
|
|
- compilation_total_price: Optional[float] = None
|
|
|
- unit_weight: Optional[float] = None
|
|
|
- total_weight: Optional[float] = None
|
|
|
- labor_cost: Optional[float] = None
|
|
|
- compilation_labor_cost: Optional[float] = None
|
|
|
- material_cost: Optional[float] = None
|
|
|
- compilation_material_cost: Optional[float] = None
|
|
|
- deduct_material_cost: Optional[float] = None
|
|
|
- compilation_deduct_material_cost: Optional[float] = None
|
|
|
- mechanical_cost: Optional[float] = None
|
|
|
- compilation_mechanical_cost: Optional[float] = None
|
|
|
- equipment_cost: Optional[float] = None
|
|
|
- compilation_equipment_cost: Optional[float] = None
|
|
|
- transport_cost: Optional[float] = None
|
|
|
- compilation_transport_cost: Optional[float] = None
|
|
|
- quota_workday: Optional[float] = None
|
|
|
- total_workday: Optional[float] = None
|
|
|
- workday_salary: Optional[float] = None
|
|
|
- compilation_workday_salary: Optional[float] = None
|
|
|
- quota_mechanical_workday: Optional[float] = None
|
|
|
- total_mechanical_workday: Optional[float] = None
|
|
|
- mechanical_workday_salary: Optional[float] = None
|
|
|
- compilation_mechanical_workday_salary: Optional[float] = None
|
|
|
+ # compilation_total_price: Optional[float] = None
|
|
|
+ # unit_weight: Optional[float] = None
|
|
|
+ # total_weight: Optional[float] = None
|
|
|
+ # labor_cost: Optional[float] = None
|
|
|
+ # compilation_labor_cost: Optional[float] = None
|
|
|
+ # material_cost: Optional[float] = None
|
|
|
+ # compilation_material_cost: Optional[float] = None
|
|
|
+ # deduct_material_cost: Optional[float] = None
|
|
|
+ # compilation_deduct_material_cost: Optional[float] = None
|
|
|
+ # mechanical_cost: Optional[float] = None
|
|
|
+ # compilation_mechanical_cost: Optional[float] = None
|
|
|
+ # equipment_cost: Optional[float] = None
|
|
|
+ # compilation_equipment_cost: Optional[float] = None
|
|
|
+ # transport_cost: Optional[float] = None
|
|
|
+ # compilation_transport_cost: Optional[float] = None
|
|
|
+ # quota_workday: Optional[float] = None
|
|
|
+ # total_workday: Optional[float] = None
|
|
|
+ # workday_salary: Optional[float] = None
|
|
|
+ # compilation_workday_salary: Optional[float] = None
|
|
|
+ # quota_mechanical_workday: Optional[float] = None
|
|
|
+ # total_mechanical_workday: Optional[float] = None
|
|
|
+ # mechanical_workday_salary: Optional[float] = None
|
|
|
+ # compilation_mechanical_workday_salary: Optional[float] = None
|
|
|
compiler: Optional[str] = None
|
|
|
modify_date: Optional[str] = None
|
|
|
- quota_consumption: Optional[str] = None
|
|
|
- basic_quota: Optional[str] = None
|
|
|
- quota_comprehensive_unit_price: Optional[float] = None
|
|
|
- quota_comprehensive_total_price: Optional[float] = None
|
|
|
+ # quota_consumption: Optional[str] = None
|
|
|
+ # basic_quota: Optional[str] = None
|
|
|
+ # quota_comprehensive_unit_price: Optional[float] = None
|
|
|
+ # quota_comprehensive_total_price: Optional[float] = None
|
|
|
|
|
|
@classmethod
|
|
|
def from_model(cls, model: QuotaInputModel) -> 'QuotaInputDto':
|
|
@@ -55,46 +56,93 @@ class QuotaInputDto(BaseModel):
|
|
|
budget_id=model.budget_id,
|
|
|
item_id=model.item_id,
|
|
|
quota_code=model.quota_code,
|
|
|
- sequence_number=model.sequence_number,
|
|
|
+ # sequence_number=model.sequence_number,
|
|
|
project_name=model.project_name,
|
|
|
unit=model.unit,
|
|
|
project_quantity=model.project_quantity,
|
|
|
- project_quantity_input=model.project_quantity_input,
|
|
|
- quota_adjustment=model.quota_adjustment,
|
|
|
+ # project_quantity_input=model.project_quantity_input,
|
|
|
+ # quota_adjustment=model.quota_adjustment,
|
|
|
unit_price=model.unit_price,
|
|
|
- compilation_unit_price=model.compilation_unit_price,
|
|
|
+ # compilation_unit_price=model.compilation_unit_price,
|
|
|
total_price=model.total_price,
|
|
|
- compilation_total_price=model.compilation_total_price,
|
|
|
- unit_weight=model.unit_weight,
|
|
|
- total_weight=model.total_weight,
|
|
|
- labor_cost=model.labor_cost,
|
|
|
- compilation_labor_cost=model.compilation_labor_cost,
|
|
|
- material_cost=model.material_cost,
|
|
|
- compilation_material_cost=model.compilation_material_cost,
|
|
|
- deduct_material_cost=model.deduct_material_cost,
|
|
|
- compilation_deduct_material_cost=model.compilation_deduct_material_cost,
|
|
|
- mechanical_cost=model.mechanical_cost,
|
|
|
- compilation_mechanical_cost=model.compilation_mechanical_cost,
|
|
|
- equipment_cost=model.equipment_cost,
|
|
|
- compilation_equipment_cost=model.compilation_equipment_cost,
|
|
|
- transport_cost=model.transport_cost,
|
|
|
- compilation_transport_cost=model.compilation_transport_cost,
|
|
|
- quota_workday=model.quota_workday,
|
|
|
- total_workday=model.total_workday,
|
|
|
- workday_salary=model.workday_salary,
|
|
|
- compilation_workday_salary=model.compilation_workday_salary,
|
|
|
- quota_mechanical_workday=model.quota_mechanical_workday,
|
|
|
- total_mechanical_workday=model.total_mechanical_workday,
|
|
|
- mechanical_workday_salary=model.mechanical_workday_salary,
|
|
|
- compilation_mechanical_workday_salary=model.compilation_mechanical_workday_salary,
|
|
|
+ # compilation_total_price=model.compilation_total_price,
|
|
|
+ # unit_weight=model.unit_weight,
|
|
|
+ # total_weight=model.total_weight,
|
|
|
+ # labor_cost=model.labor_cost,
|
|
|
+ # compilation_labor_cost=model.compilation_labor_cost,
|
|
|
+ # material_cost=model.material_cost,
|
|
|
+ # compilation_material_cost=model.compilation_material_cost,
|
|
|
+ # deduct_material_cost=model.deduct_material_cost,
|
|
|
+ # compilation_deduct_material_cost=model.compilation_deduct_material_cost,
|
|
|
+ # mechanical_cost=model.mechanical_cost,
|
|
|
+ # compilation_mechanical_cost=model.compilation_mechanical_cost,
|
|
|
+ # equipment_cost=model.equipment_cost,
|
|
|
+ # compilation_equipment_cost=model.compilation_equipment_cost,
|
|
|
+ # transport_cost=model.transport_cost,
|
|
|
+ # compilation_transport_cost=model.compilation_transport_cost,
|
|
|
+ # quota_workday=model.quota_workday,
|
|
|
+ # total_workday=model.total_workday,
|
|
|
+ # workday_salary=model.workday_salary,
|
|
|
+ # compilation_workday_salary=model.compilation_workday_salary,
|
|
|
+ # quota_mechanical_workday=model.quota_mechanical_workday,
|
|
|
+ # total_mechanical_workday=model.total_mechanical_workday,
|
|
|
+ # mechanical_workday_salary=model.mechanical_workday_salary,
|
|
|
+ # compilation_mechanical_workday_salary=model.compilation_mechanical_workday_salary,
|
|
|
compiler=model.compiler,
|
|
|
modify_date=model.modify_date,
|
|
|
- quota_consumption=model.quota_consumption,
|
|
|
- basic_quota=model.basic_quota,
|
|
|
- quota_comprehensive_unit_price=model.quota_comprehensive_unit_price,
|
|
|
- quota_comprehensive_total_price=model.quota_comprehensive_total_price
|
|
|
+ # quota_consumption=model.quota_consumption,
|
|
|
+ # basic_quota=model.basic_quota,
|
|
|
+ # quota_comprehensive_unit_price=model.quota_comprehensive_unit_price,
|
|
|
+ # quota_comprehensive_total_price=model.quota_comprehensive_total_price
|
|
|
)
|
|
|
|
|
|
+ @classmethod
|
|
|
+ def from_quota_dto(cls, quota_dto: ProjectQuotaDto):
|
|
|
+ return cls(
|
|
|
+ budget_id=quota_dto.budget_id,
|
|
|
+ item_id=quota_dto.item_id,
|
|
|
+ quota_code=quota_dto.quota_code,
|
|
|
+ # sequence_number=quota_dto.sequence_number,
|
|
|
+ project_name=quota_dto.project_name,
|
|
|
+ unit=quota_dto.unit,
|
|
|
+ project_quantity=quota_dto.project_quantity,
|
|
|
+ # project_quantity_input=quota_dto.project_quantity_input,
|
|
|
+ # quota_adjustment=quota_dto.quota_adjustment,
|
|
|
+ unit_price=quota_dto.unit_price,
|
|
|
+ # compilation_unit_price=quota_dto.compilation_unit_price,
|
|
|
+ total_price=quota_dto.total_price,
|
|
|
+ # compilation_total_price=quota_dto.compilation_total_price,
|
|
|
+ # unit_weight=quota_dto.unit_weight,
|
|
|
+ # total_weight=quota_dto.total_weight,
|
|
|
+ # labor_cost=quota_dto.labor_cost,
|
|
|
+ # compilation_labor_cost=quota_dto.compilation_labor_cost,
|
|
|
+ # material_cost=quota_dto.material_cost,
|
|
|
+ # compilation_material_cost=quota_dto.compilation_material_cost,
|
|
|
+ # deduct_material_cost=quota_dto.deduct_material_cost,
|
|
|
+ # compilation_deduct_material_cost=quota_dto.compilation_deduct_material_cost,
|
|
|
+ # mechanical_cost=quota_dto.mechanical_cost,
|
|
|
+ # compilation_mechanical_cost=quota_dto.compilation_mechanical_cost,
|
|
|
+ # equipment_cost=quota_dto.equipment_cost,
|
|
|
+ # compilation_equipment_cost=quota_dto.compilation_equipment_cost,
|
|
|
+ # transport_cost=quota_dto.transport_cost,
|
|
|
+ # compilation_transport_cost=quota_dto.compilation_transport_cost,
|
|
|
+ # quota_workday=quota_dto.quota_workday,
|
|
|
+ # total_workday=quota_dto.total_workday,
|
|
|
+ # workday_salary=quota_dto.workday_salary,
|
|
|
+ # compilation_workday_salary=quota_dto.compilation_workday_salary,
|
|
|
+ # quota_mechanical_workday=quota_dto.quota_mechanical_workday,
|
|
|
+ # total_mechanical_workday=quota_dto.total_mechanical_workday,
|
|
|
+ # mechanical_workday_salary=quota_dto.mechanical_workday_salary,
|
|
|
+ # compilation_mechanical_workday_salary=quota_dto.compilation_mechanical_workday_salary,
|
|
|
+ compiler=quota_dto.created_by,
|
|
|
+ # quota_consumption=quota_dto.quota_consumption,
|
|
|
+ # basic_quota=quota_dto.basic_quota,
|
|
|
+ # quota_comprehensive_unit_price=quota_dto.quota_comprehensive_unit_price,
|
|
|
+ # quota_comprehensive_total_price=quota_dto.quota_comprehensive_total_price
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
def to_dict(self) -> dict:
|
|
|
"""转换为字典格式"""
|
|
|
return self.model_dump()
|