delete inTask
This commit is contained in:
parent
ead32cfa5f
commit
bebeea2c53
|
|
@ -18,7 +18,7 @@ class StockInEmpty extends StatefulWidget {
|
||||||
|
|
||||||
/// 空托入库界面
|
/// 空托入库界面
|
||||||
class _StockInEmptyPageState extends State<StockInEmpty> {
|
class _StockInEmptyPageState extends State<StockInEmpty> {
|
||||||
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
final _vehicleTextController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -71,19 +71,9 @@ class _StockInEmptyPageState extends State<StockInEmpty> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示加载对话框
|
|
||||||
BrnLoadingDialog.show(context,
|
BrnLoadingDialog.show(context,
|
||||||
content: "请稍后...", barrierDismissible: false);
|
content: "请稍后...", barrierDismissible: false);
|
||||||
|
_emptyVehicleIn(vehicleNo).then((isCreateInTaskSuccess) {
|
||||||
// 第一步:调用 emptyVehicleIn
|
|
||||||
_emptyVehicleIn(vehicleNo).then((isEmptyVehicleInSuccess) {
|
|
||||||
if (!isEmptyVehicleInSuccess) {
|
|
||||||
_dismissLoading();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 第二步:调用 createInTask
|
|
||||||
_createInTask(vehicleNo).then((isCreateInTaskSuccess) {
|
|
||||||
_dismissLoading();
|
_dismissLoading();
|
||||||
if (isCreateInTaskSuccess) {
|
if (isCreateInTaskSuccess) {
|
||||||
_showSuccessDialog("空托入库成功");
|
_showSuccessDialog("空托入库成功");
|
||||||
|
|
@ -95,10 +85,6 @@ class _StockInEmptyPageState extends State<StockInEmpty> {
|
||||||
_dismissLoading();
|
_dismissLoading();
|
||||||
_handleError(err);
|
_handleError(err);
|
||||||
});
|
});
|
||||||
}).catchError((err) {
|
|
||||||
_dismissLoading();
|
|
||||||
_handleError(err);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用 emptyVehicleIn 接口
|
// 调用 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) {
|
void _handleError(dynamic err) {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,10 @@ import 'package:bruno/bruno.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:uuid/uuid.dart';
|
import 'package:uuid/uuid.dart';
|
||||||
import 'package:wms_app/api_client/stock_in.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/component/card/stock_in_card_xugong.dart';
|
||||||
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
|
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
|
||||||
import '../../common/colorCom.dart';
|
import '../../common/colorCom.dart';
|
||||||
import '../../utils/dialogUtils.dart';
|
import '../../utils/dialogUtils.dart';
|
||||||
import '../../utils/stringUtils.dart';
|
|
||||||
|
|
||||||
class StockInNormal extends StatefulWidget {
|
class StockInNormal extends StatefulWidget {
|
||||||
const StockInNormal({super.key});
|
const StockInNormal({super.key});
|
||||||
|
|
@ -147,7 +145,7 @@ class _StockInNormalState extends State<StockInNormal> {
|
||||||
onPressed: resolveCode,
|
onPressed: resolveCode,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
WidgetStateProperty.all(ColorCommon.colorScheme),
|
WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||||
),
|
),
|
||||||
child: const Text("添加物料",
|
child: const Text("添加物料",
|
||||||
style: TextStyle(color: Colors.white))),
|
style: TextStyle(color: Colors.white))),
|
||||||
|
|
@ -163,7 +161,7 @@ class _StockInNormalState extends State<StockInNormal> {
|
||||||
onPressed: wheelComplete,
|
onPressed: wheelComplete,
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
WidgetStateProperty.all(ColorCommon.colorScheme),
|
WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||||
),
|
),
|
||||||
child: const Text("码盘完成",
|
child: const Text("码盘完成",
|
||||||
style: TextStyle(color: Colors.white)))),
|
style: TextStyle(color: Colors.white)))),
|
||||||
|
|
@ -199,7 +197,8 @@ class _StockInNormalState extends State<StockInNormal> {
|
||||||
|
|
||||||
void wheelComplete() {
|
void wheelComplete() {
|
||||||
if (stockInDataXuGong.isEmpty) {
|
if (stockInDataXuGong.isEmpty) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
DialogUtils.showWarningMessage(
|
||||||
|
context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,52 +213,26 @@ class _StockInNormalState extends State<StockInNormal> {
|
||||||
confirm: () {
|
confirm: () {
|
||||||
int taskType = 1; // 1 表示进库,2 表示进站台
|
int taskType = 1; // 1 表示进库,2 表示进站台
|
||||||
BrnLoadingDialog.show(context, content: "正在请求入库");
|
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||||
|
_stockInComplete(vehicleNo).then((isTaskSuccess) {
|
||||||
_stockInComplete(vehicleNo).then((isCompleteSuccess) {
|
_dismissLoading();
|
||||||
if (!isCompleteSuccess) {
|
if (isTaskSuccess) {
|
||||||
_dismissLoading();
|
_showSuccessDialog("入库成功");
|
||||||
return;
|
_clearData();
|
||||||
|
} else {
|
||||||
|
_showWarningDialog("创建任务失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
_createInTask(vehicleNo).then((isTaskSuccess) {
|
|
||||||
_dismissLoading();
|
|
||||||
if (isTaskSuccess) {
|
|
||||||
_showSuccessDialog("入库成功");
|
|
||||||
_clearData();
|
|
||||||
} else {
|
|
||||||
_showWarningDialog("创建任务失败");
|
|
||||||
}
|
|
||||||
}).catchError((err) {
|
|
||||||
_dismissLoading();
|
|
||||||
_handleError(err);
|
|
||||||
});
|
|
||||||
}).catchError((err) {
|
}).catchError((err) {
|
||||||
_dismissLoading();
|
_dismissLoading();
|
||||||
_handleError(err);
|
_handleError(err);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 完成入库请求
|
// 完成入库请求
|
||||||
Future<bool> _stockInComplete(String vehicleNo) async {
|
Future<bool> _stockInComplete(String vehicleNo) async {
|
||||||
try {
|
try {
|
||||||
var response = await StockInApi.stockInComplete(stockInDataXuGong, vehicleNo);
|
var response = await StockInApi.stockInComplete(
|
||||||
if (response["code"] != 200) {
|
stockInDataXuGong, vehicleNo);
|
||||||
_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);
|
|
||||||
if (response["code"] != 200) {
|
if (response["code"] != 200) {
|
||||||
_showWarningDialog("服务器请求失败");
|
_showWarningDialog("服务器请求失败");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -325,57 +298,4 @@ class _StockInNormalState extends State<StockInNormal> {
|
||||||
BrnLoadingDialog.dismiss(thisContext);
|
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> {
|
class _CallEmptyCartPageState extends State<StockOutEmpty> {
|
||||||
int availableVehiclesNum = 0; // 可用空托盘的数量
|
int availableVehiclesNum = 0;
|
||||||
bool isDataLoaded = false; // 用于标记数据是否已经加载过
|
bool isDataLoaded = false;
|
||||||
String goodsId = "0"; // 商品ID
|
String goodsId = "0";
|
||||||
int selectedQuantity = 1; // 用户选择的空托盘数量
|
int selectedQuantity = 1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_fetchAvailableVehicles(); // 获取所有可用空托盘的数量
|
_fetchAvailableVehicles();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _fetchAvailableVehicles() async {
|
Future<void> _fetchAvailableVehicles() async {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user