add countAvailable flutter
This commit is contained in:
parent
a719927536
commit
910670c0cd
|
|
@ -6,9 +6,8 @@ class BaseDio {
|
||||||
static Dio instance() {
|
static Dio instance() {
|
||||||
if (!initializeComplete) {
|
if (!initializeComplete) {
|
||||||
final options = BaseOptions(
|
final options = BaseOptions(
|
||||||
// http://10.50.222.152:19990',
|
// baseUrl: 'http://10.0.2.2:9990',
|
||||||
// baseUrl: 'http://localhost:8080',
|
baseUrl: 'http://192.168.1.3:9990',
|
||||||
baseUrl: 'http://10.0.2.2:9990',
|
|
||||||
connectTimeout: const Duration(seconds: 10),
|
connectTimeout: const Duration(seconds: 10),
|
||||||
receiveTimeout: const Duration(seconds: 5),
|
receiveTimeout: const Duration(seconds: 5),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
25
lib/api_client/monitor.dart
Normal file
25
lib/api_client/monitor.dart
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
|
||||||
|
import 'baseDio.dart';
|
||||||
|
|
||||||
|
import 'package:logger/logger.dart';
|
||||||
|
|
||||||
|
class MonitorApi {
|
||||||
|
static var logger = Logger(
|
||||||
|
printer: PrettyPrinter(),
|
||||||
|
);
|
||||||
|
|
||||||
|
static Future<dynamic> countAvailable({int timeOut = 5000}) async {
|
||||||
|
final response =
|
||||||
|
await BaseDio.instance().get<String>("/app/location/count",
|
||||||
|
options: Options(
|
||||||
|
responseType: ResponseType.json,
|
||||||
|
sendTimeout: Duration(milliseconds: timeOut),
|
||||||
|
receiveTimeout: Duration(milliseconds: timeOut),
|
||||||
|
));
|
||||||
|
logger.e("yuqili $response");
|
||||||
|
return {"code": response.statusCode, "data": response.data};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
|
import 'dart:convert';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:logger/logger.dart';
|
||||||
|
import 'package:wms_app/api_client/monitor.dart';
|
||||||
import 'package:wms_app/page/stockIn/stock_in_normal.dart';
|
import 'package:wms_app/page/stockIn/stock_in_normal.dart';
|
||||||
import '../../common/user/login_user.dart';
|
import '../../common/user/login_user.dart';
|
||||||
|
import '../../utils/dialogUtils.dart';
|
||||||
import '/common/colorCom.dart';
|
import '/common/colorCom.dart';
|
||||||
import 'package:bruno/bruno.dart';
|
import 'package:bruno/bruno.dart';
|
||||||
import 'package:wms_app/page/stockIn/stock_in_empty.dart';
|
import 'package:wms_app/page/stockIn/stock_in_empty.dart';
|
||||||
|
|
@ -11,12 +15,16 @@ import 'package:wms_app/page/pick/pick.dart';
|
||||||
|
|
||||||
class Home extends StatefulWidget {
|
class Home extends StatefulWidget {
|
||||||
const Home({super.key});
|
const Home({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<Home> createState() => _HomePageState();
|
State<Home> createState() => _HomePageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HomePageState extends State<Home> {
|
class _HomePageState extends State<Home> {
|
||||||
|
var logger = Logger(
|
||||||
|
printer: PrettyPrinter(),
|
||||||
|
);
|
||||||
List<BrnDoughnutDataItem> stockChartsData = []; // 库存占用情况
|
List<BrnDoughnutDataItem> stockChartsData = []; // 库存占用情况
|
||||||
|
int available = 0, all = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
@ -52,15 +60,30 @@ class _HomePageState extends State<Home> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("货位信息码盘"),
|
title: const Text("货位信息码盘"),
|
||||||
trailing: const Icon(Icons.add_box),
|
trailing: const Icon(Icons.add_box),
|
||||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInNormal()));}),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const StockInNormal()));
|
||||||
|
}),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("采购有货入库"),
|
title: const Text("采购有货入库"),
|
||||||
trailing: const Icon(Icons.add_box),
|
trailing: const Icon(Icons.add_box),
|
||||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInBuy()));}),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const StockInBuy()));
|
||||||
|
}),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("其他物料入库"),
|
title: const Text("其他物料入库"),
|
||||||
trailing: const Icon(Icons.add_box),
|
trailing: const Icon(Icons.add_box),
|
||||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInNormal()));}),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const StockInNormal()));
|
||||||
|
}),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("生产配盘入库"),
|
title: const Text("生产配盘入库"),
|
||||||
trailing: const Icon(Icons.add_box),
|
trailing: const Icon(Icons.add_box),
|
||||||
|
|
@ -68,7 +91,12 @@ class _HomePageState extends State<Home> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("呼叫空托"),
|
title: const Text("呼叫空托"),
|
||||||
trailing: const Icon(Icons.ac_unit),
|
trailing: const Icon(Icons.ac_unit),
|
||||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const StockOutEmpty()));}),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const StockOutEmpty()));
|
||||||
|
}),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("出库拣货"),
|
title: const Text("出库拣货"),
|
||||||
trailing: const Icon(Icons.back_hand),
|
trailing: const Icon(Icons.back_hand),
|
||||||
|
|
@ -79,7 +107,12 @@ class _HomePageState extends State<Home> {
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("物料盘点"),
|
title: const Text("物料盘点"),
|
||||||
trailing: const Icon(Icons.checklist),
|
trailing: const Icon(Icons.checklist),
|
||||||
onTap: () {Navigator.push(context, MaterialPageRoute(builder: (context) => const InventoryCheckPage()));}),
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const InventoryCheckPage()));
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -107,17 +140,49 @@ class _HomePageState extends State<Home> {
|
||||||
])));
|
])));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count() async {
|
||||||
|
BrnLoadingDialog.show(context); // 显示加载动画
|
||||||
|
|
||||||
|
MonitorApi.countAvailable().then((response) {
|
||||||
|
if (response["code"] != 200) {
|
||||||
|
DialogUtils.showWarningMessage(context, "警告", "服务器请求失败",
|
||||||
|
btnLabel: "我知道了");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final data = jsonDecode(response["data"]);
|
||||||
|
if (response["code"] == 200) {
|
||||||
|
setState(() {
|
||||||
|
available = data["data"]["available_count"];
|
||||||
|
all = data["data"]["total_count"];
|
||||||
|
stockChartsData = [
|
||||||
|
BrnDoughnutDataItem(value: available * 1.0, title: "空闲", color: Colors.green),
|
||||||
|
BrnDoughnutDataItem(value: (all - available) * 1.0, title: "占用", color: Colors.orange)
|
||||||
|
];
|
||||||
|
});
|
||||||
|
DialogUtils.showSuccessMessage(context, "计数成功", "", btnLabel: "我知道了");
|
||||||
|
} else {
|
||||||
|
DialogUtils.showWarningMessage(
|
||||||
|
context, "警告", "服务器返回失败:${response["message"]}",
|
||||||
|
btnLabel: "我知道了");
|
||||||
|
}
|
||||||
|
}).catchError((err) {
|
||||||
|
DialogUtils.showErrorMessage(
|
||||||
|
context, "请求发生错误", "请求服务器发生错误:${err.toString()}",
|
||||||
|
btnLabel: "我知道了");
|
||||||
|
}).whenComplete(() {
|
||||||
|
BrnLoadingDialog.dismiss(context); // 隐藏加载动画
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/// 刷新界面数据
|
/// 刷新界面数据
|
||||||
refreshData() {}
|
refreshData() {
|
||||||
|
count();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
setState(() {
|
count(); // 在初始化时调用count方法,加载数据并显示缓冲动画
|
||||||
stockChartsData = [
|
|
||||||
BrnDoughnutDataItem(value: 40, title: "空闲", color: Colors.green),
|
|
||||||
BrnDoughnutDataItem(value: 60, title: "占用", color: Colors.orange)
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,13 @@ import 'package:wms_app/utils/dialogUtils.dart';
|
||||||
|
|
||||||
class StockInWheelEBS extends StatefulWidget {
|
class StockInWheelEBS extends StatefulWidget {
|
||||||
const StockInWheelEBS({super.key});
|
const StockInWheelEBS({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StockInWheelEBS> createState() => _StockInWheelEBSPageState();
|
State<StockInWheelEBS> createState() => _StockInWheelEBSPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EBS码盘入库
|
/// EBS码盘入库
|
||||||
class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
|
|
||||||
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
||||||
final _goodsCodeController = TextEditingController(); // 条码输入框
|
final _goodsCodeController = TextEditingController(); // 条码输入框
|
||||||
List<dynamic> packageData = []; // 已经码盘的数据
|
List<dynamic> packageData = []; // 已经码盘的数据
|
||||||
|
|
@ -31,12 +31,12 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
iconTheme: const IconThemeData(
|
iconTheme: const IconThemeData(color: Colors.white),
|
||||||
color: Colors.white
|
leading: IconButton(
|
||||||
),
|
onPressed: () {
|
||||||
leading: IconButton(onPressed: () {
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
},
|
||||||
}, icon: const Icon(Icons.arrow_back)),
|
icon: const Icon(Icons.arrow_back)),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
backgroundColor: ColorCommon.colorScheme,
|
backgroundColor: ColorCommon.colorScheme,
|
||||||
title: const Text(
|
title: const Text(
|
||||||
|
|
@ -45,99 +45,179 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Padding(padding: const EdgeInsets.only(top: 5, left: 10, right: 10),
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 5, left: 10, right: 10),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
BrnTextInputFormItem(
|
BrnTextInputFormItem(
|
||||||
controller: _vehicleTextController,
|
controller: _vehicleTextController,
|
||||||
title: "载具号:", hint: "请扫描或输入",
|
title: "载具号:",
|
||||||
isRequire: true,
|
hint: "请扫描或输入",
|
||||||
),
|
isRequire: true,
|
||||||
BrnTextInputFormItem(
|
|
||||||
controller: _goodsCodeController,
|
|
||||||
title: "条码:", hint: "请扫描物料二维码",
|
|
||||||
isRequire: true,
|
|
||||||
),
|
|
||||||
Padding(padding: const EdgeInsets.only(
|
|
||||||
top: 5
|
|
||||||
), child: ElevatedButton(
|
|
||||||
onPressed: resolveCode,
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
|
||||||
),
|
),
|
||||||
child: const Text(
|
BrnTextInputFormItem(
|
||||||
"添加物料",
|
controller: _goodsCodeController,
|
||||||
style: TextStyle(
|
title: "条码:",
|
||||||
color: Colors.white
|
hint: "请扫描物料二维码",
|
||||||
))
|
isRequire: true,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 5),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: resolveCode,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||||
|
),
|
||||||
|
child: const Text("添加物料",
|
||||||
|
style: TextStyle(color: Colors.white)))),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 0),
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: wheelComplete,
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||||
|
),
|
||||||
|
child: const Text("码盘完成",
|
||||||
|
style: TextStyle(color: Colors.white)))),
|
||||||
|
const Padding(
|
||||||
|
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||||
|
child: Text("已码物料:"),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: const Color(0x4D0C0C05), width: 0.3), // border
|
||||||
|
borderRadius: BorderRadius.circular((5)), // 圆角
|
||||||
|
),
|
||||||
|
child: TDTable(
|
||||||
|
bordered: true,
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
columns: [
|
||||||
|
TDTableCol(
|
||||||
|
title: '*',
|
||||||
|
colKey: 'action',
|
||||||
|
width: 45,
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
cellBuilder: (BuildContext context) {
|
||||||
|
return const SizedBox(
|
||||||
|
child: Icon(TDIcons.delete,
|
||||||
|
color: Colors.redAccent, size: 10),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TDTableCol(
|
||||||
|
title: '序号',
|
||||||
|
colKey: 'id',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
width: 80),
|
||||||
|
TDTableCol(
|
||||||
|
title: '采购单号',
|
||||||
|
colKey: 'segment1',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '物料号',
|
||||||
|
colKey: 'itemId',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '批次号',
|
||||||
|
colKey: 'batch',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '数量',
|
||||||
|
colKey: 'quantity',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '重量',
|
||||||
|
colKey: 'weight',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '生产日期',
|
||||||
|
colKey: 'productData',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '送货单号',
|
||||||
|
colKey: 'sendOrderId',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '物料描述',
|
||||||
|
colKey: 'goodsName',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '单位',
|
||||||
|
colKey: 'unit',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '订单头主键',
|
||||||
|
colKey: 'poHeaderId',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '订单行主键',
|
||||||
|
colKey: 'poLineId',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
TDTableCol(
|
||||||
|
title: '发运行主键',
|
||||||
|
colKey: 'lineLocationId',
|
||||||
|
align: TDTableColAlign.center,
|
||||||
|
ellipsis: true,
|
||||||
|
ellipsisTitle: true,
|
||||||
|
width: 100),
|
||||||
|
],
|
||||||
|
data: packageData,
|
||||||
|
onCellTap: (index, dynamic, cell) {
|
||||||
|
clickLine(index, dynamic, cell);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
],
|
||||||
)),
|
)),
|
||||||
Padding(padding: const EdgeInsets.only(top: 0),
|
|
||||||
child: ElevatedButton(
|
|
||||||
onPressed: wheelComplete,
|
|
||||||
style: ButtonStyle(
|
|
||||||
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
|
||||||
),
|
|
||||||
child: const Text("码盘完成",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white
|
|
||||||
))
|
|
||||||
)),
|
|
||||||
const Padding(padding: EdgeInsets.only(top: 10, bottom: 10),
|
|
||||||
child: Text("已码物料:"),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: const Color(0x4D0C0C05), width: 0.3),// border
|
|
||||||
borderRadius: BorderRadius.circular((5)), // 圆角
|
|
||||||
),
|
|
||||||
child: TDTable(
|
|
||||||
bordered: true,
|
|
||||||
width: MediaQuery.of(context).size.width,
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
columns: [
|
|
||||||
TDTableCol(
|
|
||||||
title: '*',
|
|
||||||
colKey: 'action',
|
|
||||||
width: 45,
|
|
||||||
align: TDTableColAlign.center,
|
|
||||||
cellBuilder: (BuildContext context) {
|
|
||||||
return const SizedBox(
|
|
||||||
child: Icon(TDIcons.delete, color: Colors.redAccent, size: 10),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TDTableCol(title: '序号', colKey: 'id', align: TDTableColAlign.center, width: 80),
|
|
||||||
TDTableCol(title: '采购单号', colKey: 'segment1', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '物料号', colKey: 'itemId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '批次号', colKey: 'batch', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '数量', colKey: 'quantity', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '重量', colKey: 'weight', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '生产日期', colKey: 'productData', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '送货单号', colKey: 'sendOrderId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '物料描述', colKey: 'goodsName', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '单位', colKey: 'unit', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '订单头主键', colKey: 'poHeaderId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '订单行主键', colKey: 'poLineId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
TDTableCol(title: '发运行主键', colKey: 'lineLocationId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
|
||||||
],
|
|
||||||
data: packageData,
|
|
||||||
onCellTap: (index, dynamic, cell) {
|
|
||||||
clickLine(index, dynamic, cell);
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 行数据点击事件
|
/// 行数据点击事件
|
||||||
void clickLine(index, dynamic, cell) {
|
void clickLine(index, dynamic, cell) {
|
||||||
if(cell.colKey == "action") { // 点击删除
|
if (cell.colKey == "action") {
|
||||||
|
// 点击删除
|
||||||
delete(dynamic);
|
delete(dynamic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(cell.colKey == "quantity") { // 点击数量
|
if (cell.colKey == "quantity") {
|
||||||
|
// 点击数量
|
||||||
modifyNumber(index, dynamic);
|
modifyNumber(index, dynamic);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -147,36 +227,37 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
/// 解析条码
|
/// 解析条码
|
||||||
void resolveCode() {
|
void resolveCode() {
|
||||||
String code = _goodsCodeController.text;
|
String code = _goodsCodeController.text;
|
||||||
if(StringUtils.isEmpty(code)) {
|
if (StringUtils.isEmpty(code)) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "条码文本框内无数据,请先扫描或者输入数据");
|
DialogUtils.showWarningMessage(context, "警告", "条码文本框内无数据,请先扫描或者输入数据");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> codeData = code.split(",");
|
List<String> codeData = code.split(",");
|
||||||
if(codeData.length != 6 && codeData.length != 8) {
|
if (codeData.length != 6 && codeData.length != 8) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "条码格式错误");
|
DialogUtils.showWarningMessage(context, "警告", "条码格式错误");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 请求获取详细数据,发送订单号和物料号
|
// 请求获取详细数据,发送订单号和物料号
|
||||||
String sendOrderId = "";
|
String sendOrderId = "";
|
||||||
if(codeData.length == 7) {
|
if (codeData.length == 7) {
|
||||||
sendOrderId = codeData[6];
|
sendOrderId = codeData[6];
|
||||||
}
|
}
|
||||||
String orderId = codeData[0];
|
String orderId = codeData[0];
|
||||||
String goodsId = codeData[1];
|
String goodsId = codeData[1];
|
||||||
BrnLoadingDialog.show(context, content: "正在请求服务器数据");
|
BrnLoadingDialog.show(context, content: "正在请求服务器数据");
|
||||||
StockInApi.getGoodsCanUse(orderId, goodsId).then((response){
|
StockInApi.getGoodsCanUse(orderId, goodsId).then((response) {
|
||||||
if(response["code"] != 200) {
|
if (response["code"] != 200) {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if(thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败", btnLabel: "我知道了");
|
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
|
||||||
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
|
final data = Map<String, dynamic>.from(jsonDecode(response["data"]));
|
||||||
if(data["code"] == 200) {
|
if (data["code"] == 200) {
|
||||||
final item = data["data"] as dynamic;
|
final item = data["data"] as dynamic;
|
||||||
setState(() {
|
setState(() {
|
||||||
packageDataId ++;
|
packageDataId++;
|
||||||
packageData.add({
|
packageData.add({
|
||||||
"id": packageDataId.toString(),
|
"id": packageDataId.toString(),
|
||||||
"segment1": codeData[0],
|
"segment1": codeData[0],
|
||||||
|
|
@ -197,19 +278,23 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if(thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showWarningMessage(thisContext, "数据异常", "服务器返回错误:${data["message"]} ", btnLabel: "我知道了");
|
DialogUtils.showWarningMessage(
|
||||||
|
thisContext, "数据异常", "服务器返回错误:${data["message"]} ",
|
||||||
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}).catchError((err){
|
}).catchError((err) {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if(thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showErrorMessage(thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()} ", btnLabel: "我知道了");
|
DialogUtils.showErrorMessage(
|
||||||
|
thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()} ",
|
||||||
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}).whenComplete((){
|
}).whenComplete(() {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if(thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
BrnLoadingDialog.dismiss(thisContext);
|
BrnLoadingDialog.dismiss(thisContext);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -218,24 +303,26 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
/// 删除已经码盘的物料
|
/// 删除已经码盘的物料
|
||||||
void delete(dynamic) {
|
void delete(dynamic) {
|
||||||
setState(() {
|
setState(() {
|
||||||
packageData.removeWhere((r){
|
packageData.removeWhere((r) {
|
||||||
return r["id"] == dynamic["id"];
|
return r["id"] == dynamic["id"];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
if(packageData.isEmpty) {
|
if (packageData.isEmpty) {
|
||||||
packageDataId = 0;
|
packageDataId = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 修改数量
|
/// 修改数量
|
||||||
void modifyNumber(index, dynamic) {
|
void modifyNumber(index, dynamic) {
|
||||||
DialogUtils.showInputMessage(context, "请输入要修改的数量", message: "仅支持数字", confirm: (value) {
|
DialogUtils.showInputMessage(context, "请输入要修改的数量", message: "仅支持数字",
|
||||||
if(!StringUtils.isNumber(value)) {
|
confirm: (value) {
|
||||||
|
if (!StringUtils.isNumber(value)) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "该文本框仅支持数字");
|
DialogUtils.showWarningMessage(context, "警告", "该文本框仅支持数字");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState((){
|
setState(() {
|
||||||
packageData.where((w)=>w["id"] == dynamic["id"]).first["quantity"] = value;
|
packageData.where((w) => w["id"] == dynamic["id"]).first["quantity"] =
|
||||||
|
value;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -243,49 +330,47 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
/// 显示详细信息
|
/// 显示详细信息
|
||||||
void showDetails(index, tableRow) {
|
void showDetails(index, tableRow) {
|
||||||
List<dynamic> message = [];
|
List<dynamic> message = [];
|
||||||
message.add({"label":"序号:", "msg":tableRow["id"].toString()});
|
message.add({"label": "序号:", "msg": tableRow["id"].toString()});
|
||||||
message.add({"label":"采购单号:", "msg":tableRow["segment1"].toString()});
|
message.add({"label": "采购单号:", "msg": tableRow["segment1"].toString()});
|
||||||
message.add({"label":"物料号:", "msg":tableRow["itemId"].toString()});
|
message.add({"label": "物料号:", "msg": tableRow["itemId"].toString()});
|
||||||
message.add({"label":"批次号:", "msg":tableRow["batch"].toString()});
|
message.add({"label": "批次号:", "msg": tableRow["batch"].toString()});
|
||||||
message.add({"label":"数量:", "msg":tableRow["quantity"].toString()});
|
message.add({"label": "数量:", "msg": tableRow["quantity"].toString()});
|
||||||
message.add({"label":"重量:", "msg":tableRow["weight"].toString()});
|
message.add({"label": "重量:", "msg": tableRow["weight"].toString()});
|
||||||
message.add({"label":"生产日期:", "msg":tableRow["productData"].toString()});
|
message.add({"label": "生产日期:", "msg": tableRow["productData"].toString()});
|
||||||
message.add({"label":"送货单号:", "msg":tableRow["sendOrderId"].toString()});
|
message.add({"label": "送货单号:", "msg": tableRow["sendOrderId"].toString()});
|
||||||
message.add({"label":"物料描述:", "msg":tableRow["goodsName"].toString()});
|
message.add({"label": "物料描述:", "msg": tableRow["goodsName"].toString()});
|
||||||
message.add({"label":"单位:", "msg":tableRow["unit"].toString()});
|
message.add({"label": "单位:", "msg": tableRow["unit"].toString()});
|
||||||
message.add({"label":"订单头主键:", "msg":tableRow["poHeaderId"].toString()});
|
message.add({"label": "订单头主键:", "msg": tableRow["poHeaderId"].toString()});
|
||||||
message.add({"label":"订单行主键:", "msg":tableRow["poLineId"].toString()});
|
message.add({"label": "订单行主键:", "msg": tableRow["poLineId"].toString()});
|
||||||
message.add({"label":"发运行主键:", "msg":tableRow["lineLocationId"].toString()});
|
message
|
||||||
|
.add({"label": "发运行主键:", "msg": tableRow["lineLocationId"].toString()});
|
||||||
DialogUtils.showMessageList(context, "数据详情", message, btnLabel: "我知道了");
|
DialogUtils.showMessageList(context, "数据详情", message, btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 码盘完成
|
/// 码盘完成
|
||||||
void wheelComplete() {
|
void wheelComplete() {
|
||||||
if(packageData.isEmpty){
|
if (packageData.isEmpty) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String vehicleNo = _vehicleTextController.text;
|
String vehicleNo = _vehicleTextController.text;
|
||||||
if(StringUtils.isEmpty(vehicleNo)) {
|
if (StringUtils.isEmpty(vehicleNo)) {
|
||||||
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号", btnLabel: "返回填写");
|
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号",
|
||||||
|
btnLabel: "返回填写");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int dataCount = packageData.length;
|
int dataCount = packageData.length;
|
||||||
DialogUtils.showConfirmMessage(context, "码盘完成", "载具:$vehicleNo 码盘 $dataCount 条数据,是否继续?", confirmBtn: "继续", confirm: ()
|
DialogUtils.showConfirmMessage(
|
||||||
{
|
context, "码盘完成", "载具:$vehicleNo 码盘 $dataCount 条数据,是否继续?",
|
||||||
|
confirmBtn: "继续", confirm: () {
|
||||||
int taskType = 1; // 1 表示进库,2 表示进站台
|
int taskType = 1; // 1 表示进库,2 表示进站台
|
||||||
BrnLoadingDialog.show(context, content: "正在请求入库");
|
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||||
StockInApi.stockInComplete({
|
StockInApi.stockInComplete(packageData).then((response) {
|
||||||
"vehicleNo": vehicleNo,
|
|
||||||
"inArea": taskType.toString(),
|
|
||||||
"storageArea" : "",
|
|
||||||
"goods": packageData
|
|
||||||
}).then((response) {
|
|
||||||
if (response["code"] != 200) {
|
if (response["code"] != 200) {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if (thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showWarningMessage(
|
DialogUtils.showWarningMessage(thisContext, "警告", "服务器请求失败",
|
||||||
thisContext, "警告", "服务器请求失败", btnLabel: "我知道了");
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -298,8 +383,8 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
});
|
});
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if (thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showSuccessMessage(
|
DialogUtils.showSuccessMessage(thisContext, "码盘成功", "",
|
||||||
thisContext, "码盘成功", "", btnLabel: "我知道了");
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -313,8 +398,9 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
}).catchError((err) {
|
}).catchError((err) {
|
||||||
var thisContext = context;
|
var thisContext = context;
|
||||||
if (thisContext.mounted) {
|
if (thisContext.mounted) {
|
||||||
DialogUtils.showErrorMessage(thisContext, "请求发生错误",
|
DialogUtils.showErrorMessage(
|
||||||
"请求服务器发生错误:${err.toString()}", btnLabel: "我知道了");
|
thisContext, "请求发生错误", "请求服务器发生错误:${err.toString()}",
|
||||||
|
btnLabel: "我知道了");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}).whenComplete(() {
|
}).whenComplete(() {
|
||||||
|
|
@ -325,5 +411,4 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1+1"
|
version: "0.2.1+1"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user