112 lines
3.8 KiB
Dart
112 lines
3.8 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'baseDio.dart';
|
|
|
|
import 'package:logger/logger.dart';
|
|
|
|
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
|
|
|
|
import 'package:uuid/uuid.dart';
|
|
|
|
class StockInApi {
|
|
static var logger = Logger(
|
|
printer: PrettyPrinter(),
|
|
);
|
|
static var uuidGen = Uuid();
|
|
|
|
/// 空载具入库
|
|
static Future<dynamic> emptyVehicleIn(Object? request,
|
|
{int timeOut = 5000}) async {
|
|
final response = await BaseDio.instance()
|
|
.post<String>("/api/mobile/stockIn/emptyVehicleIn",
|
|
data: request,
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
));
|
|
return {"code": response.statusCode, "data": response.data};
|
|
}
|
|
|
|
/// 码盘完成
|
|
static Future<dynamic> stockInComplete(dynamic bindingVehicleData,
|
|
{int timeOut = 5000}) async {
|
|
final response = await BaseDio.instance()
|
|
.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> getGoodsCanUse(String orderId, String goodsId,
|
|
{int timeOut = 5000}) async {
|
|
final response = await BaseDio.instance()
|
|
.post<String>("/api/mobile/stockIn/getCanUseGoods",
|
|
data: jsonEncode({"orderId": orderId, "goodsId": goodsId}),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
));
|
|
return {"code": response.statusCode, "data": response.data};
|
|
}
|
|
|
|
static Future<dynamic> getAppOrderGoodsList({int timeOut = 5000}) async {
|
|
final response =
|
|
await BaseDio.instance().get<String>("/app/pmsOrderIn/list/inc/first",
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
));
|
|
return {"code": response.statusCode, "data": response.data};
|
|
}
|
|
|
|
static Future<dynamic> addStockIn(StockInDataXuGong item,
|
|
{int timeOut = 5000}) async {
|
|
final response = await BaseDio.instance().post<String>("/app/pmsOrderIn",
|
|
data: jsonEncode({
|
|
"listId": uuidGen.v4(),
|
|
"orderType": 0,
|
|
"customerId": uuidGen.v4(),
|
|
"orderId": "test",
|
|
"goodsId": item.goodsId,
|
|
"goodsNum": 0,
|
|
"goodsCode": uuidGen.v4(),
|
|
"goodsDesc": "test",
|
|
"unit": "test",
|
|
"spare1": item.spare1,
|
|
"spare2": item.spare2,
|
|
"orderStatus": 1,
|
|
}),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
));
|
|
logger.e("yuqili ${response.data}");
|
|
return {"code": response.statusCode, "data": response.data};
|
|
}
|
|
|
|
static Future<dynamic> addCompleted(String listId,
|
|
{int timeOut = 5000}) async {
|
|
final response = await BaseDio.instance().post<String>("/app/pmsOrderIn/add/completed",
|
|
data: jsonEncode({
|
|
"listId": listId,
|
|
}),
|
|
options: Options(
|
|
responseType: ResponseType.json,
|
|
sendTimeout: Duration(milliseconds: timeOut),
|
|
receiveTimeout: Duration(milliseconds: timeOut),
|
|
));
|
|
return {"code": response.statusCode, "data": response.data};
|
|
}
|
|
}
|