提交 077f5c5e authored 作者: lgd's avatar lgd

1.坩埚销售发货,选择筛选

2.TODO 供应订单三个功能测试,
上级 4d0224c9
......@@ -5,6 +5,7 @@ import android.os.Bundle;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
......@@ -127,40 +128,45 @@ public class SendApplyCrucibleChooseActivity extends WorkToolBarActivity {
return R.layout.activity_send_apply_choose;
}
@OnClick(R.id.tv_ok)
public void onViewClicked() {
submit();
}
private void submit() {
Map<Integer, Boolean> isChoose = productAdapter.getIsChoose();
boolean isHas = false;
List<AddStockChooseBean.RecordsBean> backList = new ArrayList<>();
for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
if (entry.getValue()) {
isHas = true;
backList.add(productList.get(entry.getKey()));
if (TextUtils.isEmpty(productList.get(entry.getKey()).getChooseNum()) ||
TextUtils.equals(productList.get(entry.getKey()).getChooseNum(), "0")) {
// Map<Integer, Boolean> isChoose = productAdapter.getIsChoose();
// boolean isHas = false;
// List<AddStockChooseBean.RecordsBean> backList = new ArrayList<>();
// for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
// if (entry.getValue()) {
// isHas = true;
// backList.add(productList.get(entry.getKey()));
// if (TextUtils.isEmpty(productList.get(entry.getKey()).getChooseNum()) ||
// TextUtils.equals(productList.get(entry.getKey()).getChooseNum(), "0")) {
// toast("请输入数量");
// return;
// }
// }
// }
List<AddStockChooseBean.RecordsBean> chooseList = productAdapter.getChooseList();
for (AddStockChooseBean.RecordsBean recordsBean : chooseList) {
if (TextUtils.isEmpty(recordsBean.getChooseNum()) ||
TextUtils.equals(recordsBean.getChooseNum(), "0")) {
toast("请输入数量");
return;
}
}
}
if (isHas) {
if (chooseList.size() != 0) {
if (new BigDecimal(Double.valueOf(tvPrice.getText().toString().split(": ")[1])).
compareTo(new BigDecimal(getIntent().getStringExtra("num"))) == 1) {
toast(String.format("可申请数量最大为%s", MathUtils.converData(getIntent().getStringExtra("num"), 3)));
return;
}
Intent intent = new Intent();
intent.putExtra("stock", JSON.toJSONString(backList));
intent.putExtra("stock", JSON.toJSONString(chooseList));
intent.putExtra("position", getIntent().getStringExtra("position"));
intent.putExtra("count", tvPrice.getText().toString().split(": ")[1]);
setResult(10002, intent);
finish();
} else {
toast("请选择来源仓库");
toast("请选择货品");
}
}
......@@ -183,12 +189,16 @@ public class SendApplyCrucibleChooseActivity extends WorkToolBarActivity {
private void changeNumAndPrice() {
String allPrice = "";
Map<Integer, Boolean> isChoose = productAdapter.getIsChoose();
for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
if (entry.getValue()) {
allPrice = MathUtils.add(allPrice, productList.get(entry.getKey()).getChooseNum(), 3);
}
List<AddStockChooseBean.RecordsBean> chooseList = productAdapter.getChooseList();
for (AddStockChooseBean.RecordsBean recordsBean : chooseList) {
allPrice = MathUtils.add(allPrice, recordsBean.getChooseNum(), 3);
}
// Map<Integer, Boolean> isChoose = productAdapter.getIsChoose();
// for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
// if (entry.getValue()) {
// allPrice = MathUtils.add(allPrice, productList.get(entry.getKey()).getChooseNum(), 3);
// }
// }
tvPrice.setText("小计: ".concat(allPrice));
}
......@@ -214,8 +224,8 @@ public class SendApplyCrucibleChooseActivity extends WorkToolBarActivity {
List<AddStockChooseBean.RecordsBean> getList = JSON.parseObject(data.getData().toString(), AddStockChooseBean.class).getRecords();
productList.clear();
productList.addAll(getList);
productAdapter.notifyDataSetChanged();
changeChooseStatue();
productAdapter.notifyData();
// changeChooseStatue();
// if (page == 1) {
// productList.clear();
// productList.addAll(getList);
......@@ -252,4 +262,18 @@ public class SendApplyCrucibleChooseActivity extends WorkToolBarActivity {
}
@OnClick({R.id.tv_ok, R.id.btn_search})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_ok:
submit();
break;
case R.id.btn_search:
page = 1;
param.put("stockName", etKey.getText().toString());
param.put("current", page);
getData();
break;
}
}
}
......@@ -16,6 +16,7 @@ import com.wd.workoffice.widget.AddAndReduceView;
import org.greenrobot.eventbus.EventBus;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -27,6 +28,8 @@ import java.util.Map;
public class SendApplyCrucibleChooseAdapter extends BaseQuickAdapter<AddStockChooseBean.RecordsBean, BaseViewHolder> {
int type;// 0 新增选择 1 新增展示 2 详情
List<AddStockChooseBean.RecordsBean> chooseList = new ArrayList<>();
Map<Integer, Boolean> isChoose = new LinkedHashMap<>();
public SendApplyCrucibleChooseAdapter(int layoutResId, List data) {
......@@ -69,6 +72,11 @@ public class SendApplyCrucibleChooseAdapter extends BaseQuickAdapter<AddStockCho
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
isChoose.put(helper.getAdapterPosition(), cbChoose.isChecked());
if (isChecked) {
addChooseList(item);
} else {
removeChooseList(item);
}
EventBus.getDefault().post(new ModifyCarEvent(JSON.toJSONString(getData())));
}
});
......@@ -81,6 +89,7 @@ public class SendApplyCrucibleChooseAdapter extends BaseQuickAdapter<AddStockCho
@Override
public void OnNumberChanged(String vs) {
item.setChooseNum(vs);
changeChooseNum(item);
EventBus.getDefault().post(new ModifyCarEvent(JSON.toJSONString(getData())));
}
});
......@@ -96,5 +105,48 @@ public class SendApplyCrucibleChooseAdapter extends BaseQuickAdapter<AddStockCho
}
public void notifyData() {
for (int i = 0; i < isChoose.entrySet().size(); i++) {
isChoose.put(i, false);
}
for (AddStockChooseBean.RecordsBean recordsBean : chooseList) {
for (int i = 0; i < getData().size(); i++) {
if (getData().get(i).getId() == recordsBean.getId()) {
isChoose.put(i, true);
}
}
}
notifyDataSetChanged();
}
public List<AddStockChooseBean.RecordsBean> getChooseList() {
return chooseList;
}
public void setChooseList(List<AddStockChooseBean.RecordsBean> chooseList) {
this.chooseList = chooseList;
}
private void addChooseList(AddStockChooseBean.RecordsBean data) {
for (AddStockChooseBean.RecordsBean chooseData : chooseList) {
if (chooseData.getId() == data.getId()) {
chooseList.remove(chooseData);
}
}
chooseList.add(data);
}
private void removeChooseList(AddStockChooseBean.RecordsBean data) {
chooseList.remove(data);
}
private void changeChooseNum(AddStockChooseBean.RecordsBean data) {
for (AddStockChooseBean.RecordsBean chooseData : chooseList) {
if (chooseData.getId() == data.getId()) {
chooseData.setChooseNum(data.getChooseNum());
}
}
}
}
......@@ -70,7 +70,7 @@
android:layout_height="match_parent"
android:layout_marginLeft="2mm"
android:background="@null"
android:hint="输入订单号"
android:hint="输入仓库名称"
android:textColor="#91ABBA"
android:textColorHint="#91ABBA"
android:textSize="14sp" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论