生成标准单据按钮(后台)

@Override
protected void _creat(Context ctx, IObjectValue model) throws BOSException, EASBizException {
LoanBillTempInfo tempInfo = (LoanBillTempInfo) model;
String applier = tempInfo.getApplier();
String cause = tempInfo.getCause();
String bizReqDate = tempInfo.getBizReqDate();

	StringBuffer sql = new StringBuffer();

// sql.append(" /dialect/ “);
sql.append(” select loanbill.fnumber “);
sql.append(” from T_BC_DailyLoanBill loanbill “);
sql.append(” left join T_BD_Person person on loanbill.FApplierId = person.FId “);
sql.append(” where person.FNumber = ‘"+applier+"’ “);
sql.append(” and loanbill.FCause = ‘"+cause+"’ “);
sql.append(” and to_char(loanbill.FBizReqDate,‘yyyy-MM-dd’) = ‘"+bizReqDate+"’");

	IRowSet rs = SQLExecutorFactory.getRemoteInstance(sql.toString()).executeSQL();
	if(rs.size()>0){
		try {
			throw new EASBizException(new NumericExceptionSubItem("","当前数据已生成借款单,编码:"+rs.getString("fnumber")));
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	
	JSONArray arr = new JSONArray();
	// 测试数据
	JSONObject dailyLoanBill = new JSONObject();
	dailyLoanBill.put("bizReqDate", bizReqDate);
	dailyLoanBill.put("cause", cause);
	dailyLoanBill.put("applier",applier);
	dailyLoanBill.put("orgUnit", tempInfo.getOrgUnit());
	dailyLoanBill.put("applierCompany", tempInfo.getApplierCompany());
	dailyLoanBill.put("payMode", tempInfo.getPayMode());
	dailyLoanBill.put("state", tempInfo.getState());
	dailyLoanBill.put("billTypeCode",tempInfo.getBillTypeCode());
	dailyLoanBill.put("applierCompany", tempInfo.getApplierCompany());

	
	JSONObject entry = new JSONObject();// 分录json

	int rowCount = tempInfo.getEntries().size();
	LoanBillTempEntryInfo entryInfo = null;
	for (int i = 0; i < rowCount; i++) {
		entryInfo = tempInfo.getEntries().get(i);
		entry.put("happenTime", entryInfo.getHappenTime());// *必录*费用发生时间
		entry.put("expenseType", entryInfo.getExpenseType());// *必录*费用发生时间
		entry.put("amount", entryInfo.getAmount());// *必录*费用发生时间
		entry.put("amountApproved", entryInfo.getAmountApproved());// *必录*费用发生时间
		entry.put("amountApprovedOri", entryInfo.getAmountApprovedOri());
		entry.put("budgetDo", entryInfo.getBudgetDo());
		entry.put("budgetDoOri", entryInfo.getBudgetDoOri());
		entry.put("amountUsed", entryInfo.getAmountUsed());
		entry.put("amountUsedOri", entryInfo.getAmountUsedOri());
		entry.put("amountBalance", entryInfo.getAmountBalance());
		entry.put("amountBalanceOri", entryInfo.getAmountBalanceOri());
		entry.put("budgetBalance",entryInfo.getBudgetBalance());
		entry.put("budgetUsed", entryInfo.getBudgetUsed());
		entry.put("amountPaid", entryInfo.getAmountPaid());
		entry.put("purpose", entryInfo.getPurpose());
		entry.put("amountOri", entryInfo.getAmountOri());
		entry.put("budgetUsedOri", entryInfo.getBudgetUsedOri());
	}
	
	JSONArray entrys = new JSONArray();
	entrys.add(entry);

	dailyLoanBill.put("entrys", entrys);

	JSONObject collectionEntry = new JSONObject();
	
	int rowCounts = tempInfo.getCollectionEntries().size();
	LoanBillTempCollectionEntryInfo collectionEntryInfo = null;
	for(int i = 0;i < rowCounts;i++){
		collectionEntryInfo = tempInfo.getCollectionEntries().get(i);
		collectionEntry.put("payMode", collectionEntryInfo.getPayMode());// 必录*支付方式
		collectionEntry.put("payerName", collectionEntryInfo.getPayerName());// 必录*收款人
		collectionEntry.put("payerBank", collectionEntryInfo.getPayerBank());// 必录*开户银行
		collectionEntry.put("payerAccount", collectionEntryInfo.getPayerAccount());// 必录*开户银行
		collectionEntry.put("amount", collectionEntryInfo.getAmount());// 必录*开户银行
		collectionEntry.put("amountOri", collectionEntryInfo.getAmountOri());// 必录*开户银行
	}
	JSONArray collectionEntrys = new JSONArray();
	collectionEntrys.add(collectionEntry);
	
	dailyLoanBill.put("collectionEntry", collectionEntrys);
	
	
	
	arr.add(dailyLoanBill);
	CustCommWSFacadeFactory.getRemoteInstance().commWSMethod("com.kingdee.eas.rct.si.content.tools.SyncDailyLoanBill","addnew",arr.toString());
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

gumosang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值