add check
This commit is contained in:
parent
ec2039d173
commit
b992f20cab
|
|
@ -6,6 +6,7 @@ import 'package:bruno/bruno.dart';
|
|||
import 'package:wms_app/page/stockIn/stock_in_empty.dart';
|
||||
import 'package:wms_app/page/stockIn/stock_in_buy.dart';
|
||||
import 'package:wms_app/page/stockOut/stock_out_empty.dart';
|
||||
import 'package:wms_app/page/stock/check.dart';
|
||||
import 'package:wms_app/page/pick/pick.dart';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
|
|
@ -78,7 +79,7 @@ class _HomePageState extends State<Home> {
|
|||
ListTile(
|
||||
title: const Text("物料盘点"),
|
||||
trailing: const Icon(Icons.checklist),
|
||||
onTap: () {})
|
||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const InventoryCheckPage()));}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
256
lib/page/stock/check.dart
Normal file
256
lib/page/stock/check.dart
Normal file
|
|
@ -0,0 +1,256 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
|
||||
import '../../common/colorCom.dart';
|
||||
import '../../utils/dialogUtils.dart';
|
||||
|
||||
class InventoryCheckPage extends StatefulWidget {
|
||||
const InventoryCheckPage({super.key});
|
||||
|
||||
@override
|
||||
State<InventoryCheckPage> createState() => _InventoryCheckPageState();
|
||||
}
|
||||
|
||||
class _InventoryCheckPageState extends State<InventoryCheckPage> {
|
||||
List<StockInDataXuGong> filteredItems = [];
|
||||
final TextEditingController goodsIdController = TextEditingController();
|
||||
final TextEditingController orderNoController = TextEditingController();
|
||||
final TextEditingController customerNameController = TextEditingController();
|
||||
final TextEditingController goodsDescController = TextEditingController();
|
||||
final TextEditingController weightController = TextEditingController();
|
||||
final TextEditingController sizeController = TextEditingController();
|
||||
|
||||
// Simulate fetching data (this would be an API call in a real-world scenario)
|
||||
void _fetchFilteredData() {
|
||||
Future.delayed(Duration(seconds: 1), () {
|
||||
setState(() {
|
||||
// Filtering the data
|
||||
filteredItems = [
|
||||
StockInDataXuGong(
|
||||
goodsId: "001",
|
||||
goodsNum: 5,
|
||||
orderNo: "order123",
|
||||
orderType: "订购",
|
||||
customerName: "Customer A",
|
||||
goodsDesc: "Material 1 Description",
|
||||
weight: 20.0,
|
||||
size: "Small",
|
||||
spare1: "Spare1A",
|
||||
spare2: "Spare2A",
|
||||
containerNo: "Container123"),
|
||||
StockInDataXuGong(
|
||||
goodsId: "002",
|
||||
goodsNum: 10,
|
||||
orderNo: "order456",
|
||||
orderType: "订购",
|
||||
customerName: "Customer B",
|
||||
goodsDesc: "Material 2 Description",
|
||||
weight: 15.5,
|
||||
size: "Medium",
|
||||
spare1: "Spare1B",
|
||||
spare2: "Spare2B",
|
||||
containerNo: "Container456"),
|
||||
];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Filtering logic (you can enhance this logic as per the requirements)
|
||||
void _filterItems() {
|
||||
String goodsId = goodsIdController.text;
|
||||
String orderNo = orderNoController.text;
|
||||
String customerName = customerNameController.text;
|
||||
String goodsDesc = goodsDescController.text;
|
||||
String weight = weightController.text;
|
||||
String size = sizeController.text;
|
||||
|
||||
// Perform the actual filtering (this is just a mock for now)
|
||||
_fetchFilteredData();
|
||||
}
|
||||
|
||||
void _editGood(StockInDataXuGong item) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => EditGoodPage(item: item, onSave: _updateGood),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _updateGood(StockInDataXuGong updatedItem) {
|
||||
setState(() {
|
||||
final index =
|
||||
filteredItems.indexWhere((e) => e.goodsId == updatedItem.goodsId);
|
||||
if (index != -1) {
|
||||
filteredItems[index] = updatedItem;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _completeInventoryCheck() {
|
||||
DialogUtils.showSuccessMessage(context, "盘点完成", "所有物料已完成盘点", btnLabel: "我知道了");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
leading: IconButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
centerTitle: true,
|
||||
backgroundColor: ColorCommon.colorScheme,
|
||||
title: const Text(
|
||||
"物料盘点",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
// Filtering Fields
|
||||
_buildEditableField("物料号", goodsIdController),
|
||||
_buildEditableField("单据号", orderNoController),
|
||||
_buildEditableField("客户名称", customerNameController),
|
||||
_buildEditableField("物料描述", goodsDescController),
|
||||
_buildEditableField("重量", weightController),
|
||||
_buildEditableField("尺寸", sizeController),
|
||||
|
||||
// Filter Button
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: ElevatedButton(
|
||||
onPressed: _filterItems,
|
||||
child: const Text("筛选"),
|
||||
),
|
||||
),
|
||||
|
||||
// Display filtered items
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: filteredItems.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = filteredItems[index];
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 5),
|
||||
child: ListTile(
|
||||
onTap: () => _editGood(item),
|
||||
title: Row(
|
||||
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.size}")),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// Complete Inventory Check Button
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: ElevatedButton(
|
||||
onPressed: _completeInventoryCheck,
|
||||
child: const Text("确认盘点"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditableField(String title, TextEditingController controller) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: title),
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class EditGoodPage extends StatefulWidget {
|
||||
final StockInDataXuGong item;
|
||||
final Function(StockInDataXuGong) onSave;
|
||||
|
||||
const EditGoodPage({super.key, required this.item, required this.onSave});
|
||||
|
||||
@override
|
||||
_EditGoodPageState createState() => _EditGoodPageState();
|
||||
}
|
||||
|
||||
class _EditGoodPageState extends State<EditGoodPage> {
|
||||
late StockInDataXuGong _editedItem;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_editedItem = widget.item;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("编辑物料"),
|
||||
backgroundColor: ColorCommon.colorScheme,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
_buildEditableField("物料号", _editedItem.goodsId,
|
||||
(value) => _editedItem.goodsId = value),
|
||||
_buildEditableField("数量", _editedItem.goodsNum.toString(),
|
||||
(value) => _editedItem.goodsNum = double.tryParse(value) ?? 0),
|
||||
_buildEditableField("单据号", _editedItem.orderNo,
|
||||
(value) => _editedItem.orderNo = value),
|
||||
_buildEditableField("单据类型", _editedItem.orderType,
|
||||
(value) => _editedItem.orderType = value),
|
||||
_buildEditableField("客户名称", _editedItem.customerName,
|
||||
(value) => _editedItem.customerName = value),
|
||||
_buildEditableField("描述", _editedItem.goodsDesc,
|
||||
(value) => _editedItem.goodsDesc = value),
|
||||
_buildEditableField("重量", _editedItem.weight.toString(),
|
||||
(value) => _editedItem.weight = double.tryParse(value) ?? 0.0),
|
||||
_buildEditableField(
|
||||
"尺寸", _editedItem.size, (value) => _editedItem.size = value),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
widget.onSave(_editedItem);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("保存修改"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildEditableField(
|
||||
String title, String initialValue, Function(String) onChanged) {
|
||||
TextEditingController controller =
|
||||
TextEditingController(text: initialValue);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: title),
|
||||
onChanged: onChanged,
|
||||
keyboardType: TextInputType.text,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user