提交 9bf74860 authored 作者: lgd's avatar lgd

1.去除销售坩埚订单,入库领用显示,新增坩埚发货页面(未处理功能)

2.TODO 三个功能测试,下单新增唛头測試
上级 6d51d129
......@@ -2383,7 +2383,14 @@
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.order.SendApplyAddCruibleActivity"
android:configChanges="orientation|screenSize|keyboardHidden"
android:label="申请发货"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider"
......
......@@ -93,7 +93,7 @@ public class OrderDetail {
private String inStockName;
private String usedStore;
private String usedStoreName;
private String isCrucible;
private String isCrucible;//坩埚销售订单 1 坩埚销售订单
public String getIsCrucible() {
return isCrucible;
......
......@@ -271,6 +271,7 @@ public class SaleOrderDetailActivity extends WorkToolBarActivity {
proList.addAll(dataBean.getOrderItems());
proAdapter.setStatus(dataBean.getStatus());
proAdapter.setAttr(dataBean.getAttr());
proAdapter.setIsCrucible(dataBean.getIsCrucible());
proAdapter.notifyDataSetChanged();
tvName.setText(dataBean.getCustomerName());
tvDep.setText(dataBean.getReceiveDeptName());
......@@ -433,6 +434,7 @@ public class SaleOrderDetailActivity extends WorkToolBarActivity {
}
startActivity(SendApplyActivity.class,
"status", dataBean.getStatus() + "",
"isCrucible", dataBean.getIsCrucible(),
"orderType", dataBean.getExpandInfo().getOrderType(),
"orderId", getIntent().getStringExtra("id"));
break;
......
......@@ -102,6 +102,12 @@ public class SendApplyActivity extends WorkToolBarActivity {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.add:
if (TextUtils.equals("1", getIntent().getStringExtra("isCrucible"))) {
startActivity(SendApplyAddCruibleActivity.class,
"orderType", getIntent().getStringExtra("orderType"),
"id", getIntent().getStringExtra("orderId"));
return super.onOptionsItemSelected(item);
}
startActivity(SendApplyAddActivity.class,
"orderType", getIntent().getStringExtra("orderType"),
"id", getIntent().getStringExtra("orderId"));
......
package com.wd.workoffice.ui.activity.bat.order;
import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.OrderDetail;
import com.wd.workoffice.bean.event.CheckSendEvent;
import com.wd.workoffice.bean.event.SendWeightEvent;
import com.wd.workoffice.bean.workEnum.OrderType;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.bat.store.StoreSaleClientActivity;
import com.wd.workoffice.ui.adapter.WorkSendApplyAddAdapter;
import com.wd.workoffice.util.MathUtils;
import com.wd.workoffice.util.PickTimeUtils;
import com.wd.workoffice.util.WorkUtils;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import flexible.xd.android_base.network.rtfhttp.Transformer;
import flexible.xd.android_base.utils.TimeUtils;
import io.reactivex.Observable;
import io.reactivex.disposables.Disposable;
/**
* 添加发货-坩埚
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class SendApplyAddCruibleActivity extends WorkToolBarActivity {
@BindView(R.id.tv_bottom)
TextView tvBottom;
@BindView(R.id.rv_data)
RecyclerView rvData;
@BindView(R.id.tv_time)
TextView tvTime;
@BindView(R.id.rl_time)
RelativeLayout rlTime;
@BindView(R.id.tv_weight)
TextView tvWeight;
@BindView(R.id.et_logistics_price)
EditText etLogisticsPrice;
@BindView(R.id.et_logistics_code)
EditText etLogisticsCode;
@BindView(R.id.tv_logistics_company)
TextView tvLogisticsCompany;
@BindView(R.id.rl_set)
RelativeLayout rlSet;
@BindView(R.id.et_remark)
EditText etRemark;
@BindView(R.id.tv_input1)
TextView tvInput1;
private List<OrderDetail.OrderItemsBean> dataList;
private WorkSendApplyAddAdapter dataAdapter;
private Map<String, Object> param;
private OrderDetail dataBean;
private int clientId;
private String orderType;
@Override
protected void initView() {
ButterKnife.bind(this);
rvData.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
WorkUtils.addNumListener(etRemark, tvInput1);
}
@Override
protected void initData() {
orderType = getIntent().getStringExtra("orderType");
dataList = new ArrayList<>();
dataAdapter = new WorkSendApplyAddAdapter(R.layout.item_send_apply_add, dataList);
dataAdapter.bindToRecyclerView(rvData);
param = new HashMap<>();
param.put("orderId", getIntent().getStringExtra("id"));
param.put("payer", 2);
getData();
}
@Override
protected void initEvent() {
}
private void getData() {
Observable<BaseBean> observable;
if (TextUtils.equals(orderType, OrderType.SALE.getCode())) {
observable = RtfUtils.getRtf().saleOrderDetail(getIntent().getStringExtra("id"), "1");
} else if (TextUtils.equals(orderType, OrderType.OUT_BUY.getCode())) {
observable = RtfUtils.getRtf().purchaseOrderDetail(getIntent().getStringExtra("id"), "1");
} else if (TextUtils.equals(orderType, OrderType.SUPPLIER.getCode())) {
observable = RtfUtils.getRtf().supplierOrderDetail(getIntent().getStringExtra("id"), "1");
} else if (TextUtils.equals(orderType, OrderType.BUILD.getCode())) {
observable = RtfUtils.getRtf().productOrderDetail(getIntent().getStringExtra("id"), "1");
} else if (TextUtils.equals(orderType, OrderType.IN.getCode())) {
observable = RtfUtils.getRtf().insideOrderDetail(getIntent().getStringExtra("id"), "1");
} else if (TextUtils.equals(orderType, OrderType.CRUCIBLE.getCode())) {
observable = RtfUtils.getRtf().crucibleSaleOrderDetail(getIntent().getStringExtra("id"), "1");
} else {
observable = RtfUtils.getRtf().saleOrderDetail(getIntent().getStringExtra("id"), "1");
}
observable.compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
dataBean = JSON.parseObject(data.getData().toString(), OrderDetail.class);
param.put("orderType", dataBean.getExpandInfo().getOrderType());
dataList.addAll(dataBean.getOrderItems());
dataAdapter.notifyDataSetChanged();
}
});
}
@Override
protected int layoutId() {
return R.layout.activity_send_apply_add;
}
@OnClick(R.id.tv_bottom)
public void onViewClicked() {
if (coverProInfo()) {
submit();
}
}
private boolean coverProInfo() {
Map<Integer, Boolean> isChoose = dataAdapter.getIsChoose();
List<JSONObject> info = new ArrayList<>();
String totalWeight = "0";
for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
if (entry.getValue()) {
OrderDetail.OrderItemsBean recordsBean = dataList.get(entry.getKey());
JSONObject returnData = new JSONObject();
if (TextUtils.isEmpty(recordsBean.getChooseNum()) || Double.valueOf(recordsBean.getChooseNum()) == 0d) {
toast("请选择发货数量");
return false;
}
totalWeight = MathUtils.add(totalWeight, MathUtils.multiply(recordsBean.getChooseNum(),
String.valueOf(recordsBean.getProductWeight()), 3), 3);
returnData.put("productId", recordsBean.getProductId());
returnData.put("productAmount", recordsBean.getChooseNum());
info.add(returnData);
}
}
if (info.size() == 0) {
toast("请选择货品");
return false;
}
tvWeight.setText(totalWeight);
param.put("sendOutStoreApplyItemList", info);
param.put("totalWeight", totalWeight);
return true;
}
private void submit() {
String price = etLogisticsPrice.getText().toString();
String code = etLogisticsCode.getText().toString();
String remark = etRemark.getText().toString();
String time = tvTime.getText().toString();
if (TextUtils.isEmpty(time)) {
toast("请选择发货时间");
return;
}
if (TextUtils.isEmpty(price)) {
toast("请输入运费");
return;
}
if (TextUtils.isEmpty(code)) {
toast("请输入快递单号");
return;
}
if (clientId == 0) {
toast("请选择物流公司");
return;
}
param.put("trackingNumber", code);
param.put("fareMoney", price);
param.put("applyRemark", remark);
param.put("logisticsId", clientId);
Observable<BaseBean> observable;
if (TextUtils.equals(orderType, OrderType.SALE.getCode())) {
observable = RtfUtils.getRtf().sendApply(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
} else if (TextUtils.equals(orderType, OrderType.OUT_BUY.getCode())) {
observable = RtfUtils.getRtf().sendPoApply(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
} else if (TextUtils.equals(orderType, OrderType.CRUCIBLE.getCode())) {
observable = RtfUtils.getRtf().sendCoApply(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
} else {
observable = RtfUtils.getRtf().sendApply(getIntent().getStringExtra("id"), WorkUtils.convertMapToBody(param));
}
observable.compose(Transformer.schedule()).subscribe(new WorkObserver<BaseBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseBean data) {
hideLoading();
if (data.getCode() != 0) {
toast(data.getMessage());
return;
}
toast("提交申请成功");
EventBus.getDefault().post(new CheckSendEvent());
finish();
}
});
}
@OnClick({R.id.tv_bottom, R.id.rl_time, R.id.rl_set})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.tv_bottom:
break;
case R.id.rl_time:
PickTimeUtils.showPickThree(SendApplyAddCruibleActivity.this, new OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date, View v) {
String time = TimeUtils.date2String(date, new SimpleDateFormat("yyyy-MM-dd"));
// param.put("requireTime", time);
tvTime.setText(time);
}
}).show();
break;
case R.id.rl_set:
startActivityForResult(StoreSaleClientActivity.class, 10001,
"flag", "1", "supplier", "选择运输商", "code", "TRANSPORTERS");
break;
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 10001 && resultCode == 10001) {
String clientName = data.getStringExtra("clientName");
clientId = data.getIntExtra("id", 0);
tvLogisticsCompany.setText(clientName);
}
}
@Override
public void onStart() {
super.onStart();
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
}
@Subscribe
public void refresh(SendWeightEvent event) {
Map<Integer, Boolean> isChoose = dataAdapter.getIsChoose();
List<JSONObject> info = new ArrayList<>();
String totalWeight = "0";
for (Map.Entry<Integer, Boolean> entry : isChoose.entrySet()) {
if (entry.getValue()) {
OrderDetail.OrderItemsBean recordsBean = dataList.get(entry.getKey());
JSONObject returnData = new JSONObject();
if (TextUtils.isEmpty(recordsBean.getChooseNum()) || Double.valueOf(recordsBean.getChooseNum()) == 0d) {
}
totalWeight = MathUtils.add(totalWeight, MathUtils.multiply(recordsBean.getChooseNum(),
String.valueOf(recordsBean.getProductWeight()), 3), 3);
returnData.put("productId", recordsBean.getProductId());
returnData.put("productAmount", recordsBean.getChooseNum());
info.add(returnData);
}
}
tvWeight.setText(totalWeight);
}
}
......@@ -22,7 +22,7 @@ public class OrderDetailProductAdapter extends BaseQuickAdapter<OrderDetail.Orde
int status;
int attr;
List<OrderCheckStatusBean.ItemsBean> proStatusList;
String isCrucible;
public OrderDetailProductAdapter(int layoutResId, List data, Integer status) {
super(layoutResId, data);
......@@ -49,8 +49,8 @@ public class OrderDetailProductAdapter extends BaseQuickAdapter<OrderDetail.Orde
helper.setText(R.id.tv_unit, item.getProductUnit());
helper.setText(R.id.tv_from, WorkUtils.getOrderFrom(item.getType()));
helper.setText(R.id.tv_num, MathUtils.converData(item.getProductCount(), 3));
if (!TextUtils.isEmpty(item.getAnnex())){
helper.setText(R.id.tv_annex,item.getAnnex().substring(1));
if (!TextUtils.isEmpty(item.getAnnex())) {
helper.setText(R.id.tv_annex, item.getAnnex().substring(1));
}
helper.addOnClickListener(R.id.ll_annex);
helper.addOnClickListener(R.id.tv_get);
......@@ -108,12 +108,16 @@ public class OrderDetailProductAdapter extends BaseQuickAdapter<OrderDetail.Orde
helper.setGone(R.id.fl_get, false);
}
changeStats(helper, item.getProductId());
if (TextUtils.equals(isCrucible, "1")) {//坩埚销售订单,入库和领用不展示
helper.setGone(R.id.fl_add, false);
helper.setGone(R.id.fl_get, false);
}
}
private void changeStats(BaseViewHolder helper, int productId) {
if (getProStatusList() != null) {
for (OrderCheckStatusBean.ItemsBean itemsBean : getProStatusList()) {
if (productId==itemsBean.getProductId()){
if (productId == itemsBean.getProductId()) {
helper.setGone(R.id.view_add, itemsBean.isInStore());
helper.setGone(R.id.view_get, itemsBean.isUsed());
helper.setGone(R.id.view_quality, itemsBean.isQualityInspection());
......@@ -140,5 +144,13 @@ public class OrderDetailProductAdapter extends BaseQuickAdapter<OrderDetail.Orde
this.proStatusList = proStatusList;
notifyDataSetChanged();
}
public String getIsCrucible() {
return isCrucible;
}
public void setIsCrucible(String isCrucible) {
this.isCrucible = isCrucible;
}
}
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/tv_bottom"
android:layout_width="match_parent"
android:layout_height="48mm"
android:layout_alignParentBottom="true"
android:background="#5C768A"
android:gravity="center"
android:orientation="horizontal"
android:text="发货"
android:textColor="@color/white"
android:textSize="16sp" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/tv_bottom"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="10mm">
<View
android:layout_width="8mm"
android:layout_height="18mm"
android:background="@color/red_btn_bg" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10mm"
android:text="货品信息 ( 可多选 )"
android:textSize="15sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_data"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View style="@style/ViewX" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingVertical="10mm">
<View
android:layout_width="8mm"
android:layout_height="18mm"
android:background="@color/red_btn_bg" />
<TextView
android:id="@+id/tv_desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10mm"
android:text="发货信息"
android:textSize="15sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:paddingHorizontal="20mm"
android:paddingVertical="9mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="发货时间"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="3mm"
android:hint="选择发货时间"
android:textColor="@color/flexible_text_gray"
android:textSize="14sp" />
<ImageView
android:layout_width="15mm"
android:layout_height="20mm"
android:src="@mipmap/arrow_right_gray" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="20mm"
android:paddingVertical="9mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="总重"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_weight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10mm"
android:layout_weight="1"
android:background="@null"
android:gravity="right"
android:padding="3mm"
android:textColor="@color/flexible_text_gray"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_logistics_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="20mm"
android:paddingVertical="9mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="运费"
android:textSize="14sp" />
<EditText
android:id="@+id/et_logistics_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10mm"
android:layout_weight="1"
android:background="@null"
android:gravity="right"
android:hint="输入运费"
android:inputType="numberDecimal"
android:padding="3mm"
android:textColor="@color/flexible_text_gray"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_logistics_code"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="20mm"
android:paddingVertical="9mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="快递单号"
android:textSize="14sp" />
<EditText
android:id="@+id/et_logistics_code"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="10mm"
android:layout_weight="1"
android:background="@null"
android:gravity="right"
android:hint="输入快递单号"
android:padding="3mm"
android:textColor="@color/flexible_text_gray"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_set"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="20mm"
android:paddingVertical="9mm">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="物流公司"
android:textSize="14sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="center_vertical">
<TextView
android:id="@+id/tv_logistics_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="3mm"
android:text="输入物流公司"
android:textColor="@color/flexible_text_gray"
android:textSize="14sp" />
<ImageView
android:layout_width="15mm"
android:layout_height="20mm"
android:src="@mipmap/arrow_right_gray" />
</LinearLayout>
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="20mm"
android:paddingVertical="10mm"
android:text="备注:"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="20mm"
android:background="@drawable/shape_confirm_order"
android:orientation="vertical">
<EditText
android:id="@+id/et_remark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3mm"
android:background="@null"
android:gravity="top"
android:hint="请输入"
android:minLines="4"
android:padding="5mm"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_input1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="4mm"
android:text="0/140"
android:textColor="@color/flexible_text_gray" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论