Browse Source

no message

master
lh 8 years ago
parent
commit
8d7c6ea479
2 changed files with 79 additions and 7 deletions
  1. +67
    -1
      app/src/main/java/com/qhclh/ytzh/work/carsmannage/ChicksFragment.java
  2. +12
    -6
      app/src/main/res/layout/fragment_chicks.xml

+ 67
- 1
app/src/main/java/com/qhclh/ytzh/work/carsmannage/ChicksFragment.java View File

@ -10,6 +10,7 @@ import com.qhclh.ytzh.base.BaseFragment;
import com.qhclh.ytzh.bean.ScanBean; import com.qhclh.ytzh.bean.ScanBean;
import com.qhclh.ytzh.home.RpcUrl; import com.qhclh.ytzh.home.RpcUrl;
import com.qhclh.ytzh.tasks.ViewOnClickTask; import com.qhclh.ytzh.tasks.ViewOnClickTask;
import com.qhclh.ytzh.ui.RefreshLayout;
import com.qhclh.ytzh.utils.DateTimeUtil; import com.qhclh.ytzh.utils.DateTimeUtil;
import com.qhclh.ytzh.work.scan.ScanAdapter; import com.qhclh.ytzh.work.scan.ScanAdapter;
@ -26,11 +27,14 @@ import butterknife.BindView;
* Created by 青花瓷 on 2017/11/30. * Created by 青花瓷 on 2017/11/30.
*/ */
///< 车辆管理鸡苗 ///< 车辆管理鸡苗
public class ChicksFragment extends BaseFragment{
public class ChicksFragment extends BaseFragment implements RefreshLayout.OnLoadListener {
@BindView(R.id.lv_infos_chicks) @BindView(R.id.lv_infos_chicks)
ListView lv_infos_chicks; ListView lv_infos_chicks;
private List<ScanBean> scanBeanList; private List<ScanBean> scanBeanList;
private CarsInfosAdapter adapter; private CarsInfosAdapter adapter;
@BindView(R.id.rfl_chicks)
RefreshLayout rfl_chicks;
private int page =0;
@Override @Override
protected int setLayout() { protected int setLayout() {
return R.layout.fragment_chicks; return R.layout.fragment_chicks;
@ -38,6 +42,7 @@ public class ChicksFragment extends BaseFragment{
@Override @Override
protected void initView() { protected void initView() {
rfl_chicks.setEnabled(false);
} }
@Override @Override
@ -55,11 +60,13 @@ public class ChicksFragment extends BaseFragment{
startActivity(intent); startActivity(intent);
} }
}); });
rfl_chicks.setOnLoadListener(this);
} }
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
page = 0;
Query(); Query();
} }
@ -89,7 +96,66 @@ public class ChicksFragment extends BaseFragment{
@Override @Override
public Object call() throws Exception { public Object call() throws Exception {
RpcObject queryObj = RpcObject.create(RpcUrl.ChickTransportLogRpc_canshu); RpcObject queryObj = RpcObject.create(RpcUrl.ChickTransportLogRpc_canshu);
queryObj.setInt("PageSize",10);
queryObj.setInt("CurrentPageIndex",page);
List<Object> select = queryObj.getList("Select");
select.add("ID");
select.add("CreateTime");
select.add("Employee_Name");
select.add("Car_Name");
List<Object> orderList = queryObj.getList("OrderBy");
RpcObject orderBy = RpcObject.create(RpcUrl.DayProductRpc_Query_order);
orderBy.setString("Name", "CreateTime");
orderBy.setBoolean("Desc", true);
orderList.add(orderBy);
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.ChickTransportLogRpc_Query,queryObj);
rpcObj = result.getRpcObjectList(RpcUrl.ChickTransportLogRpc_fanhui);
return null;
}
};
queryTask.execute();
}
@Override
public void onLoad() {
rfl_chicks.postDelayed(new Runnable() {
@Override
public void run() {
rfl_chicks.setLoading(false);
querymore();
}
},1000);
}
private void querymore() {
page++;
ViewOnClickTask queryTask = new ViewOnClickTask(getActivity(),"加载中...") {
List<RpcObject> rpcObj;
@Override
protected void successUI() {
for (int i=0;i<rpcObj.size();i++) {
ScanBean scanBean = new ScanBean();
scanBean.setId(rpcObj.get(i).getLong("ID"));
scanBean.setInfos_carname(rpcObj.get(i).getString("Car_Name"));
scanBean.setInfos_driver(rpcObj.get(i).getString("Employee_Name"));
if (rpcObj.get(i).getDate("CreateTime")!=null) {
scanBean.setCreatetime(DateTimeUtil.getYMD4(rpcObj.get(i).getDate("CreateTime")));
}else {
scanBean.setCreatetime("");
}
scanBeanList.add(scanBean);
}
adapter.notifyDataSetChanged();
}
@Override
public Object call() throws Exception {
RpcObject queryObj = RpcObject.create(RpcUrl.ChickTransportLogRpc_canshu);
queryObj.setInt("PageSize",10);
queryObj.setInt("CurrentPageIndex",page);
List<Object> select = queryObj.getList("Select"); List<Object> select = queryObj.getList("Select");
select.add("ID"); select.add("ID");
select.add("CreateTime"); select.add("CreateTime");


+ 12
- 6
app/src/main/res/layout/fragment_chicks.xml View File

@ -5,12 +5,18 @@
android:background="@color/greyf4f4f4" android:background="@color/greyf4f4f4"
android:orientation="vertical"> android:orientation="vertical">
<ListView
android:id="@+id/lv_infos_chicks"
<com.qhclh.ytzh.ui.RefreshLayout
android:id="@+id/rfl_chicks"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:scrollbars="none">
android:layout_height="match_parent">
</ListView>
<ListView
android:id="@+id/lv_infos_chicks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:scrollbars="none">
</ListView>
</com.qhclh.ytzh.ui.RefreshLayout>
</LinearLayout> </LinearLayout>

Loading…
Cancel
Save