提交 47f3950f authored 作者: lgd's avatar lgd

1.废品重量

2.//TODO 坩埚下单,mes其他页面,mes用户反馈空也展示,编辑任务担当无法修改
上级 72ddfed2
package com.wd.workoffice.bean.mesBean;
import java.util.List;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class ProBadBean {
private List<DataBean> data;
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* seriesId : null
* variety : null
* scrapCount : 132
* scrapWeight : 4118.0
* scrapRate : 0.0
* modulus : 0.0
* nonCompliant : null
*/
private Object seriesId;
private String variety;
private int scrapCount;
private double scrapWeight;
private double scrapRate;
private double modulus;
private Object nonCompliant;
public Object getSeriesId() {
return seriesId;
}
public void setSeriesId(Object seriesId) {
this.seriesId = seriesId;
}
public String getVariety() {
return variety;
}
public void setVariety(String variety) {
this.variety = variety;
}
public int getScrapCount() {
return scrapCount;
}
public void setScrapCount(int scrapCount) {
this.scrapCount = scrapCount;
}
public double getScrapWeight() {
return scrapWeight;
}
public void setScrapWeight(double scrapWeight) {
this.scrapWeight = scrapWeight;
}
public double getScrapRate() {
return scrapRate;
}
public void setScrapRate(double scrapRate) {
this.scrapRate = scrapRate;
}
public double getModulus() {
return modulus;
}
public void setModulus(double modulus) {
this.modulus = modulus;
}
public Object getNonCompliant() {
return nonCompliant;
}
public void setNonCompliant(Object nonCompliant) {
this.nonCompliant = nonCompliant;
}
}
}
......@@ -502,6 +502,13 @@ public interface MesApiService {
/**
* @return
*/
@POST("himes/api/spotCheckBill/show/page.json")
@POST("/himes/api/spotCheckBill/show/page.json")
Observable<BaseMesBean> spotCheckBillList(@Query("functionId") String functionId, @Body RequestBody requestBody);
/**
* @return
*/
@POST("/himes/api/scrapAnalysis/show/list.json")
Observable<BaseMesBean> scrapAnalysisList(@Query("functionId") String functionId, @Body RequestBody requestBody);
}
......@@ -59,14 +59,14 @@ public class MesAnalysisActivity extends WorkToolBarActivity {
param.put("pageNum", page);
Map<String ,Object> paramMap =new HashMap<>();
param.put("paramMap", paramMap);
List<Object> topList = new ArrayList<>();
topList.add(null);
topList.add(null);
topList.add(null);
// List<Object> topList = new ArrayList<>();
// topList.add(null);
// topList.add(null);
// topList.add(null);
proBadList = new ArrayList<>();
topAdapter = new ReportTopAdapter(R.layout.item_mes_report_top, topList);
// topAdapter = new ReportTopAdapter(R.layout.item_mes_report_top, topList);
proBadAdapter = new ReportAnalysisBadAdapter(R.layout.item_mes_analysis, proBadList);
topAdapter.bindToRecyclerView(rvTop);
// topAdapter.bindToRecyclerView(rvTop);
proBadAdapter.bindToRecyclerView(rvProBad);
getData();
......
......@@ -7,15 +7,29 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseMesBean;
import com.wd.workoffice.app.WorkBaseActivity;
import com.wd.workoffice.bean.mesBean.ProBadBean;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.adapter.ReportBadAdapter;
import com.wd.workoffice.ui.adapter.ReportProBadAdapter;
import com.wd.workoffice.ui.adapter.ReportTopAdapter;
import com.wd.workoffice.util.PickTimeUtils;
import com.wd.workoffice.util.WorkUtils;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
......@@ -23,8 +37,12 @@ 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.disposables.Disposable;
/**
* 质量报表
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
......@@ -48,7 +66,16 @@ public class MesReportActivity extends WorkBaseActivity {
LinearLayout llReport;
@BindView(R.id.ll_bad)
LinearLayout llBad;
@BindView(R.id.tv_time)
TextView tvTime;
@BindView(R.id.ll_time)
LinearLayout llTime;
private ReportBadAdapter badAdapter;
private ReportTopAdapter topAdapter;
private ReportProBadAdapter proBadAdapter;
private List<ProBadBean.DataBean> proBadList;
private List<ProBadBean.DataBean> topList;
private Map<String, Object> param;
@Override
protected void initView() {
......@@ -67,60 +94,54 @@ public class MesReportActivity extends WorkBaseActivity {
badList.add(null);
badList.add(null);
badList.add(null);
List<Object> topList = new ArrayList<>();
topList.add(null);
topList.add(null);
topList.add(null);
List<Object> proBadList = new ArrayList<>();
proBadList.add(null);
proBadList.add(null);
proBadList.add(null);
topList = new ArrayList<>();
proBadList = new ArrayList<>();
badAdapter = new ReportBadAdapter(R.layout.item_mes_report_bad, badList);
ReportTopAdapter topAdapter = new ReportTopAdapter(R.layout.item_mes_report_top, badList);
ReportProBadAdapter proBadAdapter = new ReportProBadAdapter(R.layout.item_mes_report_pro_bad, badList);
topAdapter = new ReportTopAdapter(R.layout.item_mes_report_top, topList);
proBadAdapter = new ReportProBadAdapter(R.layout.item_mes_report_pro_bad, proBadList);
badAdapter.bindToRecyclerView(rvBad);
topAdapter.bindToRecyclerView(rvTop);
proBadAdapter.bindToRecyclerView(rvProBad);
param = WorkUtils.simpleParam();
getData();
}
// private void getData() {
// RtfUtils.getMesRtf().searchList("1", WorkUtils.convertMapToBody(param)).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseMesBean>() {
// @Override
// public void doOnSubscribe(Disposable d) {
// }
//
// @Override
// public void onFail(String errorMsg) {
// hideLoading();
// toast(errorMsg);
// }
//
// @Override
// public void onSuccess(BaseMesBean data) {
// hideLoading();
// if (!data.isSuccess()) {
// toast(data.getMessage());
// return;
// }
// List<SearchBean.ListBean> getList = JSON.parseObject(data.getData().toString(), SearchBean.class).getList();
// if (page == 1) {
// srlRefresh.finishRefresh();
// dataList.clear();
// dataList.addAll(getList);
// dataAdapter.notifyDataSetChanged();
// dataAdapter.loadMoreComplete();
// } else {
// dataAdapter.loadMoreComplete();
// dataList.addAll(getList);
// dataAdapter.notifyDataSetChanged();
// }
// if (getList.size() == 0) {
// dataAdapter.loadMoreEnd();
// } else {
// page++;
// }
// }
// }); }
private void getData() {
RtfUtils.getMesRtf().scrapAnalysisList("1", WorkUtils.convertMapToBody(param)).compose(Transformer.schedule()).subscribe(new WorkObserver<BaseMesBean>() {
@Override
public void doOnSubscribe(Disposable d) {
}
@Override
public void onFail(String errorMsg) {
hideLoading();
toast(errorMsg);
}
@Override
public void onSuccess(BaseMesBean data) {
hideLoading();
if (!data.isSuccess()) {
toast(data.getMessage());
return;
}
List<ProBadBean.DataBean> getList = JSON.parseArray(data.getData().toString(), ProBadBean.DataBean.class);
Collections.sort(getList, new Comparator<ProBadBean.DataBean>() {
@Override
public int compare(ProBadBean.DataBean o1, ProBadBean.DataBean o2) {
return new BigDecimal(o2.getScrapWeight()).compareTo(new BigDecimal(o1.getScrapWeight()));
}
});
topList.clear();
topList.addAll(getList);
proBadList.clear();
proBadList.addAll(getList);
topAdapter.notifyDataSetChanged();
proBadAdapter.notifyDataSetChanged();
}
});
}
@Override
......@@ -139,9 +160,20 @@ public class MesReportActivity extends WorkBaseActivity {
}
@OnClick({R.id.tv_report, R.id.tv_bad})
@OnClick({R.id.ll_time, R.id.tv_report, R.id.tv_bad})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.ll_time:
PickTimeUtils.showPickTwo(this, new OnTimeSelectListener() {
@Override
public void onTimeSelect(Date date, View view) {
String month = TimeUtils.date2String(date, new SimpleDateFormat("yyyy-MM"));
tvTime.setText(month);
addMonthParam(month);
getData();
}
}).show();
break;
case R.id.tv_report:
changView(0);
break;
......@@ -150,6 +182,14 @@ public class MesReportActivity extends WorkBaseActivity {
break;
}
}
private void addMonthParam(String nowString) {
param.put("beginDate", nowString + "-01 00:00:00");
String nextMonth = (Integer.valueOf(nowString.split("-")[1]) + 1) + "";
String nextMonthString = Integer.valueOf(nowString.split("-")[0]) + "-" + (nextMonth.length() == 2 ? nextMonth : "0" + nextMonth + "-01 00:00:00");
param.put("endDate", nextMonthString);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
......@@ -177,4 +217,5 @@ public class MesReportActivity extends WorkBaseActivity {
tvReport.setTextColor(Color.parseColor("#FF4A92DE"));
}
}
}
package com.wd.workoffice.ui.adapter;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.widget.EditText;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.ProductBean;
import com.wd.workoffice.bean.event.ModifyCarEvent;
import com.wd.workoffice.bean.mesBean.ProBadBean;
import com.wd.workoffice.util.MathUtils;
import com.wd.workoffice.widget.AddAndReduceDoubleView;
import org.greenrobot.eventbus.EventBus;
import java.util.List;
import flexible.xd.android_base.utils.ToastUtil;
/**
* Created by flexible on 2018/8/13.
*/
public class ReportProBadAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, BaseViewHolder> {
public class ReportProBadAdapter extends BaseQuickAdapter<ProBadBean.DataBean, BaseViewHolder> {
public ReportProBadAdapter(int layoutResId, List data) {
super(layoutResId, data);
......@@ -33,8 +21,10 @@ public class ReportProBadAdapter extends BaseQuickAdapter<ProductBean.RecordsBea
@Override
protected void convert(BaseViewHolder helper, ProductBean.RecordsBean item) {
protected void convert(BaseViewHolder helper, ProBadBean.DataBean item) {
helper.setText(R.id.tv_rank, helper.getAdapterPosition()+1 + "");
helper.setText(R.id.tv_pro_name, item.getVariety());
helper.setText(R.id.tv_weight, MathUtils.converData(item.getScrapWeight(),3));
}
}
package com.wd.workoffice.ui.adapter;
import android.view.View;
import android.view.ViewGroup;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.ProductBean;
import com.wd.workoffice.bean.mesBean.ProBadBean;
import com.wd.workoffice.util.MathUtils;
import java.nio.file.Path;
import java.util.List;
import flexible.xd.android_base.utils.ScreenUtils;
/**
* Created by flexible on 2018/8/13.
*/
public class ReportTopAdapter extends BaseQuickAdapter<ProductBean.RecordsBean, BaseViewHolder> {
public class ReportTopAdapter extends BaseQuickAdapter<ProBadBean.DataBean, BaseViewHolder> {
double bigValue;
int width= ScreenUtils.getScreenWidth()/2;
public ReportTopAdapter(int layoutResId, List data) {
public ReportTopAdapter(int layoutResId, List<ProBadBean.DataBean> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, ProductBean.RecordsBean item) {
protected void convert(BaseViewHolder helper, ProBadBean.DataBean item) {
View progress = helper.getView(R.id.view_progress);
ViewGroup.LayoutParams layoutParams = progress.getLayoutParams();
if (helper.getAdapterPosition() == 0) {
bigValue = item.getScrapWeight();
layoutParams.width=width;
} else {
if (item.getScrapWeight() == 0d) {
layoutParams.width = 0;
} else {
int lastWidth = Integer.parseInt(MathUtils.multiply(String.valueOf(item.getScrapWeight()/bigValue), width + "", 0));
layoutParams.width = lastWidth;
}
}
helper.setText(R.id.tv_name, item.getVariety());
}
}
......
......@@ -47,7 +47,7 @@ public class MesFragment extends WorkBaseFg {
// String[] dataName = new String[]{"订单追踪", "质量报表", "质量分析", "质量绩效",
// "质量追溯", "质量反馈", "过程检测", "报废管理", "检维修记录", "设备监控"
// , "工单管理"};
String[] dataName = new String[]{"订单追踪", "质量报表", "质量分析", "质量绩效",
String[] dataName = new String[]{"订单追踪", "质量报表", "缺陷字典", "质量绩效",
"质量追溯", "检维修记录"
, "市场服务"};
......
......@@ -68,6 +68,7 @@
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_time"
android:layout_width="100mm"
android:layout_height="wrap_content"
android:layout_marginTop="25mm"
......@@ -76,17 +77,17 @@
android:paddingVertical="4mm">
<TextView
android:id="@+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="4mm"
android:text="2019年7月"
android:text="请选择时间"
android:textColor="#ff637298"
android:textSize="13sp" />
<ImageView
android:layout_width="5mm"
android:layout_height="2mm"
android:scaleType="fitXY"
android:layout_width="20mm"
android:layout_height="14mm"
android:src="@mipmap/mes_time_down" />
</LinearLayout>
......
......@@ -12,6 +12,7 @@
<TextView
android:id="@+id/tv_rank"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -20,6 +21,7 @@
android:textSize="14sp" />
<TextView
android:id="@+id/tv_pro_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
......@@ -27,6 +29,7 @@
android:textSize="14sp" />
<TextView
android:id="@+id/tv_weight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
......
......@@ -6,7 +6,8 @@
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:id="@+id/tv_name"
android:layout_width="60mm"
android:layout_height="wrap_content"
android:layout_marginRight="15mm"
android:text="废品01"
......@@ -18,6 +19,7 @@
android:layout_height="wrap_content">
<View
android:id="@+id/view_progress"
android:layout_width="match_parent"
android:layout_height="10mm"
android:background="#FF3F84CD" />
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论