OnshellActivity.java
4.28 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
package com.huaheng.wms.onshell;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.huaheng.wms.R;
import com.huaheng.wms.collectgoods.BulkCollectActivity;
import com.huaheng.wms.model.CommonActivity;
import com.huaheng.wms.util.SoundUtils;
import com.huaheng.wms.util.WMSUtils;
import com.huaheng.wms.views.LineLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/*
** 上架
*/
public class OnshellActivity extends CommonActivity {
@BindView(R.id.onShellEdit)
EditText onShellEdit;
@BindView(R.id.onShellWnLayout)
LineLayout onShellWnLayout;
@BindView(R.id.onShellCnLayout)
LineLayout onShellCnLayout;
@BindView(R.id.onShellRecommandLayout)
LineLayout onShellRecommandLayout;
@BindView(R.id.onShellNumLayoutLayout)
LineLayout onShellNumLayoutLayout;
@BindView(R.id.onShellContentLayout)
LinearLayout onShellContentLayout;
@BindView(R.id.onShellEnsureBtn)
Button onShellEnsureBtn;
@BindView(R.id.onShellEnsureLayout)
LinearLayout onShellEnsureLayout;
private String cn;
private String sn;
private boolean isEnterCN = true;
@Override
protected void initActivityOnCreate(Bundle savedInstanceState) {
super.initActivityOnCreate(savedInstanceState);
setContentView(R.layout.activity_on_shell);
ButterKnife.bind(this);
setTitle(getString(R.string.on_the_shelf));
initView();
enableButton(false);
}
@OnClick({R.id.onShellEnsureLayout})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.onShellEnsureLayout:
if (isEnterCN) {
onShellEdit.setText("");
onShellEdit.requestFocus();
onShellEdit.setHint(R.string.enter_warehouse_number);
isEnterCN = false;
showLayout();
} else {
submit();
}
break;
}
}
private void initView() {
onShellEdit.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
String number = editable.toString();
if (number != null && number.length() > 0) {
if (isEnterCN) {
cn = number;
} else {
sn = number;
}
enableButton(true);
} else {
enableButton(false);
}
}
});
}
private void showLayout() {
String name = "MYR930S-X 立式饮水机 白色 S2平台网销机";
String postion = "A-01-02";
String number = "629";
onShellContentLayout.setVisibility(View.VISIBLE);
onShellWnLayout.setLineName(getString(R.string.commodity_barcode));
onShellWnLayout.setLineContent("21063020000038");
onShellCnLayout.setLineName(getString(R.string.commodity_name));
onShellCnLayout.setLineContent(name);
onShellRecommandLayout.setLineName(getString(R.string.recommended_library_position));
onShellRecommandLayout.setLineContent(postion);
onShellNumLayoutLayout.setLineName(getString(R.string.number_of_shelves));
onShellNumLayoutLayout.setLineContent(number);
}
private void enableButton(boolean enable) {
if (enable) {
onShellEnsureBtn.setBackgroundResource(R.drawable.blue_button_bg);
onShellEnsureLayout.setClickable(true);
} else {
onShellEnsureBtn.setBackgroundResource(R.drawable.gray_button_bg);
onShellEnsureLayout.setClickable(false);
}
}
private void submit() {
SoundUtils.getInstance(this).dingSound();
finish();
WMSUtils.startActivity(this, OnshellActivity.class);
}
}