<update>添加EBS入库功能
|
|
@ -28,7 +28,7 @@ android {
|
|||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.wms.wms_app"
|
||||
applicationId = "com.wms.wms_app_bancai"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<application
|
||||
android:label="冷冻仓"
|
||||
android:label="板材仓"
|
||||
android:name="${applicationName}"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:icon="@mipmap/ic_launcher">
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 982 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 5.5 KiB |
|
|
@ -6,9 +6,10 @@ class BaseDio {
|
|||
static Dio instance() {
|
||||
if(!initializeComplete) {
|
||||
final options = BaseOptions(
|
||||
baseUrl: 'http://10.50.222.154:19990',
|
||||
connectTimeout: const Duration(seconds: 5),
|
||||
receiveTimeout: const Duration(seconds: 3),
|
||||
// 10.50.222.152
|
||||
baseUrl: 'http://10.50.222.152:19990',
|
||||
connectTimeout: const Duration(seconds: 10),
|
||||
receiveTimeout: const Duration(seconds: 5),
|
||||
);
|
||||
dio.options = options;
|
||||
initializeComplete = true;
|
||||
|
|
|
|||
38
lib/apiclient/stock_in.dart
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
import 'baseDio.dart';
|
||||
|
||||
class StockIn {
|
||||
|
||||
|
||||
/// 码盘完成
|
||||
static Future<dynamic> stockInComplete(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
||||
final response = await BaseDio.instance().post<String>(
|
||||
"/api/mobile/stockIn/bindingVehicleIn",
|
||||
data: jsonEncode(bindingVehicleData),
|
||||
options: Options(
|
||||
responseType: ResponseType.json,
|
||||
sendTimeout: Duration(milliseconds: timeOut),
|
||||
receiveTimeout: Duration(milliseconds: timeOut),
|
||||
)
|
||||
);
|
||||
return { "code" : response.statusCode, "data": response.data };
|
||||
}
|
||||
|
||||
/// 扫描之后从数据库获取EBS数据
|
||||
static Future<dynamic> getGoodsCanUse(String orderId, String goodsId, {int timeOut = 5000}) async {
|
||||
final response = await BaseDio.instance().post<String>(
|
||||
"/api/mobile/stockIn/getCanUseGoods",
|
||||
data: jsonEncode({"orderId": orderId, "goodsId": goodsId}),
|
||||
options: Options(
|
||||
responseType: ResponseType.json,
|
||||
sendTimeout: Duration(milliseconds: timeOut),
|
||||
receiveTimeout: Duration(milliseconds: timeOut),
|
||||
)
|
||||
);
|
||||
return { "code" : response.statusCode, "data": response.data };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -35,37 +35,10 @@ class WmsApiClient {
|
|||
}
|
||||
|
||||
|
||||
// -------- 冷冻仓
|
||||
/// 扫描之后从数据库获取数据
|
||||
static Future<dynamic> getGoodsCanUse(String orderId, String goodsId, {int timeOut = 5000}) async {
|
||||
instance();
|
||||
final response = await dio.post<String>(
|
||||
"/api/mobile/stockIn/getCanUseGoods",
|
||||
data: jsonEncode({"orderId": orderId, "goodsId": goodsId}),
|
||||
options: Options(
|
||||
responseType: ResponseType.json,
|
||||
sendTimeout: Duration(milliseconds: timeOut),
|
||||
receiveTimeout: Duration(milliseconds: timeOut),
|
||||
)
|
||||
);
|
||||
return { "code" : response.statusCode, "data": response.data };
|
||||
}
|
||||
|
||||
|
||||
// ----------- 冷冻仓
|
||||
/// 码盘入库
|
||||
static Future<dynamic> bindingVehicleInLD(dynamic bindingVehicleData, {int timeOut = 5000}) async {
|
||||
instance();
|
||||
final response = await dio.post<String>(
|
||||
"/api/mobile/stockIn/bindingVehicleIn",
|
||||
data: jsonEncode(bindingVehicleData),
|
||||
options: Options(
|
||||
responseType: ResponseType.json,
|
||||
sendTimeout: Duration(milliseconds: timeOut),
|
||||
receiveTimeout: Duration(milliseconds: timeOut),
|
||||
)
|
||||
);
|
||||
return { "code" : response.statusCode, "data": response.data };
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorCommon {
|
||||
static Color colorScheme = const Color(0xFF87a2fe); // 主题色
|
||||
static Color colorScheme = const Color(0xfffdbe5f); // 主题色
|
||||
}
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:wms_app/page/stockIn/stackInWheelEBS.dart';
|
||||
import '../stock/stockCheck.dart';
|
||||
import 'package:wms_app/page/stockIn/stack_in_ebs.dart';
|
||||
import 'package:wms_app/page/stockIn/stock_in_normal.dart';
|
||||
import '../stock/stock_check.dart';
|
||||
import '/common/colorCom.dart';
|
||||
import 'package:bruno/bruno.dart';
|
||||
import 'package:wms_app/page/stockIn/stockInEmpty.dart';
|
||||
import 'package:wms_app/page/stock/stockSearch.dart';
|
||||
import 'package:wms_app/page/stockIn/stock_in_empty.dart';
|
||||
import 'package:wms_app/page/stock/stock_search.dart';
|
||||
import 'package:wms_app/page/pick/pick.dart';
|
||||
|
||||
class Home extends StatefulWidget {
|
||||
|
|
@ -27,7 +28,7 @@ class _HomePageState extends State<Home> {
|
|||
centerTitle: true,
|
||||
backgroundColor: ColorCommon.colorScheme,
|
||||
title: const Text(
|
||||
"景旺WMS移动终端(冷冻)",
|
||||
"景旺WMS移动终端(板材)",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
),
|
||||
|
|
@ -48,10 +49,10 @@ class _HomePageState extends State<Home> {
|
|||
ListTile(title: const Text("空载具入库"), trailing: const Icon(Icons.grain), onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInEmpty()));
|
||||
}),
|
||||
// ListTile(title: const Text("MES成品入库"), trailing: const Icon(Icons.add_box), onTap: () {
|
||||
// Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInWheelMes()));
|
||||
// }),
|
||||
ListTile(title: const Text("码盘入库"), trailing: const Icon(Icons.add_box), onTap: () {
|
||||
ListTile(title: const Text("单机码盘入库"), trailing: const Icon(Icons.add_box), onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInNormal()));
|
||||
}),
|
||||
ListTile(title: const Text("EBS码盘入库"), trailing: const Icon(Icons.add_box), onTap: () {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const StockInWheelEBS()));
|
||||
}),
|
||||
ListTile(title: const Text("出库拣货"), trailing: const Icon(Icons.back_hand), onTap: () {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class _LoginPageState extends State<Login> {
|
|||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text(
|
||||
"请登录(景旺冷冻仓)",
|
||||
"请登录(景旺板材仓)",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
),
|
||||
|
|
@ -32,36 +32,36 @@ class _LoginPageState extends State<Login> {
|
|||
body: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Text("测试程序,禁止用于正式环境", style: TextStyle(color: Colors.redAccent)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 120,
|
||||
left: 50,
|
||||
right: 50,
|
||||
bottom: 10
|
||||
),
|
||||
child: TextField(
|
||||
controller: _userId,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "用户名:",
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
left: 50,
|
||||
right: 50,
|
||||
bottom: 10
|
||||
),
|
||||
child: TextField(
|
||||
controller: _userPwd,
|
||||
decoration: const InputDecoration(
|
||||
labelText: "密码:",
|
||||
),
|
||||
obscureText: true,
|
||||
),
|
||||
),
|
||||
//const Text("测试程序,禁止用于正式环境", style: TextStyle(color: Colors.redAccent)),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 120,
|
||||
// left: 50,
|
||||
// right: 50,
|
||||
// bottom: 10
|
||||
// ),
|
||||
// child: TextField(
|
||||
// controller: _userId,
|
||||
// decoration: const InputDecoration(
|
||||
// labelText: "用户名:",
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(
|
||||
// top: 0,
|
||||
// left: 50,
|
||||
// right: 50,
|
||||
// bottom: 10
|
||||
// ),
|
||||
// child: TextField(
|
||||
// controller: _userPwd,
|
||||
// decoration: const InputDecoration(
|
||||
// labelText: "密码:",
|
||||
// ),
|
||||
// obscureText: true,
|
||||
// ),
|
||||
// ),
|
||||
Padding( padding: const EdgeInsets.only(top: 15),
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
|
|
@ -71,28 +71,29 @@ class _LoginPageState extends State<Login> {
|
|||
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||
),
|
||||
child: const Text(
|
||||
"登录",
|
||||
"进入系统",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
))
|
||||
),
|
||||
)
|
||||
),
|
||||
Padding( padding: const EdgeInsets.only(top: 10),
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: ElevatedButton(
|
||||
onPressed: login,
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||
),
|
||||
child: const Text(
|
||||
"网络检测",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
))
|
||||
),
|
||||
))],
|
||||
// Padding( padding: const EdgeInsets.only(top: 10),
|
||||
// child: SizedBox(
|
||||
// width: 250,
|
||||
// child: ElevatedButton(
|
||||
// onPressed: login,
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||
// ),
|
||||
// child: const Text(
|
||||
// "网络检测",
|
||||
// style: TextStyle(
|
||||
// color: Colors.white
|
||||
// ))
|
||||
// ),
|
||||
// )),
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ class _PickPageState extends State<Pick> {
|
|||
const Padding(padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10
|
||||
), child: Text("需要拣货的物料(点击数据行修改拣货数):"),
|
||||
), child: Text("需要拣货的物料(点击实际拣货数修改拣货数):"),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ import 'dart:convert';
|
|||
|
||||
import 'package:bruno/bruno.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wms_app/apiclient/stock_in.dart';
|
||||
import 'package:wms_app/utils/stringUtils.dart';
|
||||
import '/common/colorCom.dart';
|
||||
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
||||
import 'package:wms_app/utils/dialogUtils.dart';
|
||||
import 'package:wms_app/apiclient/wmsApiClient.dart';
|
||||
|
||||
class StockInWheelEBS extends StatefulWidget {
|
||||
const StockInWheelEBS({super.key});
|
||||
|
|
@ -19,16 +19,8 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
|
||||
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
||||
final _goodsCodeController = TextEditingController(); // 条码输入框
|
||||
List<dynamic> tableData = []; // 表格数据类型
|
||||
List<dynamic> packageData = []; // 已经码盘的数据
|
||||
int packageDataId = 0; // 已经码盘的数据的序号
|
||||
List<BrnMultiSelectBottomPickerItem> list = [
|
||||
BrnMultiSelectBottomPickerItem("102", "库区1", isChecked: true),
|
||||
BrnMultiSelectBottomPickerItem("102", "库区2"),
|
||||
BrnMultiSelectBottomPickerItem("102", "库区3"),
|
||||
];
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -48,18 +40,13 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
centerTitle: true,
|
||||
backgroundColor: ColorCommon.colorScheme,
|
||||
title: const Text(
|
||||
"码盘入库",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
),
|
||||
"EBS码盘入库",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: Padding(padding: const EdgeInsets.only(
|
||||
top: 5,
|
||||
left: 10,
|
||||
right: 10,
|
||||
), child: ListView(
|
||||
child: Padding(padding: const EdgeInsets.only(top: 5, left: 10, right: 10),
|
||||
child: ListView(
|
||||
children: [
|
||||
BrnTextInputFormItem(
|
||||
controller: _vehicleTextController,
|
||||
|
|
@ -84,23 +71,19 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
color: Colors.white
|
||||
))
|
||||
)),
|
||||
Padding(padding: const EdgeInsets.only(
|
||||
top: 0
|
||||
), child: ElevatedButton(
|
||||
Padding(padding: const EdgeInsets.only(top: 0),
|
||||
child: ElevatedButton(
|
||||
onPressed: wheelComplete,
|
||||
style: ButtonStyle(
|
||||
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
||||
),
|
||||
child: const Text(
|
||||
"码盘完成",
|
||||
child: const Text("码盘完成",
|
||||
style: TextStyle(
|
||||
color: Colors.white
|
||||
))
|
||||
)),
|
||||
const Padding(padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10
|
||||
), child: Text("添加在载具的物料:"),
|
||||
const Padding(padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: Text("已码物料:"),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
|
|
@ -130,10 +113,7 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
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: 'area', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
||||
TDTableCol(title: '送货单号', colKey: 'sendOrderId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
||||
TDTableCol(title: 'WMS批次', colKey: 'goodsTypeId', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100),
|
||||
TDTableCol(title: '供应商批次', colKey: 'pruBatch', 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),
|
||||
|
|
@ -184,7 +164,7 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
String orderId = codeData[0];
|
||||
String goodsId = codeData[1];
|
||||
BrnLoadingDialog.show(context, content: "正在请求服务器数据");
|
||||
WmsApiClient.getGoodsCanUse(orderId, goodsId).then((response){
|
||||
StockIn.getGoodsCanUse(orderId, goodsId).then((response){
|
||||
if(response["code"] != 200) {
|
||||
var thisContext = context;
|
||||
if(thisContext.mounted) {
|
||||
|
|
@ -205,12 +185,9 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
"quantity": codeData[3],
|
||||
"weight": codeData[4],
|
||||
"productData": codeData[5],
|
||||
"area": item["storageAreaId"].toString(),
|
||||
"sendOrderId": sendOrderId, // 送货单号
|
||||
"goodsTypeId":item["goodsTypeId"].toString(),
|
||||
"pruBatch": item["pruBatch"].toString(),
|
||||
"goodsName": item["goodsName"].toString(),
|
||||
"unit": item["unit"].toString(),
|
||||
"goodsName": item["itemDesc"].toString(),
|
||||
"unit": item["purUomCode"].toString(),
|
||||
"poHeaderId": item["poHeaderId"].toString(),
|
||||
"poLineId": item["poLineId"].toString(),
|
||||
"lineLocationId": item["lineLocationId"].toString(),
|
||||
|
|
@ -273,10 +250,7 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
message.add({"label":"数量:", "msg":tableRow["quantity"].toString()});
|
||||
message.add({"label":"重量:", "msg":tableRow["weight"].toString()});
|
||||
message.add({"label":"生产日期:", "msg":tableRow["productData"].toString()});
|
||||
message.add({"label":"库区:", "msg":tableRow["area"].toString()});
|
||||
message.add({"label":"送货单号:", "msg":tableRow["sendOrderId"].toString()});
|
||||
message.add({"label":"供应商批次:", "msg":tableRow["pruBatch"].toString()});
|
||||
message.add({"label":"WMS批次:", "msg":tableRow["goodsTypeId"].toString()});
|
||||
message.add({"label":"物料描述:", "msg":tableRow["goodsName"].toString()});
|
||||
message.add({"label":"单位:", "msg":tableRow["unit"].toString()});
|
||||
message.add({"label":"订单头主键:", "msg":tableRow["poHeaderId"].toString()});
|
||||
|
|
@ -301,7 +275,7 @@ class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
{
|
||||
int taskType = 1; // 1 表示进库,2 表示进站台
|
||||
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||
WmsApiClient.bindingVehicleInLD({
|
||||
StockIn.stockInComplete({
|
||||
"vehicleNo": vehicleNo,
|
||||
"inArea": taskType.toString(),
|
||||
"storageArea" : "",
|
||||
280
lib/page/stockIn/stock_in_normal.dart
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:bruno/bruno.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
||||
import 'package:wms_app/apiclient/stock_in.dart';
|
||||
|
||||
import '../../common/colorCom.dart';
|
||||
import '../../utils/dialogUtils.dart';
|
||||
import '../../utils/stringUtils.dart';
|
||||
|
||||
class StockInNormal extends StatefulWidget {
|
||||
const StockInNormal({super.key});
|
||||
|
||||
@override
|
||||
State<StockInNormal> createState() => _StockInNormalState();
|
||||
}
|
||||
|
||||
/// 通用普通码盘界面
|
||||
class _StockInNormalState extends State<StockInNormal> {
|
||||
|
||||
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
||||
final _goodsCodeController = TextEditingController(text: "5312452695,30601000080,24B7251524,1,0.481,20241128"); // 条码输入框
|
||||
List<dynamic> packageData = []; // 已经码盘的数据
|
||||
int packageDataId = 0; // 已经码盘的数据的序号
|
||||
|
||||
@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: Center(
|
||||
child: Padding(padding: const EdgeInsets.only(top: 5, left: 10, right: 10),
|
||||
child: ListView(
|
||||
children: [
|
||||
BrnTextInputFormItem(
|
||||
controller: _vehicleTextController,
|
||||
title: "载具号:", 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(
|
||||
"添加物料",
|
||||
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: 'deadLineData', align: TDTableColAlign.center, ellipsis: true, ellipsisTitle: true, width: 100)
|
||||
],
|
||||
data: packageData,
|
||||
onCellTap: (index, dynamic, cell) {
|
||||
clickLine(index, dynamic, cell);
|
||||
}),
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 解析条码
|
||||
void resolveCode() {
|
||||
String code = _goodsCodeController.text;
|
||||
if(StringUtils.isEmpty(code)) {
|
||||
DialogUtils.showWarningMessage(context, "警告", "条码文本框内无数据,请先扫描或者输入数据");
|
||||
return;
|
||||
}
|
||||
List<String> codeData = code.split(",");
|
||||
if(codeData.length != 6) {
|
||||
DialogUtils.showWarningMessage(context, "警告", "条码格式错误");
|
||||
return;
|
||||
}
|
||||
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]
|
||||
});
|
||||
_goodsCodeController.clear();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/// 码盘完成
|
||||
void wheelComplete() {
|
||||
if(packageData.isEmpty){
|
||||
DialogUtils.showWarningMessage(context, "警告", "您的码盘数据为空", btnLabel: "确定");
|
||||
return;
|
||||
}
|
||||
String vehicleNo = _vehicleTextController.text;
|
||||
if(StringUtils.isEmpty(vehicleNo)) {
|
||||
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号", btnLabel: "返回填写");
|
||||
return;
|
||||
}
|
||||
int dataCount = packageData.length;
|
||||
DialogUtils.showConfirmMessage(context, "码盘完成", "载具:$vehicleNo 码盘 $dataCount 条数据,是否继续?", confirmBtn: "继续", confirm: ()
|
||||
{
|
||||
int taskType = 1; // 1 表示进库,2 表示进站台
|
||||
BrnLoadingDialog.show(context, content: "正在请求入库");
|
||||
StockIn.stockInComplete({
|
||||
"vehicleNo": vehicleNo,
|
||||
"inArea": taskType.toString(),
|
||||
"storageArea" : "",
|
||||
"goods": packageData
|
||||
}).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();
|
||||
packageData = [];
|
||||
});
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// 行数据点击事件
|
||||
void clickLine(index, dynamic, cell) {
|
||||
if(cell.colKey == "action") { // 点击删除
|
||||
delete(dynamic);
|
||||
return;
|
||||
}
|
||||
if(cell.colKey == "quantity") { // 点击数量
|
||||
modifyNumber(index, dynamic);
|
||||
return;
|
||||
}
|
||||
showDetails(index, dynamic);
|
||||
}
|
||||
|
||||
/// 删除已经码盘的物料
|
||||
void delete(dynamic) {
|
||||
setState(() {
|
||||
packageData.removeWhere((r){
|
||||
return r["id"] == dynamic["id"];
|
||||
});
|
||||
});
|
||||
if(packageData.isEmpty) {
|
||||
packageDataId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// 修改数量
|
||||
void modifyNumber(index, dynamic) {
|
||||
DialogUtils.showInputMessage(context, "请输入要修改的数量", message: "仅支持数字", confirm: (value) {
|
||||
if(!StringUtils.isNumber(value)) {
|
||||
DialogUtils.showWarningMessage(context, "警告", "该文本框仅支持数字");
|
||||
return;
|
||||
}
|
||||
setState((){
|
||||
packageData.where((w)=>w["id"] == dynamic["id"]).first["quantity"] = value;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// 显示详细信息
|
||||
void showDetails(index, tableRow) {
|
||||
List<dynamic> message = [];
|
||||
message.add({"label":"序号:", "msg":tableRow["id"].toString()});
|
||||
message.add({"label":"采购单号:", "msg":tableRow["segment1"].toString()});
|
||||
message.add({"label":"物料号:", "msg":tableRow["itemId"].toString()});
|
||||
message.add({"label":"批次号:", "msg":tableRow["batch"].toString()});
|
||||
message.add({"label":"数量:", "msg":tableRow["quantity"].toString()});
|
||||
message.add({"label":"重量:", "msg":tableRow["weight"].toString()});
|
||||
message.add({"label":"生产日期:", "msg":tableRow["productData"].toString()});
|
||||
DialogUtils.showMessageList(context, "数据详情", message, btnLabel: "我知道了");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -25,8 +25,7 @@ class DialogUtils {
|
|||
label: btnLabel,
|
||||
title: title,
|
||||
messageWidget: BrnPairInfoTable(
|
||||
expandAtIndex: 4,
|
||||
isFolded: false,
|
||||
expandAtIndex: -1,
|
||||
children: msg,
|
||||
),
|
||||
onTap: () {
|
||||
|
|
|
|||