Files
ssp/services/orderservice.h
T
lidg 5f4649832e feat(production): modify
- 添加终止按钮
- 点击操作前进行提示
- 取放料的时候,除了写slot,也写行和列
2026-10-30 16:43:24 +08:00

36 lines
1.2 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 findUnfinishedOrder(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 terminateOrder(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