|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.qhclh.ytzh.work.Poultrydailyreport; |
|
|
|
|
|
|
|
import android.content.Intent; |
|
|
|
import android.view.LayoutInflater; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.LinearLayout; |
|
|
|
@ -7,6 +8,15 @@ 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 org.forks.jsonrpc.JsonRpcResult; |
|
|
|
import org.forks.jsonrpc.RpcFacade; |
|
|
|
import org.forks.jsonrpc.RpcObject; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
|
|
|
|
@ -40,43 +50,75 @@ public class ChandanFragment extends BaseFragment { |
|
|
|
@Override |
|
|
|
public void onResume() { |
|
|
|
super.onResume(); |
|
|
|
firstContent.removeAllViews(); |
|
|
|
for (int i=1;i<5;i++){ |
|
|
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null); |
|
|
|
TextView name = view.findViewById(R.id.name); |
|
|
|
|
|
|
|
LinearLayout secondContent = view.findViewById(R.id.secondContent); |
|
|
|
LinearLayout main_ll = view.findViewById(R.id.main_ll); |
|
|
|
|
|
|
|
name.setText("场:"+i); |
|
|
|
main_ll.setTag(i); |
|
|
|
secondContent.removeAllViews(); |
|
|
|
for (int j=0;j<i+1;j++){ |
|
|
|
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null); |
|
|
|
TextView item1 = view2.findViewById(R.id.item1); |
|
|
|
TextView item2 = view2.findViewById(R.id.item2); |
|
|
|
TextView item3 = view2.findViewById(R.id.item3); |
|
|
|
TextView item4 = view2.findViewById(R.id.item4); |
|
|
|
|
|
|
|
item1.setText("批次"+i+":"+i+1); |
|
|
|
item2.setText("周龄"+i+":"+i+2); |
|
|
|
item3.setText("成活率"+i+":"+i+3); |
|
|
|
item4.setText("产蛋率"+i+":"+i+4); |
|
|
|
secondContent.addView(view2); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
BatchTotalCount2(); |
|
|
|
} |
|
|
|
|
|
|
|
firstContent.addView(view); |
|
|
|
main_ll.setOnClickListener(new View.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(View view) { |
|
|
|
System.out.println("aaa++++++tag+++"+view.getTag()); |
|
|
|
if ((int)view.getTag()==1){ |
|
|
|
System.out.println("aaa+++++tttt+++"+view.getTag()); |
|
|
|
private void BatchTotalCount2() { |
|
|
|
ViewOnClickTask BatchTotalCount2Task = new ViewOnClickTask(getActivity(),"加载中...") { |
|
|
|
List<RpcObject> rpcStr; |
|
|
|
@Override |
|
|
|
protected void successUI() { |
|
|
|
firstContent.removeAllViews(); |
|
|
|
for (int i=0;i<rpcStr.size();i++){ |
|
|
|
View view = LayoutInflater.from(getActivity()).inflate(R.layout.view_first,null); |
|
|
|
TextView name = view.findViewById(R.id.name); |
|
|
|
|
|
|
|
LinearLayout secondContent = view.findViewById(R.id.secondContent); |
|
|
|
LinearLayout main_ll = view.findViewById(R.id.main_ll); |
|
|
|
|
|
|
|
name.setText(rpcStr.get(i).getString("BreedFactory_Name")); |
|
|
|
main_ll.setTag(rpcStr.get(i).getLong("BreedFactory_ID")); |
|
|
|
secondContent.removeAllViews(); |
|
|
|
List<RpcObject> detailsList = rpcStr.get(i).getList("Details"); |
|
|
|
for (int j=0;j<detailsList.size();j++){ |
|
|
|
View view2 = LayoutInflater.from(getActivity()).inflate(R.layout.view_second,null); |
|
|
|
TextView item1 = view2.findViewById(R.id.item1); |
|
|
|
TextView item2 = view2.findViewById(R.id.item2); |
|
|
|
TextView item3 = view2.findViewById(R.id.item3); |
|
|
|
TextView item4 = view2.findViewById(R.id.item4); |
|
|
|
|
|
|
|
if (detailsList.get(j).getLong("Batch_ID")!=null) { |
|
|
|
item1.setText("批次:" + detailsList.get(j).getLong("Batch_ID")); |
|
|
|
}else { |
|
|
|
item1.setText("批次:"); |
|
|
|
} |
|
|
|
|
|
|
|
if (detailsList.get(j).getString("Week")!=null) { |
|
|
|
item2.setText("周龄:" + detailsList.get(j).getString("Week")); |
|
|
|
}else { |
|
|
|
item2.setText("周龄:"); |
|
|
|
} |
|
|
|
if (detailsList.get(j).getDecimal("SurvivalRate")!=null) { |
|
|
|
item3.setText("成活率:" + detailsList.get(j).getDecimal("SurvivalRate").multiply(new BigDecimal("100")).stripTrailingZeros().toPlainString() + "%"); |
|
|
|
}else { |
|
|
|
item3.setText("成活率:"); |
|
|
|
} |
|
|
|
if (detailsList.get(j).getDecimal("EggRate")!=null) { |
|
|
|
item4.setText("产蛋率:" + detailsList.get(j).getDecimal("EggRate").multiply(new BigDecimal("100")).stripTrailingZeros().toPlainString() + "%"); |
|
|
|
}else { |
|
|
|
item4.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()); |
|
|
|
startActivity(intent); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.BatchTotalCount2); |
|
|
|
rpcStr = result.getRpcObjectList(RpcUrl.BatchTotalCount1_fanhui); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}; |
|
|
|
BatchTotalCount2Task.execute(); |
|
|
|
} |
|
|
|
} |