forked from erp-dev/erp
feat: salesitem create api
This commit is contained in:
325
api_v1/urls.py
325
api_v1/urls.py
@@ -22,7 +22,11 @@ from .views.business.statements import views as statement_views
|
||||
from .views.business.pre_sales import views as pre_sales_views
|
||||
from .views.business.pre_purchase import views as pre_purchase_views
|
||||
from .views.stock_change_views.snapshot import StockSnapshotListView
|
||||
from .views.printing.views import PrintingOrderViewSet, PrintingJobViewSet, PlateOrderViewSet
|
||||
from .views.printing.views import (
|
||||
PrintingOrderViewSet,
|
||||
PrintingJobViewSet,
|
||||
PlateOrderViewSet,
|
||||
)
|
||||
from .views.upload import UploadFileViewSet
|
||||
from .views.products import ProductQuickViewSet
|
||||
from .views.parameters import StateParameterViewSet
|
||||
@@ -30,6 +34,7 @@ from .views.users import CreateUserWithProfileView
|
||||
from .views.mingdaoyun import MDYPlateOrderStagingViewSet
|
||||
from .views.shipment import (
|
||||
SalesItemByPrintingOrderView,
|
||||
SalesItemCreateView,
|
||||
ShipmentListCreateView,
|
||||
ShipmentDetailView,
|
||||
ShipmentExternalCreateView,
|
||||
@@ -38,132 +43,282 @@ from .views.settlement.views import PlateOrderSummaryView
|
||||
|
||||
# 创建 DRF Router for Stateflow
|
||||
stateflow_router = DefaultRouter()
|
||||
stateflow_router.register(r'states', stateflow.StateViewSet, basename='state')
|
||||
stateflow_router.register(r'processes', stateflow.ProcessViewSet, basename='process')
|
||||
stateflow_router.register(r'business-objects', stateflow.BusinessObjectViewSet, basename='business-object')
|
||||
stateflow_router.register(r"states", stateflow.StateViewSet, basename="state")
|
||||
stateflow_router.register(r"processes", stateflow.ProcessViewSet, basename="process")
|
||||
stateflow_router.register(
|
||||
r"business-objects", stateflow.BusinessObjectViewSet, basename="business-object"
|
||||
)
|
||||
|
||||
# 创建主 Router
|
||||
main_router = DefaultRouter()
|
||||
main_router.register(r'printing-orders', PrintingOrderViewSet, basename='printing-order')
|
||||
main_router.register(r'printing-jobs', PrintingJobViewSet, basename='printing-job')
|
||||
main_router.register(r'plate-orders', PlateOrderViewSet, basename='plate-order')
|
||||
main_router.register(r'upload', UploadFileViewSet, basename='upload')
|
||||
main_router.register(r'products/quick', ProductQuickViewSet, basename='product-quick')
|
||||
main_router.register(r'parameters', StateParameterViewSet, basename='parameter')
|
||||
main_router.register(r'mdy-plate-order-staging', MDYPlateOrderStagingViewSet, basename='mdy-plate-order-staging')
|
||||
main_router.register(
|
||||
r"printing-orders", PrintingOrderViewSet, basename="printing-order"
|
||||
)
|
||||
main_router.register(r"printing-jobs", PrintingJobViewSet, basename="printing-job")
|
||||
main_router.register(r"plate-orders", PlateOrderViewSet, basename="plate-order")
|
||||
main_router.register(r"upload", UploadFileViewSet, basename="upload")
|
||||
main_router.register(r"products/quick", ProductQuickViewSet, basename="product-quick")
|
||||
main_router.register(r"parameters", StateParameterViewSet, basename="parameter")
|
||||
main_router.register(
|
||||
r"mdy-plate-order-staging",
|
||||
MDYPlateOrderStagingViewSet,
|
||||
basename="mdy-plate-order-staging",
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
# 库存变动相关API
|
||||
path('stock-snapshots/', StockSnapshotListView.as_view(), name='list_stock_snapshots'),
|
||||
path('stock-changes/', stock_change_views.list_stock_changes, name='list_stock_changes'),
|
||||
path('stock-change-details/', stock_change_views.list_stock_change_details, name='list_stock_change_details'),
|
||||
path('stock-change/', stock_change_views.create_full_stock_change, name='create_full_stock_change'),
|
||||
path('stock-change/relaxed/', stock_change_views.create_relaxed_stock_change, name='create_relaxed_stock_change'),
|
||||
path('stock-change/restrict/', stock_change_views.create_restrict_stock_change, name='create_restrict_stock_change'),
|
||||
path('stock-change/transfer/', stock_change_views.transfer_stock_change, name='stock_transfer'),
|
||||
path('stock-change/<int:record_id>/', stock_change_views.get_stock_change, name='get_stock_change'),
|
||||
path('stock-change/<int:record_id>/finish/', stock_change_views.finish_stock_change, name='finish_stock_change'),
|
||||
path('stock-change/<int:record_id>/offset/', stock_change_views.offset_stock_change, name='offset_stock_change'),
|
||||
path(
|
||||
'set-merchant-auto-complete-stock-change/',
|
||||
stock_change_views.set_merchant_auto_complete_stock_change,
|
||||
name='set_merchant_auto_complete_stock_change',
|
||||
"stock-snapshots/", StockSnapshotListView.as_view(), name="list_stock_snapshots"
|
||||
),
|
||||
path(
|
||||
"stock-changes/",
|
||||
stock_change_views.list_stock_changes,
|
||||
name="list_stock_changes",
|
||||
),
|
||||
path(
|
||||
"stock-change-details/",
|
||||
stock_change_views.list_stock_change_details,
|
||||
name="list_stock_change_details",
|
||||
),
|
||||
path(
|
||||
"stock-change/",
|
||||
stock_change_views.create_full_stock_change,
|
||||
name="create_full_stock_change",
|
||||
),
|
||||
path(
|
||||
"stock-change/relaxed/",
|
||||
stock_change_views.create_relaxed_stock_change,
|
||||
name="create_relaxed_stock_change",
|
||||
),
|
||||
path(
|
||||
"stock-change/restrict/",
|
||||
stock_change_views.create_restrict_stock_change,
|
||||
name="create_restrict_stock_change",
|
||||
),
|
||||
path(
|
||||
"stock-change/transfer/",
|
||||
stock_change_views.transfer_stock_change,
|
||||
name="stock_transfer",
|
||||
),
|
||||
path(
|
||||
"stock-change/<int:record_id>/",
|
||||
stock_change_views.get_stock_change,
|
||||
name="get_stock_change",
|
||||
),
|
||||
path(
|
||||
"stock-change/<int:record_id>/finish/",
|
||||
stock_change_views.finish_stock_change,
|
||||
name="finish_stock_change",
|
||||
),
|
||||
path(
|
||||
"stock-change/<int:record_id>/offset/",
|
||||
stock_change_views.offset_stock_change,
|
||||
name="offset_stock_change",
|
||||
),
|
||||
path(
|
||||
"set-merchant-auto-complete-stock-change/",
|
||||
stock_change_views.set_merchant_auto_complete_stock_change,
|
||||
name="set_merchant_auto_complete_stock_change",
|
||||
),
|
||||
|
||||
# 用户信息 API
|
||||
path('user-info/', user_info.user_info, name='user_info'),
|
||||
|
||||
path("user-info/", user_info.user_info, name="user_info"),
|
||||
# 用户创建 API
|
||||
path('users/create/', CreateUserWithProfileView.as_view(), name='create_user_with_profile'),
|
||||
|
||||
path(
|
||||
"users/create/",
|
||||
CreateUserWithProfileView.as_view(),
|
||||
name="create_user_with_profile",
|
||||
),
|
||||
# 库存查询 API
|
||||
path('inventory/', inventory.InventoryAPIView.as_view(), name='inventory'),
|
||||
path('purchase-orders/', purchase_views.PurchaseOrderView.as_view(), name='purchase_orders'),
|
||||
path('purchase-orders/<int:pk>/', purchase_views.PurchaseOrderDetailView.as_view(), name='purchase_order_detail'),
|
||||
path('purchase-orders/<int:pk>/review/', purchase_views.PurchaseOrderReviewView.as_view(), name='purchase_order_review'),
|
||||
path("inventory/", inventory.InventoryAPIView.as_view(), name="inventory"),
|
||||
path(
|
||||
'purchase-orders/<int:pk>/bind-stock-change/',
|
||||
"purchase-orders/",
|
||||
purchase_views.PurchaseOrderView.as_view(),
|
||||
name="purchase_orders",
|
||||
),
|
||||
path(
|
||||
"purchase-orders/<int:pk>/",
|
||||
purchase_views.PurchaseOrderDetailView.as_view(),
|
||||
name="purchase_order_detail",
|
||||
),
|
||||
path(
|
||||
"purchase-orders/<int:pk>/review/",
|
||||
purchase_views.PurchaseOrderReviewView.as_view(),
|
||||
name="purchase_order_review",
|
||||
),
|
||||
path(
|
||||
"purchase-orders/<int:pk>/bind-stock-change/",
|
||||
purchase_views.PurchaseOrderBindStockChangeView.as_view(),
|
||||
name='purchase_order_bind_stock_change',
|
||||
name="purchase_order_bind_stock_change",
|
||||
),
|
||||
path('purchase-return-orders/', purchase_return_views.PurchaseReturnOrderView.as_view(), name='purchase_return_orders'),
|
||||
path('purchase-return-orders/<int:pk>/', purchase_return_views.PurchaseReturnOrderDetailView.as_view(), name='purchase_return_order_detail'),
|
||||
path('purchase-return-orders/<int:pk>/review/', purchase_return_views.PurchaseReturnOrderReviewView.as_view(), name='purchase_return_order_review'),
|
||||
path('sales-orders/', sales_views.SalesOrderView.as_view(), name='sales_orders'),
|
||||
path('sales-orders/<int:pk>/', sales_views.SalesOrderDetailView.as_view(), name='sales_order_detail'),
|
||||
path('sales-orders/<int:pk>/review/', sales_views.SalesOrderReviewView.as_view(), name='sales_order_review'),
|
||||
path('sales-return-orders/', sales_return_views.SalesReturnOrderView.as_view(), name='sales_return_orders'),
|
||||
path('sales-return-orders/<int:pk>/', sales_return_views.SalesReturnOrderDetailView.as_view(), name='sales_return_order_detail'),
|
||||
path('sales-return-orders/<int:pk>/review/', sales_return_views.SalesReturnOrderReviewView.as_view(), name='sales_return_order_review'),
|
||||
path('pre-sales-orders/', pre_sales_views.PreSalesOrderView.as_view(), name='pre_sales_orders'),
|
||||
path('pre-sales-orders/<int:pk>/', pre_sales_views.PreSalesOrderDetailView.as_view(), name='pre_sales_order_detail'),
|
||||
path(
|
||||
'pre-sales-orders/<int:pk>/convert-to-sales/',
|
||||
"purchase-return-orders/",
|
||||
purchase_return_views.PurchaseReturnOrderView.as_view(),
|
||||
name="purchase_return_orders",
|
||||
),
|
||||
path(
|
||||
"purchase-return-orders/<int:pk>/",
|
||||
purchase_return_views.PurchaseReturnOrderDetailView.as_view(),
|
||||
name="purchase_return_order_detail",
|
||||
),
|
||||
path(
|
||||
"purchase-return-orders/<int:pk>/review/",
|
||||
purchase_return_views.PurchaseReturnOrderReviewView.as_view(),
|
||||
name="purchase_return_order_review",
|
||||
),
|
||||
path("sales-orders/", sales_views.SalesOrderView.as_view(), name="sales_orders"),
|
||||
path(
|
||||
"sales-orders/<int:pk>/",
|
||||
sales_views.SalesOrderDetailView.as_view(),
|
||||
name="sales_order_detail",
|
||||
),
|
||||
path(
|
||||
"sales-orders/<int:pk>/review/",
|
||||
sales_views.SalesOrderReviewView.as_view(),
|
||||
name="sales_order_review",
|
||||
),
|
||||
path(
|
||||
"sales-return-orders/",
|
||||
sales_return_views.SalesReturnOrderView.as_view(),
|
||||
name="sales_return_orders",
|
||||
),
|
||||
path(
|
||||
"sales-return-orders/<int:pk>/",
|
||||
sales_return_views.SalesReturnOrderDetailView.as_view(),
|
||||
name="sales_return_order_detail",
|
||||
),
|
||||
path(
|
||||
"sales-return-orders/<int:pk>/review/",
|
||||
sales_return_views.SalesReturnOrderReviewView.as_view(),
|
||||
name="sales_return_order_review",
|
||||
),
|
||||
path(
|
||||
"pre-sales-orders/",
|
||||
pre_sales_views.PreSalesOrderView.as_view(),
|
||||
name="pre_sales_orders",
|
||||
),
|
||||
path(
|
||||
"pre-sales-orders/<int:pk>/",
|
||||
pre_sales_views.PreSalesOrderDetailView.as_view(),
|
||||
name="pre_sales_order_detail",
|
||||
),
|
||||
path(
|
||||
"pre-sales-orders/<int:pk>/convert-to-sales/",
|
||||
pre_sales_views.PreSalesOrderConvertToSalesOrderView.as_view(),
|
||||
name='pre_sales_order_convert_to_sales',
|
||||
name="pre_sales_order_convert_to_sales",
|
||||
),
|
||||
path(
|
||||
'pre-sales-order-items/<int:item_id>/allocations/',
|
||||
"pre-sales-order-items/<int:item_id>/allocations/",
|
||||
pre_sales_views.PreSalesOrderItemAllocationView.as_view(),
|
||||
name='pre_sales_order_item_allocations',
|
||||
name="pre_sales_order_item_allocations",
|
||||
),
|
||||
path(
|
||||
'pre-sales-order-items/<int:item_id>/allocations/<int:pk>/',
|
||||
"pre-sales-order-items/<int:item_id>/allocations/<int:pk>/",
|
||||
pre_sales_views.PreSalesOrderItemAllocationDetailView.as_view(),
|
||||
name='pre_sales_order_item_allocation_detail',
|
||||
name="pre_sales_order_item_allocation_detail",
|
||||
),
|
||||
path(
|
||||
"pre-purchase-orders/",
|
||||
pre_purchase_views.PrePurchaseOrderView.as_view(),
|
||||
name="pre_purchase_orders",
|
||||
),
|
||||
path(
|
||||
"pre-purchase-orders/<int:pk>/",
|
||||
pre_purchase_views.PrePurchaseOrderDetailView.as_view(),
|
||||
name="pre_purchase_order_detail",
|
||||
),
|
||||
path(
|
||||
"payment-orders/",
|
||||
payment_views.PaymentOrderView.as_view(),
|
||||
name="payment_orders",
|
||||
),
|
||||
path(
|
||||
"payment-orders/<int:pk>/review/",
|
||||
payment_views.PaymentOrderReviewView.as_view(),
|
||||
name="payment_order_review",
|
||||
),
|
||||
path(
|
||||
"receipt-orders/",
|
||||
receipt_views.ReceiptOrderView.as_view(),
|
||||
name="receipt_orders",
|
||||
),
|
||||
path(
|
||||
"receipt-orders/<int:pk>/review/",
|
||||
receipt_views.ReceiptOrderReviewView.as_view(),
|
||||
name="receipt_order_review",
|
||||
),
|
||||
path(
|
||||
"customers/<int:customer_id>/balance/",
|
||||
balance_views.CustomerBalanceView.as_view(),
|
||||
name="customer_balance",
|
||||
),
|
||||
path(
|
||||
"suppliers/<int:supplier_id>/balance/",
|
||||
balance_views.SupplierBalanceView.as_view(),
|
||||
name="supplier_balance",
|
||||
),
|
||||
path(
|
||||
"customers/<int:customer_id>/statements/",
|
||||
statement_views.CustomerStatementView.as_view(),
|
||||
name="customer_statements",
|
||||
),
|
||||
path(
|
||||
"suppliers/<int:supplier_id>/statements/",
|
||||
statement_views.SupplierStatementView.as_view(),
|
||||
name="supplier_statements",
|
||||
),
|
||||
path(
|
||||
"statements/record/",
|
||||
statement_views.StatementRecordView.as_view(),
|
||||
name="statement_record",
|
||||
),
|
||||
path("health/", healthy.HealthCheckView.as_view(), name="health_check"),
|
||||
path(
|
||||
"print-count/delta/", print_count.adjust_print_count, name="print_count_delta"
|
||||
),
|
||||
path('pre-purchase-orders/', pre_purchase_views.PrePurchaseOrderView.as_view(), name='pre_purchase_orders'),
|
||||
path('pre-purchase-orders/<int:pk>/', pre_purchase_views.PrePurchaseOrderDetailView.as_view(), name='pre_purchase_order_detail'),
|
||||
path('payment-orders/', payment_views.PaymentOrderView.as_view(), name='payment_orders'),
|
||||
path('payment-orders/<int:pk>/review/', payment_views.PaymentOrderReviewView.as_view(), name='payment_order_review'),
|
||||
path('receipt-orders/', receipt_views.ReceiptOrderView.as_view(), name='receipt_orders'),
|
||||
path('receipt-orders/<int:pk>/review/', receipt_views.ReceiptOrderReviewView.as_view(), name='receipt_order_review'),
|
||||
path('customers/<int:customer_id>/balance/', balance_views.CustomerBalanceView.as_view(), name='customer_balance'),
|
||||
path('suppliers/<int:supplier_id>/balance/', balance_views.SupplierBalanceView.as_view(), name='supplier_balance'),
|
||||
path('customers/<int:customer_id>/statements/', statement_views.CustomerStatementView.as_view(), name='customer_statements'),
|
||||
path('suppliers/<int:supplier_id>/statements/', statement_views.SupplierStatementView.as_view(), name='supplier_statements'),
|
||||
path('statements/record/', statement_views.StatementRecordView.as_view(), name='statement_record'),
|
||||
path('health/', healthy.HealthCheckView.as_view(), name='health_check'),
|
||||
path('print-count/delta/', print_count.adjust_print_count, name='print_count_delta'),
|
||||
|
||||
# 产品图片上传 API
|
||||
path('products/<int:product_id>/image/', product_image.ProductImageUploadView.as_view(), name='product_image_upload'),
|
||||
|
||||
path(
|
||||
"products/<int:product_id>/image/",
|
||||
product_image.ProductImageUploadView.as_view(),
|
||||
name="product_image_upload",
|
||||
),
|
||||
# Tencent Cloud (TIIA) API
|
||||
path('tiia/search-image/', tiia.TiiaSearchImageView.as_view(), name='tiia_search_image'),
|
||||
|
||||
path(
|
||||
"tiia/search-image/",
|
||||
tiia.TiiaSearchImageView.as_view(),
|
||||
name="tiia_search_image",
|
||||
),
|
||||
# Stateflow API (使用 Router)
|
||||
path('stateflow/', include(stateflow_router.urls)),
|
||||
|
||||
path("stateflow/", include(stateflow_router.urls)),
|
||||
# Shipment API
|
||||
path(
|
||||
'shipment/shipments/',
|
||||
"shipment/shipments/",
|
||||
ShipmentListCreateView.as_view(),
|
||||
name='shipment_list_create'
|
||||
name="shipment_list_create",
|
||||
),
|
||||
path(
|
||||
'shipment/shipments/<int:pk>/',
|
||||
"shipment/shipments/<int:pk>/",
|
||||
ShipmentDetailView.as_view(),
|
||||
name='shipment_detail'
|
||||
name="shipment_detail",
|
||||
),
|
||||
path(
|
||||
'shipment/shipments/external/',
|
||||
"shipment/shipments/external/",
|
||||
ShipmentExternalCreateView.as_view(),
|
||||
name='shipment_create_external'
|
||||
name="shipment_create_external",
|
||||
),
|
||||
path(
|
||||
'shipment/sales-items/by-printing-order/<int:printing_order_id>/',
|
||||
"shipment/sales-items/by-printing-order/<int:printing_order_id>/",
|
||||
SalesItemByPrintingOrderView.as_view(),
|
||||
name='sales_items_by_printing_order'
|
||||
name="sales_items_by_printing_order",
|
||||
),
|
||||
path(
|
||||
"shipment/sales-items/", SalesItemCreateView.as_view(), name="sales_item_create"
|
||||
),
|
||||
|
||||
# Settlement API
|
||||
path(
|
||||
'settlement/plate-orders/summary/',
|
||||
"settlement/plate-orders/summary/",
|
||||
PlateOrderSummaryView.as_view(),
|
||||
name='plate_order_summary'
|
||||
name="plate_order_summary",
|
||||
),
|
||||
|
||||
# 主 Router (printing-orders 等)
|
||||
path('', include(main_router.urls)),
|
||||
path("", include(main_router.urls)),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user