提交 dce04fd7 authored 作者: lgd's avatar lgd

1.设备列表

2.//TODO 设备三个子菜单,坩埚下单,下单时间选择器当前时间验证,mes其他页面,mes用户反馈空也展示,编辑任务担当无法修改
上级 23e61e44
...@@ -1980,11 +1980,20 @@ ...@@ -1980,11 +1980,20 @@
<activity <activity
android:name=".ui.activity.bat.work.WorkDeviceNextActivity" android:name=".ui.activity.bat.work.WorkDeviceNextActivity"
android:configChanges="keyboardHidden|orientation" android:configChanges="keyboardHidden|orientation"
android:label="设备详情" android:label="部件详情"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".ui.activity.bat.work.WorkSparePartsActivity"
android:configChanges="keyboardHidden|orientation"
android:label="部件详情"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Work.Base" android:theme="@style/Work.Base"
android:windowSoftInputMode="adjustPan" /> android:windowSoftInputMode="adjustPan" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="com.wd.workoffice.fileprovider" android:authorities="com.wd.workoffice.fileprovider"
......
package com.wd.workoffice.bean;
import java.util.List;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class SparePartsBean {
/**
* records : [{"createdBy":1,"createdByName":null,"createdTime":"2119-10-09 10:12:25","updatedBy":1,"updatedByName":null,"updatedTime":"2019-10-09 10:12:26","id":1,"mesId":"1","assetId":"1","assetName":"设备1","itemCode":"1","itemName":"基座","specificationType":"1","quantity":1,"issuedqty":1},{"createdBy":675,"createdByName":null,"createdTime":"2019-10-10 09:16:35","updatedBy":null,"updatedByName":null,"updatedTime":null,"id":2,"mesId":"2","assetId":"2","assetName":"设备1的部件1","itemCode":"2","itemName":"底座","specificationType":"40*50*5","quantity":55,"issuedqty":44},{"createdBy":null,"createdByName":null,"createdTime":null,"updatedBy":null,"updatedByName":null,"updatedTime":null,"id":3,"mesId":"3","assetId":"3","assetName":"设备2","itemCode":"3","itemName":"垫片","specificationType":"20*30*50","quantity":22,"issuedqty":11}]
* total : 3
* size : 10
* current : 1
* orders : []
* searchCount : true
* pages : 1
*/
private int total;
private int size;
private int current;
private boolean searchCount;
private int pages;
private List<RecordsBean> records;
private List<?> orders;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getCurrent() {
return current;
}
public void setCurrent(int current) {
this.current = current;
}
public boolean isSearchCount() {
return searchCount;
}
public void setSearchCount(boolean searchCount) {
this.searchCount = searchCount;
}
public int getPages() {
return pages;
}
public void setPages(int pages) {
this.pages = pages;
}
public List<RecordsBean> getRecords() {
return records;
}
public void setRecords(List<RecordsBean> records) {
this.records = records;
}
public List<?> getOrders() {
return orders;
}
public void setOrders(List<?> orders) {
this.orders = orders;
}
public static class RecordsBean {
/**
* createdBy : 1
* createdByName : null
* createdTime : 2119-10-09 10:12:25
* updatedBy : 1
* updatedByName : null
* updatedTime : 2019-10-09 10:12:26
* id : 1
* mesId : 1
* assetId : 1
* assetName : 设备1
* itemCode : 1
* itemName : 基座
* specificationType : 1
* quantity : 1
* issuedqty : 1
*/
private int createdBy;
private Object createdByName;
private String createdTime;
private int updatedBy;
private Object updatedByName;
private String updatedTime;
private int id;
private String mesId;
private String assetId;
private String assetName;
private String itemCode;
private String itemName;
private String specificationType;
private int quantity;
private int issuedqty;
public int getCreatedBy() {
return createdBy;
}
public void setCreatedBy(int createdBy) {
this.createdBy = createdBy;
}
public Object getCreatedByName() {
return createdByName;
}
public void setCreatedByName(Object createdByName) {
this.createdByName = createdByName;
}
public String getCreatedTime() {
return createdTime;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public int getUpdatedBy() {
return updatedBy;
}
public void setUpdatedBy(int updatedBy) {
this.updatedBy = updatedBy;
}
public Object getUpdatedByName() {
return updatedByName;
}
public void setUpdatedByName(Object updatedByName) {
this.updatedByName = updatedByName;
}
public String getUpdatedTime() {
return updatedTime;
}
public void setUpdatedTime(String updatedTime) {
this.updatedTime = updatedTime;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getMesId() {
return mesId;
}
public void setMesId(String mesId) {
this.mesId = mesId;
}
public String getAssetId() {
return assetId;
}
public void setAssetId(String assetId) {
this.assetId = assetId;
}
public String getAssetName() {
return assetName;
}
public void setAssetName(String assetName) {
this.assetName = assetName;
}
public String getItemCode() {
return itemCode;
}
public void setItemCode(String itemCode) {
this.itemCode = itemCode;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getSpecificationType() {
return specificationType;
}
public void setSpecificationType(String specificationType) {
this.specificationType = specificationType;
}
public int getQuantity() {
return quantity;
}
public void setQuantity(int quantity) {
this.quantity = quantity;
}
public int getIssuedqty() {
return issuedqty;
}
public void setIssuedqty(int issuedqty) {
this.issuedqty = issuedqty;
}
}
}
...@@ -1761,5 +1761,14 @@ public interface ApiService { ...@@ -1761,5 +1761,14 @@ public interface ApiService {
*/ */
@GET("/equipment/page/list") @GET("/equipment/page/list")
Observable<BaseBean> equipmentList(@QueryMap Map<String, Object> param); Observable<BaseBean> equipmentList(@QueryMap Map<String, Object> param);
/**
* 获取设备列表
*
* @return
*/
@GET("/spare-part/page/list")
Observable<BaseBean> sparePartList(@QueryMap Map<String, Object> param);
} }
...@@ -14,8 +14,6 @@ import com.wd.workoffice.ui.activity.bat.order.SendApplyAddActivity; ...@@ -14,8 +14,6 @@ import com.wd.workoffice.ui.activity.bat.order.SendApplyAddActivity;
import com.wd.workoffice.ui.adapter.VpDataAdapter; import com.wd.workoffice.ui.adapter.VpDataAdapter;
import com.wd.workoffice.ui.fg.DeviceListFragment; import com.wd.workoffice.ui.fg.DeviceListFragment;
import com.wd.workoffice.ui.fg.SparePartsFragment; import com.wd.workoffice.ui.fg.SparePartsFragment;
import com.wd.workoffice.util.WorkUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package com.wd.workoffice.ui.activity.bat.work;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.wd.workoffice.R;
import com.wd.workoffice.app.BaseBean;
import com.wd.workoffice.app.WorkBaseFg;
import com.wd.workoffice.app.WorkToolBarActivity;
import com.wd.workoffice.bean.SparePartsBean;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
import com.wd.workoffice.retrofit.RtfUtils;
import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.adapter.SparePartsAdapter;
import com.wd.workoffice.util.WorkUtils;
import java.util.ArrayList;
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 io.reactivex.disposables.Disposable;
/**
* author : flexible
* email : lgd19940421@163.com
* github: https://github.com/FlexibleXd
**/
public class WorkSparePartsActivity extends WorkToolBarActivity {
@BindView(R.id.rv_data)
RecyclerView rvData;
@BindView(R.id.srl_refresh)
SmartRefreshLayout srlRefresh;
@BindView(R.id.et_key)
EditText etKey;
@BindView(R.id.btn_search)
Button btnSearch;
@BindView(R.id.ll_search)
LinearLayout llSearch;
private int page = 1;
private Map<String, Object> param;
private SparePartsAdapter dataAdapter;
private List<SparePartsBean.RecordsBean> dataList;
@Override
protected void initView() {
ButterKnife.bind(this);
llSearch.setVisibility(View.GONE);
rvData.setLayoutManager(new LinearLayoutManager(this, RecyclerView.VERTICAL, false));
}
@Override
protected void initData() {
param = WorkUtils.pageKey();
param.put("assetId", getIntent().getStringExtra("id"));
page = 1;
param.put("current", page);
dataList = new ArrayList<>();
dataAdapter = new SparePartsAdapter(R.layout.item_spare_parts, dataList);
dataAdapter.bindToRecyclerView(rvData);
dataAdapter.setEmptyView(R.layout.view_empty_content, rvData);
if (WorkUtils.hasPermission(PagePermissionType.SPARE_PART_LIST.getPermission())) {
getData();
} else {
toast(R.string.permission);
}
}
private void getData() {
RtfUtils.getRtf().sparePartList(param).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;
}
List<SparePartsBean.RecordsBean> getList = JSON.parseObject(data.getData().toString(), SparePartsBean.class).getRecords();
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++;
}
}
});
}
@Override
protected void initEvent() {
srlRefresh.setOnRefreshListener(refreshLayout -> {
if (WorkUtils.hasPermission(PagePermissionType.EQUIPMENT_LIST.getPermission())) {
page = 1;
param.put("current", page);
getData();
} else {
toast(R.string.permission);
}
});
dataAdapter.setOnLoadMoreListener(() -> {
param.put("current", page);
getData();
}, rvData);
dataAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
startActivity(WorkDeviceDetailActivity.class,
"info", JSON.toJSONString(dataList.get(position)));
}
});
}
@Override
protected int layoutId() {
return R.layout.fg_device_list;
}
@OnClick(R.id.btn_search)
public void onViewClicked() {
if (WorkUtils.hasPermission(PagePermissionType.SPARE_PART_LIST.getPermission())) {
page = 1;
param.put("searchValue", etKey.getText().toString());
param.put("current", page);
getData();
} else {
toast(R.string.permission);
}
}
}
package com.wd.workoffice.ui.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.DeviceBean;
import com.wd.workoffice.bean.SparePartsBean;
import com.wd.workoffice.bean.workEnum.PagePermissionType;
import com.wd.workoffice.util.WorkUtils;
import java.util.List;
/**
* Created by flexible on 2018/8/13.
*/
public class SparePartsAdapter extends BaseQuickAdapter<SparePartsBean.RecordsBean, BaseViewHolder> {
public SparePartsAdapter(int layoutResId, List data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder helper, SparePartsBean.RecordsBean item) {
helper.setText(R.id.tv_name, item.getItemName());
helper.setText(R.id.tv_code, String.format("编号:%s", item.getAssetId()));
helper.setText(R.id.tv_spec, String.format("规格:%s", item.getSpecificationType()));
helper.setText(R.id.tv_num, String.format("规格:%s", item.getQuantity()));
helper.setText(R.id.tv_send_num, String.format("规格:%s", item.getIssuedqty()));
}
}
...@@ -18,6 +18,7 @@ import com.wd.workoffice.retrofit.WorkObserver; ...@@ -18,6 +18,7 @@ import com.wd.workoffice.retrofit.WorkObserver;
import com.wd.workoffice.ui.activity.bat.order.SendApplyDetailActivity; import com.wd.workoffice.ui.activity.bat.order.SendApplyDetailActivity;
import com.wd.workoffice.ui.activity.bat.work.WorkDeviceDetailActivity; import com.wd.workoffice.ui.activity.bat.work.WorkDeviceDetailActivity;
import com.wd.workoffice.ui.activity.bat.work.WorkDeviceNextActivity; import com.wd.workoffice.ui.activity.bat.work.WorkDeviceNextActivity;
import com.wd.workoffice.ui.activity.bat.work.WorkSparePartsActivity;
import com.wd.workoffice.ui.adapter.DeviceAdapter; import com.wd.workoffice.ui.adapter.DeviceAdapter;
import com.wd.workoffice.util.WorkUtils; import com.wd.workoffice.util.WorkUtils;
...@@ -158,7 +159,9 @@ public class DeviceListFragment extends WorkBaseFg { ...@@ -158,7 +159,9 @@ public class DeviceListFragment extends WorkBaseFg {
startActivity(WorkDeviceNextActivity.class, startActivity(WorkDeviceNextActivity.class,
"id", dataList.get(position).getId()+""); "id", dataList.get(position).getId()+"");
break; break;
case R.id.tv_agree: case R.id.tv_spare_parts:
startActivity(WorkSparePartsActivity.class,
"id", dataList.get(position).getId()+"");
break; break;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <RelativeLayout
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@mipmap/arrow_right_blue" /> android:src="@mipmap/arrow_right_gray" />
</RelativeLayout> </RelativeLayout>
<View style="@style/dividerX" /> <View style="@style/dividerX" />
...@@ -43,7 +44,7 @@ ...@@ -43,7 +44,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@mipmap/arrow_right_blue" /> android:src="@mipmap/arrow_right_gray" />
</RelativeLayout> </RelativeLayout>
<View style="@style/dividerX" /> <View style="@style/dividerX" />
...@@ -65,7 +66,7 @@ ...@@ -65,7 +66,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:src="@mipmap/arrow_right_blue" /> android:src="@mipmap/arrow_right_gray" />
</RelativeLayout> </RelativeLayout>
<View style="@style/dividerX" /> <View style="@style/dividerX" />
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10mm"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical" android:orientation="vertical"
android:paddingHorizontal="20mm" android:paddingHorizontal="20mm"
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginTop="10mm"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical" android:orientation="vertical"
android:paddingHorizontal="20mm" android:paddingHorizontal="20mm"
android:paddingTop="10mm"
android:paddingBottom="20mm"> android:paddingBottom="20mm">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论