diff --git a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp index ef4b75166..40ab458ca 100644 --- a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp +++ b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp @@ -17,6 +17,7 @@ {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","","Button","复制凭证","复制凭证","if(confirm('确定复制凭证?'))copyVoucher()","","","","btn_icon_detail",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java b/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java index 229c58c83..108e78d36 100644 --- a/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java +++ b/src_core/com/tenwa/voucher/serviceImp/CreateVoucherServiceImpl.java @@ -13,6 +13,7 @@ import jbo.voucher.LV_AUXILIARY_ACCOUNT; import jbo.voucher.LV_BASIC_PARAM; import jbo.voucher.LV_DEFAULT_ATTRIBUTE; import jbo.voucher.LV_STACTS_CONFIG; +import jbo.voucher.LV_VOUCHER_CONFIG; import jbo.voucher.LV_VOUCHER_LOAN; import com.amarsoft.are.ARE; @@ -23,6 +24,7 @@ import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.are.log.Log; import com.amarsoft.awe.Configure; import com.tenwa.comm.exception.BusinessException; +import com.tenwa.comm.util.jboutil.DataOperatorUtil; import com.tenwa.quartz.StringUtil; import com.tenwa.reckon.util.DateUtil; import com.tenwa.voucher.service.InitVoucherService; @@ -32,7 +34,45 @@ import com.tenwa.voucher.service.VoucherService; public class CreateVoucherServiceImpl { private static Log logger=ARE.getLog(); + public String userid; + public String voucherid; + public String voucherConfigId; + public String modularnumber; + + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getVoucherid() { + return voucherid; + } + + public void setVoucherid(String voucherid) { + this.voucherid = voucherid; + } + + public String getVoucherConfigId() { + return voucherConfigId; + } + + public void setVoucherConfigId(String voucherConfigId) { + this.voucherConfigId = voucherConfigId; + } + + public String getModularnumber() { + return modularnumber; + } + + public void setModularnumber(String modularnumber) { + this.modularnumber = modularnumber; + } + public void test(JBOTransaction tx) throws Exception{ //示例 @@ -297,4 +337,41 @@ public class CreateVoucherServiceImpl { return data; } + + //复制凭证 + public String copyVoucherConfig(JBOTransaction tx){ + String result = "false"; + Map fromCondtion = new HashMap(); + Map otherProperty = new HashMap(); + try { + fromCondtion.clear(); + otherProperty.clear(); + fromCondtion.put("id", voucherConfigId); + otherProperty.put("MODULAR_NUMBER", "复制--"+modularnumber); + String newID = ""; + newID = DataOperatorUtil.copySingleJBO(LV_VOUCHER_CONFIG.CLASS_NAME, fromCondtion, LV_VOUCHER_CONFIG.CLASS_NAME, null, otherProperty, tx); + String sql = "select id from lv_voucher_loan where voucher_id=" + "'" + voucherConfigId + "'"; + Map param = new HashMap(); + List> list = DataOperatorUtil.getDataBySql(tx, sql, param); + for(Map ma:list){ + fromCondtion.clear(); + otherProperty.clear(); + fromCondtion = ma; + otherProperty.put("voucher_id", newID); + DataOperatorUtil.copySingleJBO(LV_VOUCHER_LOAN.CLASS_NAME, fromCondtion, LV_VOUCHER_LOAN.CLASS_NAME, null, otherProperty, tx); + } + } catch (Exception e) { + try { + tx.rollback(); + } catch (Exception e2) { + // TODO: handle exception + e2.printStackTrace(); + } + e.printStackTrace(); + result = "error"; + return result; + } + result = "success"; + return result; + } }