189 lines
7.8 KiB
Dart
189 lines
7.8 KiB
Dart
|
|
import 'dart:convert';
|
|||
|
|
|
|||
|
|
import 'package:bruno/bruno.dart';
|
|||
|
|
import 'package:flutter/material.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});
|
|||
|
|
@override
|
|||
|
|
State<StockInWheelEBS> createState() => _StockInWheelEBSPageState();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// EBS码盘入库
|
|||
|
|
class _StockInWheelEBSPageState extends State<StockInWheelEBS> {
|
|||
|
|
|
|||
|
|
final _vehicleTextController = TextEditingController(); // 载具号输入框
|
|||
|
|
List<dynamic> tableData = []; // 表格数据类型
|
|||
|
|
int tableIndex = 0; // 序号
|
|||
|
|
int selectCount = 0; // 已选择的数量
|
|||
|
|
|
|||
|
|
@override
|
|||
|
|
void initState() {
|
|||
|
|
super.initState();
|
|||
|
|
tableData.add({
|
|||
|
|
"action":"",
|
|||
|
|
"id":"1",
|
|||
|
|
"vehicleNo":"测试"
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@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)),
|
|||
|
|
actions: [
|
|||
|
|
IconButton(onPressed: () {
|
|||
|
|
getTableData(); // 刷新表格按钮
|
|||
|
|
}, icon: const Icon(Icons.refresh))
|
|||
|
|
],
|
|||
|
|
centerTitle: true,
|
|||
|
|
backgroundColor: ColorCommon.colorScheme,
|
|||
|
|
title: const Text(
|
|||
|
|
"EBS成品入库",
|
|||
|
|
style: TextStyle(
|
|||
|
|
color: Colors.white
|
|||
|
|
),
|
|||
|
|
),
|
|||
|
|
),
|
|||
|
|
body: Center(
|
|||
|
|
child: Padding(padding: const EdgeInsets.only(
|
|||
|
|
top: 10,
|
|||
|
|
left: 10,
|
|||
|
|
right: 10,
|
|||
|
|
), child: ListView(
|
|||
|
|
children: [
|
|||
|
|
BrnTextInputFormItem(
|
|||
|
|
controller: _vehicleTextController,
|
|||
|
|
title: "载具号:", hint: "请扫描或输入"
|
|||
|
|
),
|
|||
|
|
BrnRadioInputFormItem(
|
|||
|
|
title: "选择目的地:",
|
|||
|
|
options: const ["立体库", "装箱线"],
|
|||
|
|
value: "立体库",
|
|||
|
|
onChanged: (oldValue, newValue) {
|
|||
|
|
BrnToast.show("点击触发回调${oldValue}_${newValue}_onChanged", context);
|
|||
|
|
},
|
|||
|
|
),
|
|||
|
|
Padding(padding: const EdgeInsets.only(
|
|||
|
|
top: 5
|
|||
|
|
), child: ElevatedButton(
|
|||
|
|
onPressed: wheelComplete,
|
|||
|
|
style: ButtonStyle(
|
|||
|
|
backgroundColor: WidgetStateProperty.all(ColorCommon.colorScheme),
|
|||
|
|
),
|
|||
|
|
child: const Text(
|
|||
|
|
"码盘完成",
|
|||
|
|
style: TextStyle(
|
|||
|
|
color: Colors.white
|
|||
|
|
))
|
|||
|
|
)),
|
|||
|
|
Padding(padding: const EdgeInsets.only(
|
|||
|
|
top: 10,
|
|||
|
|
bottom: 10
|
|||
|
|
), child: Text("已经载入的入库单(已选择:$selectCount):"),
|
|||
|
|
),
|
|||
|
|
Container(
|
|||
|
|
decoration: BoxDecoration(
|
|||
|
|
border: Border.all(color: const Color(0x4D0C0C05), width: 0.3),// border
|
|||
|
|
borderRadius: BorderRadius.circular((5)), // 圆角
|
|||
|
|
),
|
|||
|
|
child: TDTable(
|
|||
|
|
bordered: true,
|
|||
|
|
height: 300,
|
|||
|
|
width: MediaQuery.of(context).size.width,
|
|||
|
|
backgroundColor: Colors.transparent,
|
|||
|
|
columns: [
|
|||
|
|
TDTableCol(title: '*', colKey: 'action', width: 45, align: TDTableColAlign.center),
|
|||
|
|
TDTableCol(title: '序号', colKey: 'id', align: TDTableColAlign.center, width: 80),
|
|||
|
|
TDTableCol(title: '载具号', colKey: 'vehicleNo', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
|||
|
|
TDTableCol(title: '箱号', colKey: 'boxNo', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
|||
|
|
TDTableCol(title: '包装数量', colKey: 'goodsNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '产品编码', colKey: 'goodsId', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '每包数量', colKey: 'numPerBox', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '包数量', colKey: 'picketNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '零包数量', colKey: 'otherNum', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '销售订单', colKey: 'saleOrderNo', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '包装层级', colKey: 'packetLevel', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
TDTableCol(title: '周期', colKey: 'cycle', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
|||
|
|
TDTableCol(title: '客户销售订单', colKey: 'customSaleOrderNo', align: TDTableColAlign.center, ellipsis: true, width: 110),
|
|||
|
|
TDTableCol(title: '子库', colKey: 'minorWarehouseId', align: TDTableColAlign.center, ellipsis: true, width: 80),
|
|||
|
|
TDTableCol(title: '产品描述', colKey: 'goodsDesc', align: TDTableColAlign.center, ellipsis: true, width: 100),
|
|||
|
|
],
|
|||
|
|
data: tableData,
|
|||
|
|
onCellTap: (index, dynamic, cell) {
|
|||
|
|
if(cell.colKey == "action") {
|
|||
|
|
setState(() {
|
|||
|
|
final action = dynamic["action"];
|
|||
|
|
dynamic["action"] = action == "✓" ? "" : "✓";
|
|||
|
|
selectCount = tableData.where((w) => w["action"] == "✓").length;
|
|||
|
|
});
|
|||
|
|
} else {
|
|||
|
|
showDetails(index, dynamic);
|
|||
|
|
}
|
|||
|
|
}),
|
|||
|
|
)
|
|||
|
|
],
|
|||
|
|
)),
|
|||
|
|
),
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 获取入库单数据
|
|||
|
|
void getTableData() {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// 显示详细信息
|
|||
|
|
void showDetails(index, dynamic) {
|
|||
|
|
String goodsDetails = "";
|
|||
|
|
goodsDetails += "序号:${dynamic["id"]??""}\r\n";
|
|||
|
|
goodsDetails += "载具号:${dynamic["vehicleNo"]??""}\r\n";
|
|||
|
|
goodsDetails += "箱号:${dynamic["boxNo"]??""}\r\n";
|
|||
|
|
goodsDetails += "包装数量:${dynamic["goodsNum"]??""}\r\n";
|
|||
|
|
goodsDetails += "产品编码:${dynamic["goodsId"]??""}\r\n";
|
|||
|
|
goodsDetails += "每包数量:${dynamic["numPerBox"]??""}\r\n";
|
|||
|
|
goodsDetails += "包数量:${dynamic["picketNum"]??""}\r\n";
|
|||
|
|
goodsDetails += "零包数量:${dynamic["otherNum"]??""}\r\n";
|
|||
|
|
goodsDetails += "销售订单:${dynamic["saleOrderNo"]??""}\r\n";
|
|||
|
|
goodsDetails += "包装层级:${dynamic["packetLevel"]??""}\r\n";
|
|||
|
|
goodsDetails += "周期:${dynamic["cycle"]??""}\r\n";
|
|||
|
|
goodsDetails += "客户销售订单:${dynamic["customSaleOrderNo"]??""}\r\n";
|
|||
|
|
goodsDetails += "子库:${dynamic["minorWarehouseId"]??""}\r\n";
|
|||
|
|
goodsDetails += "产品描述:${dynamic["goodsDesc"]??""}";
|
|||
|
|
DialogUtils.showMessage(context, "详情", goodsDetails, btnLabel: "我知道了");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 码盘完成
|
|||
|
|
void wheelComplete() {
|
|||
|
|
if(tableData.isEmpty) {
|
|||
|
|
DialogUtils.showWarningMessage(context, "警告", "您当前没有待入库的入库单", btnLabel: "确定");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if(_vehicleTextController.text == "") {
|
|||
|
|
DialogUtils.showWarningMessage(context, "警告", "请先扫描载具号", btnLabel: "返回填写");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
List<dynamic> selectData = tableData.where((w) => w["action"] == "✓").toList();
|
|||
|
|
if(selectCount < 1) {
|
|||
|
|
DialogUtils.showWarningMessage(context, "警告", "您还没有选择入库单", btnLabel: "返回选择");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
DialogUtils.showConfirmMessage(context, "完成确认?", "当前选择了 $selectCount 条入库单,是否继续?", confirmBtn: "继续", confirm: (){
|
|||
|
|
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|