121 lines
3.6 KiB
Dart
121 lines
3.6 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
class WmsApiClient {
|
|
|
|
static Dio dio = Dio();
|
|
static bool initializeComplete = false;
|
|
static Dio instance() {
|
|
if(!initializeComplete) {
|
|
final options = BaseOptions(
|
|
baseUrl: 'http://10.50.222.152:19990',
|
|
connectTimeout: const Duration(seconds: 5),
|
|
receiveTimeout: const Duration(seconds: 3),
|
|
);
|
|
dio.options = options;
|
|
initializeComplete = true;
|
|
}
|
|
return dio;
|
|
}
|
|
|
|
/// 空载具入库
|
|
static Future<dynamic> emptyVehicleIn(String vehicleNo, {int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.post<String>(
|
|
"/api/mobile/stockIn/emptyVehicleIn",
|
|
data: jsonEncode({"vehicleNo": vehicleNo}),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
|
|
|
|
|
|
// ----------- 冷冻仓
|
|
|
|
|
|
|
|
|
|
|
|
/// 获取扫描的箱号的详细信息
|
|
static Future<dynamic> getGoodsDetail(String boxNo, {int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.get<String>(
|
|
'/api/mobile/stockIn/getGoodsDetail',
|
|
queryParameters: {"boxNo" : boxNo},
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
/// MES绑定入库
|
|
static Future<dynamic> bindingVehicleIn(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.post<String>(
|
|
"/api/mobile/stockIn/bindingVehicleIn",
|
|
data: jsonEncode(bindingVehicleData),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
/// 获取EBS入库单信息
|
|
static Future<dynamic> getCuxData({int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.get<String>(
|
|
"/api/mobile/stockIn/getCuxData",
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
|
|
/// EBS绑定入库
|
|
static Future<dynamic> bindingVehicleInEbsOld(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.post<String>(
|
|
"/api/mobile/stockIn/bindingVehicleInEbsOld",
|
|
data: jsonEncode(bindingVehicleData),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
static Future<dynamic> bindingVehicleInEbs(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
|
instance();
|
|
final response = await dio.post<String>(
|
|
"/api/mobile/stockIn/bindingVehicleInEbs",
|
|
data: jsonEncode(bindingVehicleData),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
)
|
|
);
|
|
return { "code" : response.statusCode, "data": response.data };
|
|
}
|
|
|
|
|
|
} |