#
whycq
2025-03-03 6a90c5bde0facc8330ce4c7c7d89292717b7ac65
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
212
213
214
215
216
217
218
219
220
221
222
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:zy_wms_pda/common/number_stepper.dart';
 
import '../../../common/main_card.dart';
import '../../../widgets/buttons/custom_elevated_button.dart';
 
class OrderPickCard extends StatefulWidget {
  final ValueChanged onValueChanged;
  final String id;
  final String orderNo;
  final String orderStatus;
  final String matnr;
  final String maktx;
  final String threeCode;
  final String anfme;
  final String qty;
  final String count;
  final String createdTime;
  final bool isSelected;
  final Function(bool?) onSelected;
 
  const OrderPickCard({
    super.key,
    required this.onValueChanged,
    required this.onSelected,
    required this.id,
    required this.orderNo,
    required this.orderStatus,
    required this.matnr,
    required this.maktx,
    required this.threeCode,
    required this.anfme,
    required this.qty,
    required this.count,
    required this.createdTime,
    required this.isSelected,
  });
 
  @override
  State<OrderPickCard> createState() => _OrderPickCardState();
}
 
class _OrderPickCardState extends State<OrderPickCard> {
  // 维护一个变量来跟踪 Radio 的选中状态
  bool? _selectedOrderNo; // 可选中的订单编号
 
  @override
  Widget build(BuildContext context) {
    return MainCard(
      isPadding: false,
      child: Row(
        children: [
          // 添加 CheckBox 组件
          Checkbox(
            value: widget.isSelected, // 检查当前订单是否被选中
            onChanged: (bool? value) {
              widget.onSelected(value);
              // setState(() {
              //   if (_selectedOrderNo == widget.isSelected) {
              //     _selectedOrderNo = null; // 取消选中状态
              //   } else {
              //     _selectedOrderNo = widget.isSelected; // 否则选中当前订单
              //   }
              // });
            },
          ),
          Expanded(
              child: Container(
            padding: const EdgeInsets.only(right: 10, top: 10),
            child: Column(
              children: [
                Row(
                  children: [
                    Text(widget.orderNo,
                        style: TextStyle(fontSize: 12, color: Colors.black54)),
                    Container(
                      margin: EdgeInsets.only(left: 10),
                      padding: EdgeInsets.only(
                          left: 10, right: 10, top: 2, bottom: 2),
                      constraints: BoxConstraints(minWidth: 10),
                      decoration: BoxDecoration(
                        color: Colors.green,
                        borderRadius: BorderRadius.circular(10),
                      ),
                      child: Text('待作业',
                          style: TextStyle(fontSize: 10, color: Colors.white)),
                    ),
                    Spacer(),
                  ],
                ),
                Divider(
                  height: 10,
                  color: Colors.black12,
                ),
                Row(
                  children: [
                    Expanded(
                      child: Text(widget.maktx,
                          style: TextStyle(
                              fontSize: 16,
                              color: Colors.black,
                              fontWeight: FontWeight.bold),
                          softWrap: true,
                          overflow: TextOverflow.ellipsis,
                          maxLines: 3),
                    ),
                  ],
                ),
                Row(
                  children: [
                    Container(
                      decoration: BoxDecoration(
                        border: Border.all(color: Colors.black12, width: 0.5),
                        color: Colors.grey[100],
                        borderRadius: BorderRadius.circular(3),
                      ),
                      padding: const EdgeInsets.only(left: 5, right: 5),
                      child: Text('ID: ${widget.matnr}',
                          style:
                              TextStyle(fontSize: 12, color: Colors.black26)),
                    ),
                  ],
                ),
                Row(
                  children: [
                    Expanded(
                        child: Text('销售单号: ${widget.threeCode}',
                            style:
                                TextStyle(fontSize: 12, color: Colors.black54)))
                  ],
                ),
                Row(
                  children: [
                    Expanded(
                        child: Text('批号: 24090010',
                            style:
                                TextStyle(fontSize: 12, color: Colors.black54)))
                  ],
                ),
                Row(
                  children: [
                    Expanded(
                        child: Text('批号: 24090010',
                            style:
                                TextStyle(fontSize: 12, color: Colors.black54)))
                  ],
                ),
                Row(
                  children: [
                    Expanded(
                      child: Text('数量:',
                          style:
                              TextStyle(fontSize: 12, color: Colors.black54)),
                    ),
                  ],
                ),
                Row(
                  children: [
                    Expanded(
                      child: Container(
                        margin: const EdgeInsets.only(top: 5, bottom: 5),
                        padding: const EdgeInsets.all(6),
                        constraints: BoxConstraints(minHeight: 10),
                        decoration: BoxDecoration(
                          color: Colors.grey[200],
                          borderRadius: BorderRadius.circular(5),
                        ),
                        child: Row(
                          children: [
                            Expanded(
                                child: Center(
                              child: Text(
                                '总计: ${widget.anfme}',
                              ),
                            )),
                            Text('|'),
                            Expanded(
                                child: Center(
                              child: Text(
                                '已完成: ${widget.qty}',
                              ),
                            )),
                            Text('|'),
                            Expanded(
                                child: Center(
                              child: Text(
                                '待作业: ${double.parse(widget.anfme) - double.parse(widget.qty)}',
                              ),
                            )),
                          ],
                        ),
                      ),
                    ),
                  ],
                ),
                Row(
                  children: [
                    Text('创建时间:${widget.createdTime}',
                        style: TextStyle(fontSize: 12, color: Colors.black54)),
                    Spacer(),
                    Text('提取:',
                        style: TextStyle(fontSize: 12, color: Colors.black54)),
                    NumberStepper(
                      onValueChanged: (value) {
                        widget.onValueChanged(value);
                      },
                      defaultValue: double.parse(widget.count),
                      maxValue: (double.parse(widget.anfme) -
                          double.parse(widget.qty)),
                      minValue: 1.0,
                    )
                  ],
                ),
              ],
            ),
          )),
        ],
      ),
    );
  }
}