TaskBarView.java
5.56 KB
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
package com.huaheng.mobilewms.view;
import android.content.Context;
import android.content.DialogInterface;
import android.support.constraint.ConstraintLayout;
import android.support.v7.app.AlertDialog;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.huaheng.mobilewms.R;
import com.huaheng.mobilewms.https.Subscribers.SubscriberOnNextListener;
import com.huaheng.mobilewms.util.WMSUtils;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class TaskBarView extends ConstraintLayout {
//备货入按钮
@BindView((R.id.btBeihuo))
Button bt_beihuo;
//二次分拣按钮
@BindView(R.id.btSecond)
Button bt_second;
@BindView(R.id.btSelectAll)
Button bt_selectAll;
List<TaskShipItemView> list;
public TaskBarView(Context context){
super(context);
LayoutInflater.from(context).inflate(R.layout.task_bar_view, this);
ButterKnife.bind(this);
}
@OnClick(R.id.btSelectAll)
public void selectAll(){
boolean all = true;
//all: 检查是否已经全选,已经完全的除外
for(TaskShipItemView v : list){
if(!v.isItemSelected() && !v.isDone()){
all = false;
}
}
//全选或全不选
for(TaskShipItemView v : list){
v.select(!all);
}
}
@OnClick(R.id.btBeihuo)
public void transfer(){
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
// builder.setIcon(R.drawable.ic_launcher);
builder.setTitle("备货入");
// 通过LayoutInflater来加载一个xml的布局文件作为一个View对象
View view = LayoutInflater.from(getContext()).inflate(R.layout.task_ship_dialog, null);
// 设置我们自己定义的布局文件作为弹出框的Content
builder.setView(view);
final EditText containerCode = (EditText)view.findViewById(R.id.containerCode);
final EditText qty = (EditText)view.findViewById(R.id.qty);
builder.setPositiveButton("确定", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
String a = containerCode.getText().toString().trim();
String b = qty.getText().toString().trim();
// 将输入的用户名和密码打印出来
Toast.makeText(getContext(), "用户名: " + a + ", 密码: " + b, Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
Toast.makeText(getContext(), "用户名: fsdfsd", Toast.LENGTH_SHORT).show();
}
});
builder.show();
containerCode.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if (null != keyEvent && KeyEvent.KEYCODE_ENTER == keyEvent.getKeyCode()) {
switch (keyEvent.getAction()) {
case KeyEvent.ACTION_UP:
qty.requestFocus();
return true;
default:
return true;
}
}
return false;
}
});
}
@OnClick(R.id.btSecond)
public void secondSorting(){
}
public void setList(List<TaskShipItemView> list){
this.list = list;
}
/**
* 获取被选中的任务明细
* @return
*/
public List getSelectTaskDetail(){
List list = new ArrayList();
for(TaskShipItemView v : this.list){
if(v.isItemSelected()){
list.add(v);
}
}
return list;
}
// /**
// /**备货入**/
// private void transfer(TaskDetail detail, String container) {
// HttpInterface.getInsstance().transfer(new ProgressSubscriber<String>(getContext(), transfersListener), detail.getId(), container);
// }
//
// /**批量备货入**/
// private void transfers(String taskHeadId) {
// HttpInterface.getInsstance().transfers(new ProgressSubscriber<String>(getContext(), transfersListener), taskHeadId);
// }
//
// /**二次分拣**/
// private void secondSorting(String taskHeadId, String container) {
// HttpInterface.getInsstance().secondSorting(new ProgressSubscriber<String>(getContext(), secondSortingListener), container);
// }
//
// /**批量二次分拣**/
// private void secondSortings(String taskHeadId) {
// HttpInterface.getInsstance().secondSortings(new ProgressSubscriber<String>(getContext(), secondSortingListener), taskHeadId);
// }
SubscriberOnNextListener secondSortingListener = new SubscriberOnNextListener<String>() {
@Override
public void onNext(String str) {
}
@Override
public void onError(String str) {
}
};
SubscriberOnNextListener transfersListener = new SubscriberOnNextListener<String>() {
@Override
public void onNext(String str) {
}
@Override
public void onError(String str) {
}
};
}