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};
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 16:00:50 +08:00
|
|
|
/// 获取载具状态列表
|
|
|
|
|
static Future<dynamic> getAvailVehicleList({int timeOut = 5000}) async {
|
2025-02-22 15:56:40 +08:00
|
|
|
final response =
|
2025-02-25 16:00:50 +08:00
|
|
|
await BaseDio.instance().get<String>("/app/vehicle/listAvail",
|
2025-02-22 15:56:40 +08:00
|
|
|
options: Options(
|
|
|
|
|
responseType: ResponseType.json,
|
|
|
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
|
|
|
));
|
|
|
|
|
return {"code": response.statusCode, "data": response.data};
|
|
|
|
|
}
|
|
|
|
|
|
2025-02-25 16:00:50 +08:00
|
|
|
static Future<dynamic> addStockOut(String goodsId, int needNum, String remark,
|
|
|
|
|
{int timeOut = 5000}) async {
|
|
|
|
|
final response =
|
|
|
|
|
await BaseDio.instance().post<String>("/app/task/createOutRequest",
|
|
|
|
|
data: jsonEncode({
|
|
|
|
|
"goodsId": goodsId,
|
|
|
|
|
"needNum": needNum,
|
|
|
|
|
"remark": remark
|
|
|
|
|
}),
|
|
|
|
|
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
|
|
|
}
|