表单插件:计息单生成付款单传递选中行参数至操作插件
This commit is contained in:
parent
ef4a83f199
commit
16c64e2e49
|
|
@ -0,0 +1,112 @@
|
|||
package kdsz.zyf25.tmc.cfm.plugin.form.cdm;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* 计息单生成付款单表单插件:向操作插件传入选中分录的参数
|
||||
*/
|
||||
public class InterestAccrualGenPaymentBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
private static final Logger logger = LoggerFactory.getLogger(InterestAccrualGenPaymentBillPlugin.class);
|
||||
|
||||
@Override
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
this.addItemClickListeners("kdsz_pushpayment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||
super.beforeItemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
// if ("kdsz_pushpayment".equals(itemKey)) {
|
||||
// //校验
|
||||
// String billStatus = (String) this.getModel().getValue("billstatus");
|
||||
// if (!"C".equals(billStatus)) {
|
||||
// this.getView().showMessage("只有已审核的单据才能生成付款单");
|
||||
// evt.setCancel(true);
|
||||
// return;
|
||||
// }
|
||||
// EntryGrid entryGrid = this.getControl("entryentity");
|
||||
// int[] selectRows = entryGrid.getSelectRows();
|
||||
// if (selectRows == null || selectRows.length == 0){
|
||||
// this.getView().showMessage("请选择要生成付款单的行");
|
||||
// evt.setCancel(true);
|
||||
// }else {
|
||||
// StringBuilder str = new StringBuilder();
|
||||
// for (int selectRow : selectRows) {
|
||||
// DynamicObject paymentBill = (DynamicObject) this.getModel().getValue("kdsz_e_paybill", selectRow);
|
||||
// if (paymentBill != null){
|
||||
// str.append("第").append(selectRow+1).append("行已生成付款单,请勿重复生成。\n");
|
||||
// }
|
||||
// }
|
||||
// if (str.length() > 0){
|
||||
// this.getView().showMessage(str.toString());
|
||||
// evt.setCancel(true);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
FormOperate formOperate = (FormOperate)args.getSource();
|
||||
//下推付款单
|
||||
if ( StringUtils.equals("pushpayment", formOperate.getOperateKey())){
|
||||
EntryGrid entryGrid = this.getControl("entryentity");
|
||||
int[] selectRows = entryGrid.getSelectRows();
|
||||
if (selectRows == null || selectRows.length == 0){
|
||||
this.getView().showMessage("请选择要生成付款单的行");
|
||||
args.setCancel(true);
|
||||
return;
|
||||
}
|
||||
DynamicObject bill = this.getModel().getDataEntity();
|
||||
// formOperate.getOption().setVariableValue(bill.getString("id"), Arrays.toString(selectRows));
|
||||
formOperate.getOption().setVariableValue(bill.getString("id"), Arrays.toString(selectRows));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void itemClick(ItemClickEvent evt) {
|
||||
super.itemClick(evt);
|
||||
String itemKey = evt.getItemKey();
|
||||
// if ("kdsz_pushpayment".equals(itemKey)){
|
||||
// String billNo = (String)this.getModel().getValue("billno");
|
||||
// EntryGrid entryGrid = this.getControl("entryentity");
|
||||
// int[] selectRows = entryGrid.getSelectRows();
|
||||
// //生成付款单
|
||||
// OperationResult result = generatePaymentBill(selectRows);
|
||||
// if (result.isSuccess()){
|
||||
// this.getView().showSuccessNotification("生成付款单成功");
|
||||
// logger.info("------计息单:"+billNo+"生成付款单成功");
|
||||
// writeLkInfo(selectRows,result.getSuccessPkIds().get(0));
|
||||
// }else {
|
||||
// StringBuilder str = new StringBuilder();
|
||||
// str.append("生成付款单失败。");
|
||||
// List<IOperateInfo> allErrorOrValidateInfo = result.getAllErrorOrValidateInfo();
|
||||
// if (allErrorOrValidateInfo != null){
|
||||
// str.append("message:\n");
|
||||
// for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
// str.append(iOperateInfo.getMessage()).append("\n");
|
||||
// }
|
||||
// }
|
||||
// this.getView().showErrorNotification(str.toString());
|
||||
// logger.info("------计息单:"+billNo+"生成付款单失败");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue