2025-02-19 18:52:05 +08:00
|
|
|
import 'dart:convert';
|
2025-02-22 15:56:40 +08:00
|
|
|
import 'dart:math';
|
2025-02-19 18:52:05 +08:00
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
|
import 'baseDio.dart';
|
2025-02-22 15:56:40 +08:00
|
|
|
import 'package:logger/logger.dart';
|
|
|
|
|
import 'package:uuid/uuid.dart';
|
2025-02-19 18:52:05 +08:00
|
|
|
|
|
|
|
|
class StockOutApi {
|
2025-02-22 15:56:40 +08:00
|
|
|
static var logger = Logger(
|
|
|
|
|
printer: PrettyPrinter(),
|
|
|
|
|
);
|
|
|
|
|
static var uuidGen = Uuid();
|
|
|
|
|
|
2025-02-19 18:52:05 +08:00
|
|
|
/// 码盘完成
|
|
|
|
|
static Future<dynamic> getEmptyVehicle({int timeOut = 5000}) async {
|
2025-02-22 15:56:40 +08:00
|
|
|
final response = await BaseDio.instance()
|
|
|
|
|
.post<String>("/api/mobile/stockOut/outEmptyVehicle",
|
|
|
|
|
options: Options(
|
|
|
|
|
responseType: ResponseType.json,
|
|
|
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
));
|
|
|
|
|
return {"code": response.statusCode, "data": response.data};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// 获取载具状态
|
|
|
|
|
static Future<dynamic> getVehicleIsEmpty(int vehicleId,
|
|
|
|
|
{int timeOut = 5000}) async {
|
|
|
|
|
final response =
|
|
|
|
|
await BaseDio.instance().get<String>("/app/vehicle/$vehicleId",
|
|
|
|
|
options: Options(
|
|
|
|
|
responseType: ResponseType.json,
|
|
|
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
));
|
|
|
|
|
return {"code": response.statusCode, "data": response.data};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<dynamic> addStockOut({int timeOut = 5000}) async {
|
|
|
|
|
final response = await BaseDio.instance().post<String>("/app/pmsOrderOut",
|
|
|
|
|
data: jsonEncode({
|
|
|
|
|
"listId": uuidGen.v4(),
|
|
|
|
|
"orderType": 1,
|
|
|
|
|
"customerId": uuidGen.v1(),
|
|
|
|
|
"goodsId": uuidGen.v4(),
|
|
|
|
|
"goodsNum": 0,
|
|
|
|
|
"goodsDesc": "empty",
|
|
|
|
|
"spare1": uuidGen.v1(),
|
|
|
|
|
"spare2": uuidGen.v1(),
|
|
|
|
|
}),
|
2025-02-19 18:52:05 +08:00
|
|
|
options: Options(
|
|
|
|
|
responseType: ResponseType.json,
|
|
|
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
2025-02-22 15:56:40 +08:00
|
|
|
));
|
|
|
|
|
logger.e("yuqili ${response.data}");
|
|
|
|
|
return {"code": response.statusCode, "data": response.data};
|
2025-02-19 18:52:05 +08:00
|
|
|
}
|
2025-02-22 15:56:40 +08:00
|
|
|
}
|