x
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
from .product_schemas import ProductCreate, ProductResponse
|
||||
from .product_schemas import (
|
||||
ProductCreate,
|
||||
ProductResponse,
|
||||
ProductMaterialItemUpdate,
|
||||
ProductBOMUpdate,
|
||||
ProductMaterialItemResponse,
|
||||
ProductBOMResponse
|
||||
)
|
||||
from .supplier_schemas import SupplierCreate, SupplierResponse
|
||||
from .customer_schemas import CustomerCreate, CustomerResponse
|
||||
from .warehouse_schemas import WarehouseCreate, WarehouseResponse
|
||||
@@ -12,7 +19,11 @@ from .purchase_order_schemas import (
|
||||
from .sales_order_schemas import (
|
||||
SalesOrderCreate,
|
||||
SalesOrderResponse,
|
||||
SalesOrderItemCreate
|
||||
SalesOrderItemCreate,
|
||||
ProductionMaterialPlanItemResponse,
|
||||
SalesOrderProductionPlanResponse,
|
||||
SalesOrderIssueRequest,
|
||||
SalesOrderIssueResponse
|
||||
)
|
||||
from .finance_schemas import (
|
||||
FinanceAllocationCreate,
|
||||
@@ -31,7 +42,8 @@ from .finance_schemas import (
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"ProductCreate", "ProductResponse",
|
||||
"ProductCreate", "ProductResponse", "ProductMaterialItemUpdate", "ProductBOMUpdate",
|
||||
"ProductMaterialItemResponse", "ProductBOMResponse",
|
||||
"SupplierCreate", "SupplierResponse",
|
||||
"CustomerCreate", "CustomerResponse",
|
||||
"WarehouseCreate", "WarehouseResponse",
|
||||
@@ -39,6 +51,8 @@ __all__ = [
|
||||
"StockMovementCreate", "StockMovementResponse",
|
||||
"PurchaseOrderCreate", "PurchaseOrderResponse", "PurchaseOrderItemCreate",
|
||||
"SalesOrderCreate", "SalesOrderResponse", "SalesOrderItemCreate",
|
||||
"ProductionMaterialPlanItemResponse", "SalesOrderProductionPlanResponse",
|
||||
"SalesOrderIssueRequest", "SalesOrderIssueResponse",
|
||||
"FinanceAllocationCreate", "FinanceTransactionCreate",
|
||||
"ReceiptCreate", "PaymentCreate",
|
||||
"FinanceAllocationResponse", "FinanceTransactionResponse",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ class ProductCreate(BaseModel):
|
||||
description: Optional[str] = None
|
||||
category: Optional[str] = None
|
||||
unit: str = "件"
|
||||
item_type: str = "finished"
|
||||
cost_price: float = 0
|
||||
sale_price: float = 0
|
||||
min_stock: int = 0
|
||||
@@ -22,12 +23,41 @@ class ProductResponse(BaseModel):
|
||||
description: Optional[str]
|
||||
category: Optional[str]
|
||||
unit: str
|
||||
item_type: str
|
||||
cost_price: float
|
||||
sale_price: float
|
||||
min_stock: int
|
||||
max_stock: int
|
||||
material_cost: float = 0
|
||||
is_active: bool
|
||||
created_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ProductMaterialItemUpdate(BaseModel):
|
||||
material_id: int
|
||||
quantity: float
|
||||
loss_rate: float = 0
|
||||
|
||||
|
||||
class ProductBOMUpdate(BaseModel):
|
||||
items: List[ProductMaterialItemUpdate]
|
||||
|
||||
|
||||
class ProductMaterialItemResponse(BaseModel):
|
||||
material_id: int
|
||||
material_sku: str
|
||||
material_name: str
|
||||
quantity: float
|
||||
loss_rate: float
|
||||
unit_cost: float
|
||||
line_cost: float
|
||||
|
||||
|
||||
class ProductBOMResponse(BaseModel):
|
||||
product_id: int
|
||||
product_name: str
|
||||
total_material_cost: float
|
||||
items: List[ProductMaterialItemResponse]
|
||||
|
||||
@@ -24,6 +24,10 @@ class SalesOrderResponse(BaseModel):
|
||||
order_date: datetime
|
||||
delivery_date: Optional[datetime]
|
||||
status: str
|
||||
production_status: str
|
||||
production_no: Optional[str]
|
||||
planned_material_cost: float
|
||||
actual_material_cost: float
|
||||
total_amount: float
|
||||
received_amount: float
|
||||
remark: Optional[str]
|
||||
@@ -31,3 +35,41 @@ class SalesOrderResponse(BaseModel):
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class ProductionMaterialPlanItemResponse(BaseModel):
|
||||
material_id: int
|
||||
material_sku: str
|
||||
material_name: str
|
||||
required_quantity: int
|
||||
available_quantity: int
|
||||
shortage_quantity: int
|
||||
unit_cost: float
|
||||
required_cost: float
|
||||
|
||||
|
||||
class SalesOrderProductionPlanResponse(BaseModel):
|
||||
sales_order_id: int
|
||||
order_no: str
|
||||
customer_name: str
|
||||
production_no: str
|
||||
planned_material_cost: float
|
||||
items: List[ProductionMaterialPlanItemResponse]
|
||||
|
||||
|
||||
class SalesOrderIssueRequest(BaseModel):
|
||||
warehouse_id: int
|
||||
production_no: Optional[str] = None
|
||||
remark: Optional[str] = None
|
||||
|
||||
|
||||
class SalesOrderIssueResponse(BaseModel):
|
||||
sales_order_id: int
|
||||
order_no: str
|
||||
production_no: str
|
||||
movement_count: int
|
||||
planned_material_cost: float
|
||||
actual_material_cost: float
|
||||
cost_deviation: float
|
||||
cost_deviation_rate: float
|
||||
production_status: str
|
||||
|
||||
Reference in New Issue
Block a user