1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
| import 'package:flutter/cupertino.dart';
| import 'package:flutter/material.dart';
| import 'package:get/get.dart';
| import 'package:zy_wms_pda/widgets/buttons/custom_elevated_button.dart';
|
| import '../../../common/bottom_bar.dart';
| import '../../../common/edit_card.dart';
| import '../../../common/main_card.dart';
| import '../../../common/scan_code.dart';
| import '../../../utile/iconfont.dart';
| import '../common/order_show_card.dart';
| import 'matdetls_edit_page.dart';
|
| class OrderPakinPage extends StatefulWidget {
| const OrderPakinPage({super.key});
|
| @override
| State<OrderPakinPage> createState() => _OrderPakinPageState();
| }
|
| class _OrderPakinPageState extends State<OrderPakinPage> {
| TextEditingController _barcodeController = TextEditingController();
| TextEditingController _zlController = TextEditingController();
| bool isFull = false;
| bool isFrozen = false;
| late List<Map<String, dynamic>> items = [];
|
| // 编辑按钮跳转
| void _edit(item) async {
| var result = await Get.to(() => MatDetlsEditPage(data: item));
| if (result!= null) {
| setState(() {
| items = result;
| });
| }
| }
|
| /// 重置按钮
| void _reset() {
| setState(() {});
| }
|
| @override
| Widget build(BuildContext context) {
| return Scaffold(
| appBar: AppBar(
| title: const Text('订单组托'),
| ),
| body: Center(
| child: Column(
| mainAxisSize: MainAxisSize.max,
| children: [
| SizedBox(height: 10),
| BarcodeInput(
| children: [
| BarCodeBox(labelText: '托盘码', hintText: '请输入托盘码', controller: _barcodeController),
| BarCodeBox(labelText: '制令号', hintText: '请输入制令号', controller: _zlController),
| Row(
| children: [
| SwitchBox(labelText: '是否满托',switchValue: isFull, onChanged: (bool value) {
| setState(() {
| isFull = value;
| });
| }),
| Spacer(),
| SwitchBox(labelText: '是否冻结',switchValue: isFrozen, onChanged: (bool value) {
| setState(() {
| isFrozen = value;
| });
| }),
| ],
| ),
| ],
| ),
| SizedBox(height: 10),
| EditCard(
| title: '编辑',
| type: Type.primary,
| btnSize: BtnSize.normal,
| onPressed: () => _edit(items)),
| SizedBox(height: 10),
| PageList(items),
| ],
| ),
| ),
| bottomNavigationBar: BottomBar(
| children: [
| CEBtn(
| title: '重置',
| type: Type.cancel,
| btnSize: BtnSize.large,
| onPressed: _reset),
| CEBtn(
| title: '组托',
| type: Type.second,
| btnSize: BtnSize.large,
| onPressed: () {
| print('组托');
| print('是否满托:$isFull');
| print('是否冻结:$isFrozen');
| print('托盘码:${_barcodeController.text}');
| print('制令号:${_zlController.text}');
| }),
| ],
| ),
| );
| }
| }
|
| Widget BarcodeInput({
| required List<Widget> children,
| }) {
| return MainCard(
| isPadding: true,
| child: Column(
| children: children,
| ),
| );
| }
|
| Widget PageList(items) {
| return Expanded(
| child: ListView.builder(
| itemCount: items.length,
| itemBuilder: (context, index) {
| // 定义边距
| double topPadding = index == 0 ? 8 : 4; // 第一个项目没有上边距
| double bottomPadding = index == 19 ? 8 : 4; // 最后一个项目没有下边距
| var item = items[index];
| return Padding(
| padding: EdgeInsets.only(top: topPadding, bottom: bottomPadding),
| child: OrderShowCard(
| index: index + 1,
| orderNo: item['orderNo'],
| matnr: item['matnr'],
| maktx: item['maktx'],
| count: item['count'],
|
| ), // 这里调用你的 ListItem 组件
| );
| },
| ),
| );
| }
|
| Widget BarCodeBox({
| String labelText = '托盘码',
| String hintText = '请输入托盘码',
| required TextEditingController controller,
| }) {
| return Container(
| // color: Colors.green,
| child: Row(
| children: [
| Text(
| '$labelText:',
| style: TextStyle(fontSize: 14, color: Colors.black),
| ),
| Expanded(
| child: TextField(
| controller: controller,
| decoration: InputDecoration(
| hintText: '$hintText',
| border: InputBorder.none,
| prefixIcon: IconButton(
| icon: const Icon(Iconfont.icon_saoma),
| onPressed: () async {
| var result = await Get.to(() => ScanCode());
| controller.text = result;
| },
| ),
| suffixIcon: IconButton(
| icon: const Icon(Icons.close),
| onPressed: () {controller.text = '';},
| ),
| contentPadding: const EdgeInsets.symmetric(
| horizontal: 0, vertical: 12), //调整垂直的内边距
| ),
| ),
| ),
| ],
| ),
| );
| }
|
| Widget SwitchBox({
| String labelText = '是否满托',
| bool switchValue = false,
| ValueChanged<bool>? onChanged,
| }) {
| return Container(
| // color: Colors.blue,
| child: Row(
| children: [
| Text(
| '$labelText:',
| style: TextStyle(fontSize: 14, color: Colors.black),
| ),
| Transform.scale(
| scale: 0.8,
| child: Switch(
| value: switchValue,
| onChanged: (bool value) {
| onChanged!(value);
| },
| ),
| ),
| ],
| ),
| );
| }
|
|