delete inTask
This commit is contained in:
parent
ead32cfa5f
commit
bebeea2c53
|
|
@ -18,7 +18,7 @@ class StockInEmpty extends StatefulWidget {
|
|||
|
||||
/// 空托入库界面
|
||||
class _StockInEmptyPageState extends State<StockInEmpty> {
|
||||
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
||||
final _vehicleTextController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -71,19 +71,9 @@ class _StockInEmptyPageState extends State<StockInEmpty> {
|
|||
return;
|
||||
}
|
||||
|
||||
// 显示加载对话框
|
||||
BrnLoadingDialog.show(context,
|
||||
content: "请稍后...", barrierDismissible: false);
|
||||
|
||||
// 第一步:调用 emptyVehicleIn
|
||||
_emptyVehicleIn(vehicleNo).then((isEmptyVehicleInSuccess) {
|
||||
if (!isEmptyVehicleInSuccess) {
|
||||
_dismissLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
// 第二步:调用 createInTask
|
||||
_createInTask(vehicleNo).then((isCreateInTaskSuccess) {
|
||||
_emptyVehicleIn(vehicleNo).then((isCreateInTaskSuccess) {
|
||||
_dismissLoading();
|
||||
if (isCreateInTaskSuccess) {
|
||||
_showSuccessDialog("空托入库成功");
|
||||
|
|
@ -95,10 +85,6 @@ class _StockInEmptyPageState extends State<StockInEmpty> {
|
|||
_dismissLoading();
|
||||
_handleError(err);
|
||||
});
|
||||
}).catchError((err) {
|
||||
_dismissLoading();
|
||||
_handleError(err);
|
||||
});
|
||||
}
|
||||
|
||||
// 调用 emptyVehicleIn 接口
|
||||
|
|
@ -116,35 +102,6 @@ class _StockInEmptyPageState extends State<StockInEmpty> {
|
|||
}
|
||||
}
|
||||
|
||||
// 调用 createInTask 接口
|
||||
Future<bool> _createInTask(String vehicleNo) async {
|
||||
try {
|
||||
var response = await StockInApi.createInTask([
|
||||
StockInDataXuGong(
|
||||
goodsId: "0",
|
||||
goodsNum: 1,
|
||||
goodsDesc: "空托",
|
||||
orderType: 1,
|
||||
weight: 10,
|
||||
size: 10,
|
||||
listId: uuidGen.v4(),
|
||||
unit: "个",
|
||||
customerName: "test",
|
||||
spare2: "test",
|
||||
spare1: "test")
|
||||
], vehicleNo);
|
||||
|
||||
if (response["code"] != 200) {
|
||||
_showWarningDialog("服务器请求失败");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (err) {
|
||||
_handleError(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 显示错误提示
|
||||
void _handleError(dynamic err) {
|
||||
var thisContext = context;
|
||||
|
|
|
|||
|
|
@ -5,12 +5,10 @@ import 'package:bruno/bruno.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'package:wms_app/api_client/stock_in.dart';
|
||||
import 'package:wms_app/api_client/stock_out.dart';
|
||||
import 'package:wms_app/component/card/stock_in_card_xugong.dart';
|
||||
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
|
||||
import '../../common/colorCom.dart';
|
||||
import '../../utils/dialogUtils.dart';
|
||||
import '../../utils/stringUtils.dart';
|
||||
|
||||
class StockInNormal extends StatefulWidget {
|
||||
const StockInNormal({super.key});
|
||||
|
|
@ -199,7 +197,8 @@ class _StockInNormalState extends State<StockInNormal> {
|
|||
|
||||
void wheelComplete() {
|
||||
if (stockInDataXuGong.isEmpty) {
|
||||
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
||||
DialogUtils.showWarningMessage(
|
||||
context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -214,14 +213,7 @@ class _StockInNormalState extends State<StockInNormal> {
|
|||
confirm: () {
|
||||
int taskType = 1; // 1 表示进库,2 表示进站台
|
||||
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||
|
||||
_stockInComplete(vehicleNo).then((isCompleteSuccess) {
|
||||
if (!isCompleteSuccess) {
|
||||
_dismissLoading();
|
||||
return;
|
||||
}
|
||||
|
||||
_createInTask(vehicleNo).then((isTaskSuccess) {
|
||||
_stockInComplete(vehicleNo).then((isTaskSuccess) {
|
||||
_dismissLoading();
|
||||
if (isTaskSuccess) {
|
||||
_showSuccessDialog("入库成功");
|
||||
|
|
@ -233,33 +225,14 @@ class _StockInNormalState extends State<StockInNormal> {
|
|||
_dismissLoading();
|
||||
_handleError(err);
|
||||
});
|
||||
}).catchError((err) {
|
||||
_dismissLoading();
|
||||
_handleError(err);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// 完成入库请求
|
||||
Future<bool> _stockInComplete(String vehicleNo) async {
|
||||
try {
|
||||
var response = await StockInApi.stockInComplete(stockInDataXuGong, vehicleNo);
|
||||
if (response["code"] != 200) {
|
||||
_showWarningDialog("服务器请求失败");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (err) {
|
||||
_handleError(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 创建入库任务
|
||||
Future<bool> _createInTask(String vehicleNo) async {
|
||||
try {
|
||||
var response = await StockInApi.createInTask(stockInDataXuGong, vehicleNo);
|
||||
var response = await StockInApi.stockInComplete(
|
||||
stockInDataXuGong, vehicleNo);
|
||||
if (response["code"] != 200) {
|
||||
_showWarningDialog("服务器请求失败");
|
||||
return false;
|
||||
|
|
@ -325,57 +298,4 @@ class _StockInNormalState extends State<StockInNormal> {
|
|||
BrnLoadingDialog.dismiss(thisContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 出一个空空箱
|
||||
getEmptyVehicle() {
|
||||
DialogUtils.showConfirmMessage(context, "空载具出库", "出一个空载具?",
|
||||
confirmBtn: "出一个", confirm: () {
|
||||
BrnLoadingDialog.show(context, content: "正在请求,请稍后");
|
||||
StockOutApi.getEmptyVehicle().then((response) {
|
||||
if (response["code"] != 200) {
|
||||
var thisContext = context;
|
||||
if (thisContext.mounted) {
|
||||
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
|
||||
btnLabel: "我知道了");
|
||||
}
|
||||
return;
|
||||
}
|
||||
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
|
||||
if (data["code"] == 200) {
|
||||
// 请求成功
|
||||
setState(() {
|
||||
_vehicleTextController.clear();
|
||||
stockInDataXuGong = [];
|
||||
});
|
||||
var thisContext = context;
|
||||
if (thisContext.mounted) {
|
||||
DialogUtils.showSuccessMessage(thisContext, "请求成功", "",
|
||||
btnLabel: "我知道了");
|
||||
}
|
||||
return;
|
||||
}
|
||||
var thisContext = context;
|
||||
if (thisContext.mounted) {
|
||||
DialogUtils.showWarningMessage(
|
||||
thisContext, "警告", "服务器返回失败:${data["message"]}",
|
||||
btnLabel: "我知道了");
|
||||
}
|
||||
return;
|
||||
}).catchError((err) {
|
||||
var thisContext = context;
|
||||
if (thisContext.mounted) {
|
||||
DialogUtils.showErrorMessage(
|
||||
thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()}",
|
||||
btnLabel: "我知道了");
|
||||
}
|
||||
return;
|
||||
}).whenComplete(() {
|
||||
var thisContext = context;
|
||||
if (thisContext.mounted) {
|
||||
BrnLoadingDialog.dismiss(thisContext);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -17,15 +17,15 @@ class StockOutEmpty extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _CallEmptyCartPageState extends State<StockOutEmpty> {
|
||||
int availableVehiclesNum = 0; // 可用空托盘的数量
|
||||
bool isDataLoaded = false; // 用于标记数据是否已经加载过
|
||||
String goodsId = "0"; // 商品ID
|
||||
int selectedQuantity = 1; // 用户选择的空托盘数量
|
||||
int availableVehiclesNum = 0;
|
||||
bool isDataLoaded = false;
|
||||
String goodsId = "0";
|
||||
int selectedQuantity = 1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_fetchAvailableVehicles(); // 获取所有可用空托盘的数量
|
||||
_fetchAvailableVehicles();
|
||||
}
|
||||
|
||||
Future<void> _fetchAvailableVehicles() async {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user