clean shit

This commit is contained in:
李宇奇 2025-02-24 15:52:03 +08:00
parent 910670c0cd
commit 5194d953ed
9 changed files with 288 additions and 361 deletions

View File

@ -6,8 +6,8 @@ class BaseDio {
static Dio instance() {
if (!initializeComplete) {
final options = BaseOptions(
// baseUrl: 'http://10.0.2.2:9990',
baseUrl: 'http://192.168.1.3:9990',
baseUrl: 'http://10.0.2.2:9990',
// baseUrl: 'http://192.168.1.3:9990',
connectTimeout: const Duration(seconds: 10),
receiveTimeout: const Duration(seconds: 5),
);

View File

@ -21,8 +21,8 @@ class StockInApi {
///
static Future<dynamic> emptyVehicleIn(String vehicleNo,
{int timeOut = 5000}) async {
final response =
await BaseDio.instance().post<String>("/system/storage/addEmpty?vehicleNo=$vehicleNo",
final response = await BaseDio.instance()
.post<String>("/system/storage/addEmpty?vehicleNo=$vehicleNo",
options: Options(
responseType: ResponseType.json,
sendTimeout: Duration(milliseconds: timeOut),
@ -32,13 +32,19 @@ class StockInApi {
}
///
static Future<dynamic> stockInComplete(List<StockInDataXuGong> stockInDataXuGong,
static Future<dynamic> stockInComplete(
List<StockInDataXuGong> stockInDataXuGong, String vehicleNo,
{int timeOut = 5000}) async {
logger.e("yuqili $stockInDataXuGong");
final stockInDataJson = stockInDataXuGong.map((item) => item.toJson()).toList();
final response = await BaseDio.instance()
.post<String>("/system/storage/addOtherList",
data: jsonEncode(stockInDataJson),
final stockInDataJson =
stockInDataXuGong.map((item) => item.toJson()).toList();
final request = {
"data": stockInDataJson,
"vehicleNo": vehicleNo
};
final response =
await BaseDio.instance().post<String>("/system/storage/addOtherList",
data: jsonEncode(request),
options: Options(
responseType: ResponseType.json,
sendTimeout: Duration(milliseconds: timeOut),

View File

@ -47,6 +47,7 @@ class StockOutApi {
"goodsDesc": "empty",
"spare1": uuidGen.v1(),
"spare2": uuidGen.v1(),
"orderStatus": 1,
}),
options: Options(
responseType: ResponseType.json,

View File

@ -47,7 +47,7 @@ class _StockInCardXuGongState extends State<StockInCardXuGong> {
});
}
),
BrnRichGridInfo('单据号:', item.orderId),
BrnRichGridInfo('单据号:', item.listId),
BrnRichGridInfo('单据类型:', item.orderType),
BrnRichGridInfo('客户名称:', item.customerName),
BrnRichGridInfo('物料描述:', item.goodsDesc),

View File

@ -1,127 +1,71 @@
import 'package:intl/intl.dart';
class StockInDataXuGong {
String recordId = "";
String listId = "";
String orderType = ""; //
String customerId = "";
String orderId = "test"; //
String vehicleNo = "";
String goodsId = ""; //
int goodsNum = 0; //
String goodsCode = "";
String goodsDesc = ""; //
String unit = "";
String spare1 = ""; // 1
String spare2 = ""; // 2
int status = 0;
int storageType = 0;
String createPerson = "empty";
String remark = "test";
DateTime createTime = DateTime.now();
DateTime updateTime = DateTime.now();
double weight = 0; //
String listId = ""; //
int orderType = 0; //
String customerName = ""; //
String size = ""; //
String containerNo = ""; //
String goodsDesc = ""; //
double weight = 0; //
int size = 0; //
String unit = ""; //
String spare1 = ""; // 1
String spare2 = ""; // 2
StockInDataXuGong({
required this.recordId,
required this.goodsId,
required this.goodsNum,
required this.orderId,
required this.orderType,
required this.goodsDesc,
required this.weight,
required this.size,
required this.customerName,
required this.containerNo,
required this.spare1,
required this.spare2,
required this.vehicleNo,
required this.customerId,
required this.goodsCode,
required this.listId,
required this.unit,
required this.status,
required this.storageType,
required this.createPerson,
required this.remark,
required this.createTime,
required this.updateTime,
});
// Updated fromJson method
factory StockInDataXuGong.fromJson(Map<String, dynamic> json) {
return StockInDataXuGong(
containerNo: json["containerNo"] ?? "0",
customerName: json["customerName"] ?? "",
listId: json["listId"] ?? "",
customerId: json["customerId"] ?? "",
recordId: json["recordId"] ?? "",
goodsId: json["goodsId"] ?? "",
//
vehicleNo: json["vehicleNo"] ?? "",
//
goodsNum: json["goodsNum"] ?? 10.0,
//
orderId: json["orderId"] ?? "",
//
orderType: json["orderType"] ?? "",
//
goodsCode: json["goodsCode"] ?? "",
// customerName: json["customerName"] ?? "", //
orderType: json["orderType"] ?? 0,
goodsDesc: json["goodsDesc"] ?? "",
//
// weight: json["weight"]?.toDouble() ?? 0.0, //
// size: json["size"] ?? "", //
// containerNo: json["containerNo"] ?? "",
//
spare1: json["spare1"] ?? "",
// 1
spare2: json["spare2"] ?? "",
// 2
unit: json["unit"] ?? "",
status: json["status"] ?? 0,
storageType: json["storageType"] ?? 0,
createPerson: json["createPerson"] ?? "",
remark: json["remark"] ?? "",
createTime: json["createTime"] ?? DateTime.now(),
updateTime: json["updateTime"] ?? DateTime.now(),
weight: json["weight"] ?? 10.0,
size: json["size"] ?? "50",
unit: json["unit"] ?? "",
);
}
// toJson
Map<String, dynamic> toJson() {
String formattedCreateDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(createTime);
String formattedUpdateDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(updateTime);
return {
"recordId": recordId,
"listId": listId,
"orderType": orderType,
"customerId": customerId,
"orderId": orderId,
"vehicleNo": vehicleNo,
"goodsId": goodsId,
"goodsNum": goodsNum,
"goodsCode": goodsCode,
"goodsDesc": goodsDesc,
"unit": unit,
"spare1": spare1,
"spare2": spare2,
"status": status,
"storageType": storageType,
"createPerson": createPerson,
"remark": remark,
"createTime": formattedCreateDate,
"updateTime": formattedUpdateDate,
"weight": weight,
"customerName": customerName,
"size": size,
"containerNo": containerNo,
"unit": unit,
};
}
}

View File

@ -26,55 +26,31 @@ class _InventoryCheckPageState extends State<InventoryCheckPage> {
// Filtering the data
filteredItems = [
StockInDataXuGong(
recordId: "0001",
vehicleNo: "11",
customerId: "111",
createTime: DateTime.now(),
updateTime: DateTime.now(),
goodsCode: "00001",
unit: "test",
listId: "1111",
unit: "",
status: 1,
storageType: 1,
createPerson: "system",
remark: "test",
goodsId: "001",
goodsNum: 5,
orderId: "order123",
orderType: "订购",
orderType: 1,
customerName: "Customer A",
goodsDesc: "Material 1 Description",
weight: 20.0,
size: "Small",
size: 10,
spare1: "Spare1A",
spare2: "Spare2A",
containerNo: "Container123"),
),
StockInDataXuGong(
recordId: "0001",
vehicleNo: "11",
customerId: "111",
createTime: DateTime.now(),
updateTime: DateTime.now(),
goodsCode: "00001",
unit: "test",
listId: "1111",
unit: "",
status: 1,
storageType: 1,
createPerson: "system",
remark: "test",
goodsId: "002",
goodsNum: 10,
orderId: "order456",
orderType: "订购",
orderType: 1,
customerName: "Customer B",
goodsDesc: "Material 2 Description",
weight: 15.5,
size: "Medium",
size: 10,
spare1: "Spare1B",
spare2: "Spare2B",
containerNo: "Container456"),
),
];
});
});
@ -113,7 +89,8 @@ class _InventoryCheckPageState extends State<InventoryCheckPage> {
}
void _completeInventoryCheck() {
DialogUtils.showSuccessMessage(context, "盘点完成", "所有物料已完成盘点", btnLabel: "我知道了");
DialogUtils.showSuccessMessage(context, "盘点完成", "所有物料已完成盘点",
btnLabel: "我知道了");
}
@override
@ -240,10 +217,8 @@ class _EditGoodPageState extends State<EditGoodPage> {
(value) => _editedItem.goodsId = value),
_buildEditableField("数量", _editedItem.goodsNum.toString(),
(value) => _editedItem.goodsNum = int.tryParse(value) ?? 0),
_buildEditableField("单据号", _editedItem.orderId,
(value) => _editedItem.orderId = value),
_buildEditableField("单据类型", _editedItem.orderType,
(value) => _editedItem.orderType = value),
_buildEditableField("单据类型", _editedItem.orderType.toString(),
(value) => _editedItem.orderType = int.parse(value)),
_buildEditableField("客户名称", _editedItem.customerName,
(value) => _editedItem.customerName = value),
_buildEditableField("描述", _editedItem.goodsDesc,
@ -251,7 +226,7 @@ class _EditGoodPageState extends State<EditGoodPage> {
_buildEditableField("重量", _editedItem.weight.toString(),
(value) => _editedItem.weight = double.tryParse(value) ?? 0.0),
_buildEditableField(
"尺寸", _editedItem.size, (value) => _editedItem.size = value),
"尺寸", _editedItem.size.toString(), (value) => _editedItem.size = int.parse(value)),
ElevatedButton(
onPressed: () {
widget.onSave(_editedItem);

View File

@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:wms_app/api_client/stock_in.dart';
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
import 'package:wms_app/utils/stringUtils.dart';
import '/common/colorCom.dart';
import 'package:tdesign_flutter/tdesign_flutter.dart';
@ -19,7 +20,7 @@ class StockInWheelEBS extends StatefulWidget {
class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
final _vehicleTextController = TextEditingController(); //
final _goodsCodeController = TextEditingController(); //
List<dynamic> packageData = []; //
List<StockInDataXuGong> packageData = []; //
int packageDataId = 0; //
@override
@ -258,21 +259,34 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
final item = data["data"] as dynamic;
setState(() {
packageDataId++;
packageData.add({
"id": packageDataId.toString(),
"segment1": codeData[0],
"itemId": codeData[1],
"batch": codeData[2],
"quantity": codeData[3],
"weight": codeData[4],
"productData": codeData[5],
"sendOrderId": sendOrderId, //
"goodsName": item["itemDesc"].toString(),
"unit": item["purUomCode"].toString(),
"poHeaderId": item["poHeaderId"].toString(),
"poLineId": item["poLineId"].toString(),
"lineLocationId": item["lineLocationId"].toString(),
});
// packageData.add({
// "id": packageDataId.toString(),
// "segment1": codeData[0],
// "itemId": codeData[1],
// "batch": codeData[2],
// "quantity": codeData[3],
// "weight": codeData[4],
// "productData": codeData[5],
// "sendOrderId": sendOrderId, //
// "goodsName": item["itemDesc"].toString(),
// "unit": item["purUomCode"].toString(),
// "poHeaderId": item["poHeaderId"].toString(),
// "poLineId": item["poLineId"].toString(),
// "lineLocationId": item["lineLocationId"].toString(),
// });
packageData.add(StockInDataXuGong(
goodsId: goodsId,
goodsNum: packageDataId,
listId: sendOrderId,
unit: "test",
orderType: 1,
customerName: "system",
goodsDesc: item["itemDesc"].toString(),
weight: double.parse(codeData[4]),
size: 10,
spare1: "test",
spare2: "test",
));
_goodsCodeController.clear();
});
return;
@ -302,11 +316,11 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
///
void delete(dynamic) {
setState(() {
packageData.removeWhere((r) {
return r["id"] == dynamic["id"];
});
});
// setState(() {
// packageData.removeWhere((r) {
// return r["id"] == dynamic["id"];
// });
// });
if (packageData.isEmpty) {
packageDataId = 0;
}
@ -320,10 +334,10 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
DialogUtils.showWarningMessage(context, "警告", "该文本框仅支持数字");
return;
}
setState(() {
packageData.where((w) => w["id"] == dynamic["id"]).first["quantity"] =
value;
});
// setState(() {
// packageData.where((w) => w["id"] == dynamic["id"]).first["quantity"] =
// value;
// });
});
}
@ -365,7 +379,8 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
confirmBtn: "继续", confirm: () {
int taskType = 1; // 1 2
BrnLoadingDialog.show(context, content: "正在请求入库");
StockInApi.stockInComplete(packageData).then((response) {
StockInApi.stockInComplete(packageData, vehicleNo)
.then((response) {
if (response["code"] != 200) {
var thisContext = context;
if (thisContext.mounted) {

View File

@ -9,6 +9,11 @@ import '../../utils/dialogUtils.dart';
import 'package:logger/logger.dart';
import 'package:uuid/uuid.dart';
Logger logger = Logger(
printer: PrettyPrinter(),
);
const Uuid uuidGen = Uuid();
class StockInBuy extends StatefulWidget {
const StockInBuy({super.key});
@ -18,10 +23,6 @@ class StockInBuy extends StatefulWidget {
class _StockInBuyState extends State<StockInBuy> {
List<StockInDataXuGong> stockInDataXuGong = [];
static var logger = Logger(
printer: PrettyPrinter(),
);
static var uuidGen = Uuid();
@override
void initState() {
@ -40,7 +41,8 @@ class _StockInBuyState extends State<StockInBuy> {
if (response["code"] != 200) {
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败", btnLabel: "我知道了");
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
btnLabel: "我知道了");
}
return;
}
@ -49,7 +51,8 @@ class _StockInBuyState extends State<StockInBuy> {
logger.e("yuqili2 $data");
final List<dynamic> res = data["rows"];
stockInDataXuGong = res.map((item) => StockInDataXuGong.fromJson(item)).toList();
stockInDataXuGong =
res.map((item) => StockInDataXuGong.fromJson(item)).toList();
}
@override
@ -96,8 +99,10 @@ class _StockInBuyState extends State<StockInBuy> {
children: [
Expanded(child: Text("物料号: ${item.goodsId}")),
Expanded(child: Text("数量: ${item.goodsNum}")),
Expanded(child: Text("描述: ${item.goodsDesc}")),
Expanded(child: Text("重量: ${item.weight} KG")),
Expanded(
child: Text("描述: ${item.goodsDesc}")),
Expanded(
child: Text("重量: ${item.weight} KG")),
Expanded(child: Text("尺寸: ${item.size}")),
IconButton(
icon: const Icon(Icons.add),
@ -144,7 +149,8 @@ class _StockInBuyState extends State<StockInBuy> {
if (updatedItem != null) {
setState(() {
final index = stockInDataXuGong.indexWhere((e) => e.goodsId == item.goodsId);
final index =
stockInDataXuGong.indexWhere((e) => e.goodsId == item.goodsId);
if (index != -1) {
stockInDataXuGong[index] = updatedItem; //
}
@ -152,8 +158,6 @@ class _StockInBuyState extends State<StockInBuy> {
}
}
void _addMaterial(StockInDataXuGong item) {
StockInApi.addStockIn(item).then((response) {
logger.e("yuqili $response");
@ -167,8 +171,7 @@ class _StockInBuyState extends State<StockInBuy> {
}
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
if (data["code"] == 200) {
DialogUtils.showSuccessMessage(context, "成功", "添加入库",
btnLabel: "我知道了");
DialogUtils.showSuccessMessage(context, "成功", "添加入库", btnLabel: "我知道了");
return;
}
}).catchError((err) {
@ -193,7 +196,8 @@ class _StockInBuyState extends State<StockInBuy> {
StockInApi.addCompleted(uuidGen.v4()).then((response) {
logger.e("yuqili $response");
if (response["code"] != 200) {
DialogUtils.showWarningMessage(context, "警告", "服务器请求失败", btnLabel: "我知道了");
DialogUtils.showWarningMessage(context, "警告", "服务器请求失败",
btnLabel: "我知道了");
return;
}
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
@ -204,10 +208,13 @@ class _StockInBuyState extends State<StockInBuy> {
DialogUtils.showSuccessMessage(context, "码盘成功", "", btnLabel: "我知道了");
} else {
DialogUtils.showWarningMessage(
context, "警告", "服务器返回失败:${data["message"]}", btnLabel: "我知道了");
context, "警告", "服务器返回失败:${data["message"]}",
btnLabel: "我知道了");
}
}).catchError((err) {
DialogUtils.showErrorMessage(context, "请求发生错误", "请求服务器发生错误:${err.toString()}", btnLabel: "我知道了");
DialogUtils.showErrorMessage(
context, "请求发生错误", "请求服务器发生错误:${err.toString()}",
btnLabel: "我知道了");
}).whenComplete(() {
BrnLoadingDialog.dismiss(context);
});
@ -217,6 +224,7 @@ class _StockInBuyState extends State<StockInBuy> {
class EditStockInPage extends StatefulWidget {
final StockInDataXuGong item;
const EditStockInPage({super.key, required this.item});
@override
@ -234,10 +242,12 @@ class _EditStockInPageState extends State<EditStockInPage> {
void initState() {
super.initState();
goodsIdController = TextEditingController(text: widget.item.goodsId);
goodsNumController = TextEditingController(text: widget.item.goodsNum.toString());
goodsNumController =
TextEditingController(text: widget.item.goodsNum.toString());
goodsDescController = TextEditingController(text: widget.item.goodsDesc);
weightController = TextEditingController(text: widget.item.weight.toString());
sizeController = TextEditingController(text: widget.item.size);
weightController =
TextEditingController(text: widget.item.weight.toString());
sizeController = TextEditingController(text: widget.item.size.toString());
}
@override
@ -251,39 +261,25 @@ class _EditStockInPageState extends State<EditStockInPage> {
}
void _saveEdits() {
// Create the updated item
String listId = uuidGen.v4();
StockInDataXuGong updatedItem = StockInDataXuGong(
recordId: "0001",
vehicleNo: "11",
customerId: "111",
createTime: DateTime.now(),
updateTime: DateTime.now(),
goodsCode: "00001",
listId: "1111",
unit: "",
status: 1,
storageType: 1,
createPerson: "system",
remark: "test",
listId: listId,
goodsId: goodsIdController.text,
goodsNum: int.parse(goodsNumController.text),
orderId: widget.item.orderId, // Retain the original value
orderType: widget.item.orderType, // Retain the original value
customerName: widget.item.customerName, // Retain the original value
orderType: widget.item.orderType,
customerName: widget.item.customerName,
goodsDesc: goodsDescController.text,
weight: double.parse(weightController.text),
size: sizeController.text,
spare1: widget.item.spare1, // Retain the original value
spare2: widget.item.spare2, // Retain the original value
containerNo: widget.item.containerNo, // Retain the original value
size: int.parse(sizeController.text),
unit: widget.item.unit,
spare1: widget.item.spare1,
spare2: widget.item.spare2,
);
// Pass the updated item back to the previous page
Navigator.of(context).pop(updatedItem);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -319,15 +315,8 @@ class _EditStockInPageState extends State<EditStockInPage> {
controller: sizeController,
decoration: const InputDecoration(labelText: '尺寸'),
),
// Non-editable fields styled to look like editable ones but greyed out
TextField(
controller: TextEditingController(text: widget.item.orderId),
decoration: const InputDecoration(labelText: "单据号"),
enabled: false,
style: TextStyle(color: Colors.grey),
),
TextField(
controller: TextEditingController(text: widget.item.orderType),
controller: TextEditingController(text: widget.item.orderType.toString()),
decoration: const InputDecoration(labelText: "单据类型"),
enabled: false,
style: TextStyle(color: Colors.grey),
@ -338,12 +327,6 @@ class _EditStockInPageState extends State<EditStockInPage> {
enabled: false,
style: TextStyle(color: Colors.grey),
),
TextField(
controller: TextEditingController(text: widget.item.containerNo),
decoration: const InputDecoration(labelText: "容器号"),
enabled: false,
style: TextStyle(color: Colors.grey),
),
TextField(
controller: TextEditingController(text: widget.item.spare1),
decoration: const InputDecoration(labelText: "备用1"),
@ -369,5 +352,3 @@ class _EditStockInPageState extends State<EditStockInPage> {
);
}
}

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:ffi';
import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
@ -25,13 +26,13 @@ class _StockInNormalState extends State<StockInNormal> {
final _vehicleTextController = TextEditingController(); //
final _goodsCodeController = TextEditingController(); //
final _goodsNumController = BrnStepsController();
final _orderNoController = TextEditingController();
final _listIdController = TextEditingController();
final _orderTypeController = TextEditingController();
final _customerIdController = TextEditingController();
final _customerNameController = TextEditingController();
final _goodsDescController = TextEditingController();
final _goodsUnitController = TextEditingController();
final _weightController = TextEditingController();
final _sizeController = TextEditingController();
final _containerNoController = TextEditingController();
final _spare1Controller = TextEditingController();
final _spare2Controller = TextEditingController();
@ -44,9 +45,11 @@ class _StockInNormalState extends State<StockInNormal> {
return Scaffold(
appBar: AppBar(
iconTheme: const IconThemeData(color: Colors.white),
leading: IconButton(onPressed: () {
leading: IconButton(
onPressed: () {
Navigator.of(context).pop();
}, icon: const Icon(Icons.arrow_back)),
},
icon: const Icon(Icons.arrow_back)),
centerTitle: true,
backgroundColor: ColorCommon.colorScheme,
title: const Text(
@ -54,10 +57,12 @@ class _StockInNormalState extends State<StockInNormal> {
style: TextStyle(color: Colors.white),
),
actions: [
TextButton(onPressed: () {},
TextButton(
onPressed: () {},
style: const ButtonStyle(
foregroundColor: WidgetStatePropertyAll(Colors.white)),
child: const Text("清空"),)
child: const Text("清空"),
)
],
),
body: Center(
@ -67,7 +72,8 @@ class _StockInNormalState extends State<StockInNormal> {
children: [
BrnTextInputFormItem(
controller: _goodsCodeController,
title: "物料号:", hint: "请输入或扫描物料号",
title: "物料号:",
hint: "请输入或扫描物料号",
isRequire: true,
),
BrnStepInputFormItem(
@ -76,26 +82,40 @@ class _StockInNormalState extends State<StockInNormal> {
value: goodsNum,
maxLimit: 9999,
isRequire: true,
canManualInput: true
),
canManualInput: true,
onChanged: (newValue, _) {
setState(() {
goodsNum = newValue;
});
}),
BrnTextInputFormItem(
controller: _orderNoController,
title: "单据号:", hint: "请输入或扫描单据号",
controller: _listIdController,
title: "单据号:",
hint: "请输入或扫描单据号",
isRequire: true,
),
BrnTextInputFormItem(
controller: _orderTypeController,
title: "单据类型:", hint: "请输入或扫描单据类型",
title: "单据类型:",
hint: "请输入或扫描单据类型",
isRequire: true,
),
BrnTextInputFormItem(
controller: _customerIdController,
title: "客户名称:", hint: "请输入或扫描客户名称",
controller: _customerNameController,
title: "客户名称:",
hint: "请输入或扫描客户名称",
isRequire: true,
),
BrnTextInputFormItem(
controller: _goodsDescController,
title: "物料描述:", hint: "请输入或扫描物料描述",
title: "物料描述:",
hint: "请输入或扫描物料描述",
isRequire: true,
),
BrnTextInputFormItem(
controller: _goodsUnitController,
title: "物料单位:",
hint: "请输入物料单位",
isRequire: true,
),
BrnTextInputFormItem(
@ -107,48 +127,48 @@ class _StockInNormalState extends State<StockInNormal> {
),
BrnTextInputFormItem(
controller: _sizeController,
title: "尺寸:", hint: "请输入或扫描尺寸",
title: "尺寸:",
hint: "请输入或扫描尺寸",
isRequire: true,
),
BrnTextInputFormItem(
controller: _spare1Controller,
title: "备用1", hint: "请输入",
title: "备用1",
hint: "请输入",
isRequire: true,
),
BrnTextInputFormItem(
controller: _spare2Controller,
title: "备用2", hint: "请输入",
title: "备用2",
hint: "请输入",
isRequire: true,
),
ElevatedButton(
onPressed: resolveCode,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
ColorCommon.colorScheme),
),
child: const Text(
"添加物料",
style: TextStyle(color: Colors.white))
backgroundColor:
WidgetStateProperty.all(ColorCommon.colorScheme),
),
child: const Text("添加物料",
style: TextStyle(color: Colors.white))),
BrnTextInputFormItem(
controller: _containerNoController,
title: "容器号:", hint: "",
controller: _vehicleTextController,
title: "容器号:",
hint: "",
isRequire: true,
),
Padding(padding: const EdgeInsets.only(top: 0),
Padding(
padding: const EdgeInsets.only(top: 0),
child: ElevatedButton(
onPressed: wheelComplete,
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(
ColorCommon.colorScheme),
backgroundColor:
WidgetStateProperty.all(ColorCommon.colorScheme),
),
child: const Text(
"码盘完成",
style: TextStyle(
color: Colors.white
))
)),
const Padding(padding: EdgeInsets.only(top: 10, bottom: 10),
child: const Text("码盘完成",
style: TextStyle(color: Colors.white)))),
const Padding(
padding: EdgeInsets.only(top: 10, bottom: 10),
child: Text("添加在载具的物料:"),
),
StockInCardXuGong(stockInDataXuGong: stockInDataXuGong)
@ -162,54 +182,41 @@ class _StockInNormalState extends State<StockInNormal> {
void resolveCode() {
setState(() {
stockInDataXuGong.add(StockInDataXuGong(
customerName: "yuqili",
containerNo: "0",
weight: 10,
size: "55",
listId: uuidGen.v4(),
goodsCode: "555",
unit: "",
status: 0,
storageType: 0,
createPerson: "system",
remark: "test",
orderType: _orderTypeController.text,
customerName: _customerNameController.text,
weight: double.parse(_weightController.text),
size: int.parse(_sizeController.text),
unit: _goodsUnitController.text,
listId: _listIdController.text,
orderType: int.parse(_orderTypeController.text),
goodsNum: goodsNum,
orderId: _orderNoController.text,
vehicleNo: "0",
goodsId: _goodsCodeController.text,
goodsDesc: _goodsDescController.text,
customerId: _customerIdController.text,
recordId: uuidGen.v4(),
createTime: DateTime.now(),
updateTime: DateTime.now(),
spare1: _spare1Controller.text,
spare2: _spare2Controller.text));
});
return;
}
///
void wheelComplete() {
if (stockInDataXuGong.isEmpty) {
DialogUtils.showWarningMessage(
context, "警告", "您的码盘数据为空", btnLabel: "确定");
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
return;
}
String vehicleNo = "1";
String vehicleNo = _vehicleTextController.text;
int dataCount = stockInDataXuGong.length;
DialogUtils.showConfirmMessage(
context, "码盘完成", "载具:$vehicleNo 码盘 $dataCount 条数据,是否继续?",
confirmBtn: "继续", confirm: () {
int taskType = 1; // 1 2
BrnLoadingDialog.show(context, content: "正在请求入库");
StockInApi.stockInComplete(stockInDataXuGong).then((response) {
StockInApi.stockInComplete(stockInDataXuGong, vehicleNo)
.then((response) {
if (response["code"] != 200) {
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showWarningMessage(
thisContext, "警告", "服务器请求失败", btnLabel: "我知道了");
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
btnLabel: "我知道了");
}
return;
}
@ -222,8 +229,8 @@ class _StockInNormalState extends State<StockInNormal> {
});
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showSuccessMessage(
thisContext, "码盘成功", "", btnLabel: "我知道了");
DialogUtils.showSuccessMessage(thisContext, "码盘成功", "",
btnLabel: "我知道了");
}
return;
}
@ -237,8 +244,9 @@ class _StockInNormalState extends State<StockInNormal> {
}).catchError((err) {
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showErrorMessage(thisContext, "请求发生错误",
"请求服务器发生错误:${err.toString()}", btnLabel: "我知道了");
DialogUtils.showErrorMessage(
thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()}",
btnLabel: "我知道了");
}
return;
}).whenComplete(() {
@ -252,22 +260,19 @@ class _StockInNormalState extends State<StockInNormal> {
///
getEmptyVehicle() {
DialogUtils.showConfirmMessage(
context, "空载具出库", "出一个空载具?", confirmBtn: "出一个",
confirm: () {
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, "警告", "服务器请求失败",
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
btnLabel: "我知道了");
}
return;
}
final data = Map<String, dynamic>.from(
jsonDecode(response["data"]));
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
if (data["code"] == 200) {
//
setState(() {
@ -276,8 +281,8 @@ class _StockInNormalState extends State<StockInNormal> {
});
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showSuccessMessage(
thisContext, "请求成功", "", btnLabel: "我知道了");
DialogUtils.showSuccessMessage(thisContext, "请求成功", "",
btnLabel: "我知道了");
}
return;
}
@ -291,8 +296,9 @@ class _StockInNormalState extends State<StockInNormal> {
}).catchError((err) {
var thisContext = context;
if (thisContext.mounted) {
DialogUtils.showErrorMessage(thisContext, "请求发生错误",
"请求服务器发生错误:${err.toString()}", btnLabel: "我知道了");
DialogUtils.showErrorMessage(
thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()}",
btnLabel: "我知道了");
}
return;
}).whenComplete(() {
@ -303,5 +309,4 @@ class _StockInNormalState extends State<StockInNormal> {
});
});
}
}