Files
ssp/services/orderservice.h
T
2026-08-18 09:40:43 +08:00

34 lines
1.1 KiB
C++

#ifndef ORDERSERVICE_H
#define ORDERSERVICE_H
#include "../models/order.h"
#include <QList>
class OrderService
{
public:
static OrderService &instance();
QList<Order> listOrders(QString *error = nullptr, int limit = 100);
bool findOrder(int id, Order *order, QString *error = nullptr);
bool createOrder(Order *order, QString *error = nullptr);
bool generateWorkpiecesAndAssign(int orderId, QString *error = nullptr);
bool startOrder(int id, QString *error = nullptr);
bool pauseOrder(int id, QString *error = nullptr);
bool resumeOrder(int id, QString *error = nullptr);
bool completeOrder(int id, QString *error = nullptr);
bool cancelOrder(int id, QString *error = nullptr);
bool deleteOrder(int id, QString *error = nullptr);
private:
OrderService() = default;
OrderService(const OrderService &) = delete;
OrderService &operator=(const OrderService &) = delete;
bool transition(int id, const QStringList &allowedStates, const QString &targetState,
const QString &action, QString *error);
};
#endif // ORDERSERVICE_H