|
|
|
@ -12,9 +12,16 @@ import android.view.View; |
|
|
|
|
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
|
import com.qhclh.ytzh.bean.ProductionDailyDetailBean; |
|
|
|
import com.qhclh.ytzh.home.RpcUrl; |
|
|
|
import com.qhclh.ytzh.tasks.ViewOnClickTask; |
|
|
|
import com.qhclh.ytzh.ui.CalendarDialogFragment; |
|
|
|
import com.qhclh.ytzh.utils.DateTimeUtil; |
|
|
|
|
|
|
|
import org.forks.jsonrpc.JsonRpcResult; |
|
|
|
import org.forks.jsonrpc.RpcFacade; |
|
|
|
import org.forks.jsonrpc.RpcObject; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Date; |
|
|
|
@ -139,6 +146,8 @@ public class ProductiondailywActivity extends BaseActivity implements CalendarDi |
|
|
|
this.weight = weight; |
|
|
|
} |
|
|
|
|
|
|
|
private List<ProductionDailyDetailBean> productionList; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected int setLayoutId() { |
|
|
|
return R.layout.act_productiondailyw; |
|
|
|
@ -158,7 +167,7 @@ public class ProductiondailywActivity extends BaseActivity implements CalendarDi |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initData() { |
|
|
|
|
|
|
|
productionList = new ArrayList<>(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -222,10 +231,16 @@ public class ProductiondailywActivity extends BaseActivity implements CalendarDi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onResume() { |
|
|
|
super.onResume(); |
|
|
|
DayProductRpcNew(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean onCreateOptionsMenu(Menu menu) { |
|
|
|
getMenuInflater().inflate(R.menu.save, menu); |
|
|
|
menu.findItem(R.id.save_info).setVisible(true); |
|
|
|
// menu.findItem(R.id.save_info).setVisible(true); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
@ -233,19 +248,94 @@ public class ProductiondailywActivity extends BaseActivity implements CalendarDi |
|
|
|
public boolean onOptionsItemSelected(MenuItem item) { |
|
|
|
switch (item.getItemId()) { |
|
|
|
case R.id.save_info: |
|
|
|
System.out.println("aaa1--"+getFarmId()); |
|
|
|
System.out.println("aaa2---"+getBatchId()); |
|
|
|
System.out.println("aaa3---"+getAccountId()); |
|
|
|
System.out.println("aaa4---"+getTime()); |
|
|
|
System.out.println("aaa5---"+getHouseid()); |
|
|
|
System.out.println("aaa6---"+getDays()); |
|
|
|
System.out.println("aaa7---"+getCunhuolv()); |
|
|
|
System.out.println("aaa8---"+getDienum()); |
|
|
|
System.out.println("aaa9---"+getTaotai()); |
|
|
|
System.out.println("aaa10---"+getWater()); |
|
|
|
System.out.println("aaa11---"+getWeight()); |
|
|
|
// System.out.println("aaa1--"+getFarmId()); |
|
|
|
// System.out.println("aaa2---"+getBatchId()); |
|
|
|
// System.out.println("aaa3---"+getAccountId()); |
|
|
|
// System.out.println("aaa4---"+getTime()); |
|
|
|
// System.out.println("aaa5---"+getHouseid()); |
|
|
|
// System.out.println("aaa6---"+getDays()); |
|
|
|
// System.out.println("aaa7---"+getCunhuolv()); |
|
|
|
// System.out.println("aaa8---"+getDienum()); |
|
|
|
// System.out.println("aaa9---"+getTaotai()); |
|
|
|
// System.out.println("aaa10---"+getWater()); |
|
|
|
// System.out.println("aaa11---"+getWeight()); |
|
|
|
|
|
|
|
ProductionDailyDetailBean productionBean = new ProductionDailyDetailBean(); |
|
|
|
productionBean.setHouse_ID(getHouseid()); |
|
|
|
productionBean.setDays(getDays()); |
|
|
|
productionBean.setCunhuolv(getCunhuolv()); |
|
|
|
productionBean.setDieNumber(getDienum()); |
|
|
|
productionBean.setObsolete(getTaotai()); |
|
|
|
productionBean.setWaterIntake(getWater()); |
|
|
|
productionBean.setWeight(getWeight()); |
|
|
|
productionList.add(productionBean); |
|
|
|
showToast("保存一条明细成功"); |
|
|
|
break; |
|
|
|
case R.id.commit_info: |
|
|
|
DayProductRpcInsert(); |
|
|
|
break; |
|
|
|
} |
|
|
|
return super.onOptionsItemSelected(item); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RpcObject bill; |
|
|
|
|
|
|
|
private void DayProductRpcNew() { |
|
|
|
ViewOnClickTask DayProductRpcNewTask = new ViewOnClickTask(this,"加载中...") { |
|
|
|
@Override |
|
|
|
protected void successUI() { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
|
|
|
|
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.DayProductRpc_New); |
|
|
|
bill = result.getRpcObject(RpcUrl.DayProductRpc_Query_fanhui); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}; |
|
|
|
DayProductRpcNewTask.execute(); |
|
|
|
} |
|
|
|
|
|
|
|
private void DayProductRpcInsert() { |
|
|
|
ViewOnClickTask DayProductRpcInsertTask = new ViewOnClickTask(this,"加载中...") { |
|
|
|
RpcObject rpcobj; |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void successUI() { |
|
|
|
showToast("提交成功"); |
|
|
|
finish(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public Object call() throws Exception { |
|
|
|
///< 带多样参数的集合 |
|
|
|
RpcObject parmObject = bill; |
|
|
|
parmObject.setLong("BreedFactory_ID",getFarmId()); |
|
|
|
parmObject.setLong("Batch_ID",getBatchId()); |
|
|
|
parmObject.setLong("AccountingUnit_ID",getAccountId()); |
|
|
|
parmObject.setDate("Date",getTime()); |
|
|
|
|
|
|
|
for (int i=0;i<productionList.size();i++) { |
|
|
|
RpcObject setDetails = RpcObject.create(RpcUrl.DayProductRpc_Insert_detail); |
|
|
|
setDetails.setLong("House_ID", productionList.get(i).getHouse_ID()); |
|
|
|
setDetails.setInt("Days", productionList.get(i).getDays()); |
|
|
|
// setDetails.setDecimal("cunhuolv",getCunhuolv()); |
|
|
|
setDetails.setInt("DieNumber", productionList.get(i).getDieNumber()); |
|
|
|
setDetails.setInt("Obsolete", productionList.get(i).getObsolete()); |
|
|
|
setDetails.setDecimal("WaterIntake", productionList.get(i).getWaterIntake()); |
|
|
|
setDetails.setDecimal("Weight", productionList.get(i).getWeight()); |
|
|
|
|
|
|
|
parmObject.getManyList("Details").add(setDetails); |
|
|
|
} |
|
|
|
|
|
|
|
JsonRpcResult result = RpcFacade.rpcCall(RpcUrl.DayProductRpc_Insert,parmObject); |
|
|
|
rpcobj = result.getRpcObject(RpcUrl.DayProductRpc_Insert_canshufanhui); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}; |
|
|
|
DayProductRpcInsertTask.execute(); |
|
|
|
} |
|
|
|
} |