diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/tmc/inputBondEntryDataPlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/tmc/inputBondEntryDataPlugin.java index 4d33396..84875e7 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/tmc/inputBondEntryDataPlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/tmc/inputBondEntryDataPlugin.java @@ -3,6 +3,9 @@ package shkd.sys.sys.plugin.tmc; import kd.bos.bill.AbstractBillPlugIn; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.entity.datamodel.IDataModel; +import kd.bos.entity.datamodel.RowDataEntity; +import kd.bos.entity.datamodel.events.AfterAddRowEventArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.servicehelper.BusinessDataServiceHelper; @@ -16,7 +19,7 @@ public class inputBondEntryDataPlugin extends AbstractBillPlugIn implements Plug public void propertyChanged(PropertyChangedArgs e) { String name = e.getProperty().getName(); int rowIndex = e.getChangeSet()[0].getRowIndex(); - if("shkd_entrybillno".equals(name)) { + if ("shkd_entrybillno".equals(name)) { //FIXME:修改值改变方案,当前方案不支持多选展示 // DynamicObject shkdEntrybillno = (DynamicObject) this.getView().getModel().getValue("shkd_entrybillno"); // DynamicObject cfm_loanbill_bond = BusinessDataServiceHelper.loadSingle(shkdEntrybillno.get("id"), "cfm_loanbill_bond"); @@ -30,29 +33,29 @@ public class inputBondEntryDataPlugin extends AbstractBillPlugIn implements Plug // this.getModel().setValue("shkd_entrystartdate", cfm_loanbill_bond.get("bizdate"),rowIndex); // //到期日期 // this.getModel().setValue("shkd_entryexpiredate", cfm_loanbill_bond.get("expiredate"),rowIndex); - DynamicObjectCollection bondissueEntry = (DynamicObjectCollection)this.getView().getModel().getValue("shkd_bondissue_entry"); + DynamicObjectCollection bondissueEntry = (DynamicObjectCollection) this.getView().getModel().getValue("shkd_bondissue_entry"); for (int i = 0; i < bondissueEntry.size(); i++) { //获取每一行的数据,反写到每一行 DynamicObject temp = bondissueEntry.get(i); DynamicObject entrybillno = temp.getDynamicObject("shkd_entrybillno"); DynamicObject cfm_loanbill_bond = BusinessDataServiceHelper.loadSingle(entrybillno.get("id"), "cfm_loanbill_bond"); //债券简码 - this.getModel().setValue("shkd_shortname", cfm_loanbill_bond.get("shortname"),i); + this.getModel().setValue("shkd_shortname", cfm_loanbill_bond.get("shortname"), i); //债券发行人 - this.getModel().setValue("shkd_entryorg", cfm_loanbill_bond.get("org"),i); + this.getModel().setValue("shkd_entryorg", cfm_loanbill_bond.get("org"), i); //起息日期 - this.getModel().setValue("shkd_startintdate", cfm_loanbill_bond.get("startintdate"),i); + this.getModel().setValue("shkd_startintdate", cfm_loanbill_bond.get("startintdate"), i); //到期日期 - this.getModel().setValue("shkd_entryexpiredate", cfm_loanbill_bond.get("expiredate"),i); + this.getModel().setValue("shkd_entryexpiredate", cfm_loanbill_bond.get("expiredate"), i); //发行金额 - this.getModel().setValue("shkd_entryamount", cfm_loanbill_bond.get("drawamount"),i); + this.getModel().setValue("shkd_entryamount", cfm_loanbill_bond.get("drawamount"), i); //发行利率 - this.getModel().setValue("shkd_startloanrate", cfm_loanbill_bond.get("startloanrate"),i); + this.getModel().setValue("shkd_startloanrate", cfm_loanbill_bond.get("startloanrate"), i); //融资余额 - this.getModel().setValue("shkd_notrepayamount", cfm_loanbill_bond.get("notrepayamount"),i); + this.getModel().setValue("shkd_notrepayamount", cfm_loanbill_bond.get("notrepayamount"), i); } } - if("shkd_entrycontractnum".equals(name)) { + if ("shkd_loanbill".equals(name)) { //FIXME:修改值改变方案,当前方案不支持多选展示 // DynamicObject shkd_entrycontractnum = (DynamicObject) this.getView().getModel().getValue("shkd_entrycontractnum"); // DynamicObject cfm_loancontractbill = BusinessDataServiceHelper.loadSingle(shkd_entrycontractnum.get("id"), "cfm_loancontractbill"); @@ -63,26 +66,76 @@ public class inputBondEntryDataPlugin extends AbstractBillPlugIn implements Plug // //合同结束日期 // this.getModel().setValue("shkd_contractenddate", cfm_loancontractbill.get("enddate"),rowIndex); - DynamicObjectCollection shkdBankcontractEntry = (DynamicObjectCollection) this.getView().getModel().getValue("shkd_bankcontract_entry"); - for (int i = 0; i < shkdBankcontractEntry.size(); i++) { - //获取每一行的数据,反写到每一行 - DynamicObject temp = shkdBankcontractEntry.get(i); - DynamicObject shkdLoanbill = temp.getDynamicObject("shkd_loanbill"); + DynamicObjectCollection shkdBankcontractEntry = this.getModel().getEntryEntity("shkd_bankcontract_entry"); +// for (int i = 0; i < shkdBankcontractEntry.size(); i++) { +// +// } + //获取每一行的数据,反写到每一行 + DynamicObject temp = shkdBankcontractEntry.get(rowIndex); + DynamicObject shkdLoanbill = temp.getDynamicObject("shkd_loanbill"); + if (shkdLoanbill == null) { + //借款人 + this.getModel().setValue("shkd_enryborrower", null, rowIndex); + //贷款人 + this.getModel().setValue("shkd_textcreditor", null, rowIndex); + //起息日期 + this.getModel().setValue("shkd_startintdate1", null, rowIndex); + //到期日期 + this.getModel().setValue("shkd_entryexpiredate1", null, rowIndex); + //提款金额 + this.getModel().setValue("shkd_drawamount", null, rowIndex); + //融资利率 + this.getModel().setValue("shkd_startloanrate1", null, rowIndex); + //融资余额 + this.getModel().setValue("shkd_notrepayamount1", null, rowIndex); + } else { DynamicObject cfm_loancontractbill = BusinessDataServiceHelper.loadSingle(shkdLoanbill.get("id"), "cfm_loanbill"); //借款人 - this.getModel().setValue("shkd_enryborrower", cfm_loancontractbill.get("org"), i); - //债权人 - this.getModel().setValue("shkd_entryorg", cfm_loancontractbill.get("textcreditor"), i); + this.getModel().setValue("shkd_enryborrower", cfm_loancontractbill.get("org"), rowIndex); + //贷款人 + this.getModel().setValue("shkd_textcreditor", cfm_loancontractbill.get("textcreditor"), rowIndex); //起息日期 - this.getModel().setValue("shkd_startintdate1", cfm_loancontractbill.get("startintdate"), i); + this.getModel().setValue("shkd_startintdate1", cfm_loancontractbill.get("startintdate"), rowIndex); //到期日期 - this.getModel().setValue("shkd_entryexpiredate1", cfm_loancontractbill.get("expiredate"), i); + this.getModel().setValue("shkd_entryexpiredate1", cfm_loancontractbill.get("expiredate"), rowIndex); //提款金额 - this.getModel().setValue("shkd_entryamount", cfm_loancontractbill.get("drawamount"), i); + this.getModel().setValue("shkd_drawamount", cfm_loancontractbill.get("drawamount"), rowIndex); //融资利率 - this.getModel().setValue("shkd_startloanrate", cfm_loancontractbill.get("startloanrate"), i); + this.getModel().setValue("shkd_startloanrate1", cfm_loancontractbill.get("startloanrate"), rowIndex); //融资余额 - this.getModel().setValue("shkd_notrepayamount", cfm_loancontractbill.get("notrepayamount"), i); + this.getModel().setValue("shkd_notrepayamount1", cfm_loancontractbill.get("notrepayamount"), rowIndex); + } + } + } + + @Override + public void afterAddRow(AfterAddRowEventArgs e) { + String name = e.getEntryProp().getName(); + if ("shkd_bankcontract_entry".equals(name)) { + RowDataEntity[] rowDataEntities = e.getRowDataEntities(); + for (RowDataEntity rowDataEntity : rowDataEntities) { + int rowIndex = rowDataEntity.getRowIndex(); + DynamicObject entry = rowDataEntity.getDataEntity(); + + DynamicObject loanBill = entry.getDynamicObject("shkd_loanbill"); + if (loanBill != null) { + IDataModel model = this.getModel(); + DynamicObject cfm_loancontractbill = BusinessDataServiceHelper.loadSingle(loanBill.getPkValue(), "cfm_loanbill"); + //借款人 + model.setValue("shkd_enryborrower", cfm_loancontractbill.get("org"), rowIndex); + //贷款人 + model.setValue("shkd_textcreditor", cfm_loancontractbill.get("textcreditor"), rowIndex); + //起息日期 + model.setValue("shkd_startintdate1", cfm_loancontractbill.get("startintdate"), rowIndex); + //到期日期 + model.setValue("shkd_entryexpiredate1", cfm_loancontractbill.get("expiredate"), rowIndex); + //提款金额 + model.setValue("shkd_drawamount", cfm_loancontractbill.get("drawamount"), rowIndex); + //融资利率 + model.setValue("shkd_startloanrate1", cfm_loancontractbill.get("startloanrate"), rowIndex); + //融资余额 + model.setValue("shkd_notrepayamount1", cfm_loancontractbill.get("notrepayamount"), rowIndex); + } } } }