|
|
|
@ -1,14 +1,27 @@ |
|
|
|
package com.qhclh.ytzh.work.Fowl; |
|
|
|
|
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.LinearLayout; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseFragment; |
|
|
|
import com.qhclh.ytzh.home.RpcUrl; |
|
|
|
import com.qhclh.ytzh.tasks.ViewOnClickTask; |
|
|
|
import com.qhclh.ytzh.utils.DateTimeUtil; |
|
|
|
|
|
|
|
import org.forks.jsonrpc.JsonRpcResult; |
|
|
|
import org.forks.jsonrpc.RpcFacade; |
|
|
|
import org.forks.jsonrpc.RpcObject; |
|
|
|
import org.greenrobot.eventbus.EventBus; |
|
|
|
import org.greenrobot.eventbus.Subscribe; |
|
|
|
import org.greenrobot.eventbus.ThreadMode; |
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
/** |
|
|
|
@ -43,9 +56,79 @@ public class ChulanFragment extends BaseFragment { |
|
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN,sticky = true) |
|
|
|
public void onEvent(FowlEvent event){ |
|
|
|
System.out.println("aaa+++chulan+++"+event.getId()); |
|
|
|
QueryBreedPlanFactoryInfo(event.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
private void QueryBreedPlanFactoryInfo(final long id) { |
|
|
|
ViewOnClickTask factoryinfoTask = new ViewOnClickTask(getActivity(),"加载中...") { |
|
|
|
List<RpcObject> objList; |
|
|
|
@Override |
|
|
|
protected void successUI() { |
|
|
|
firstContent.removeAllViews(); |
|
|
|
for (int i=0;i<objList.size();i++){ |
|
|
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first2,null); |
|
|
|
TextView time = view.findViewById(R.id.item_f1); |
|
|
|
TextView sum = view.findViewById(R.id.item_f2); |
|
|
|
|
|
|
|
LinearLayout secondContent = view.findViewById(R.id.secondContent_f2); |
|
|
|
// LinearLayout main_ll = view.findViewById(R.id.main_ll_f2); |
|
|
|
|
|
|
|
if (objList.get(i).getDate("Date")!=null) { |
|
|
|
time.setText(DateTimeUtil.getYMD2(objList.get(i).getDate("Date"))); |
|
|
|
} |
|
|
|
sum.setText("合计:"+objList.get(i).getInt("Number")); |
|
|
|
// main_ll.setTag(rpcStr.get(i).getLong("BreedFactory_ID")); |
|
|
|
secondContent.removeAllViews(); |
|
|
|
List<RpcObject> detailsList = objList.get(i).getList("Details"); |
|
|
|
for (int j=0;j<detailsList.size();j++){ |
|
|
|
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second22,null); |
|
|
|
TextView item1 = view2.findViewById(R.id.item_s21); |
|
|
|
TextView item2 = view2.findViewById(R.id.item_s22); |
|
|
|
TextView item3 = view2.findViewById(R.id.item_s23); |
|
|
|
|
|
|
|
|
|
|
|
if (detailsList.get(j).getString("BreedFactory_Name")!=null) { |
|
|
|
item1.setText(detailsList.get(j).getString("BreedFactory_Name")); |
|
|
|
}else { |
|
|
|
item1.setText(""); |
|
|
|
} |
|
|
|
if (detailsList.get(j).getString("TakeAwayFoodFactory")!=null) { |
|
|
|
item3.setText(detailsList.get(j).getString("TakeAwayFoodFactory")); |
|
|
|
}else { |
|
|
|
item3.setText(""); |
|
|
|
} |
|
|
|
if (detailsList.get(j).getInt("Number")!=null) { |
|
|
|
item2.setText("栋数:" + detailsList.get(j).getInt("Number")); |
|
|
|
}else { |
|
|
|
item2.setText("栋数:"); |
|
|
|
} |
|
|
|
|
|
|
|
secondContent.addView(view2); |
|
|
|
} |
|
|
|
firstContent.addView(view); |
|
|
|
// main_ll.setOnClickListener(new View.OnClickListener() { |
|
|
|
// @Override |
|
|
|
// public void onClick(View view) { |
|
|
|
// Intent intent = new Intent(getActivity(),PoultryReportActvity.class); |
|
|
|
// intent.putExtra("BreedFactory_ID",(long)view.getTag()); |
|
|
|
// intent.putExtra("time",choseDate); |
|
|
|
// startActivity(intent); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.QueryBreedPlanFactoryInfo,"出栏",id,new SimpleDateFormat("yyyy-MM-dd").parse(DateTimeUtil.getYMD(new Date(System.currentTimeMillis()))),null); |
|
|
|
objList = result.getRpcObjectList(RpcUrl.QueryBreedPlanFactoryInfo_fanhui); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}; |
|
|
|
factoryinfoTask.execute(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public void onDestroy() { |
|
|
|
super.onDestroy(); |
|
|
|
|