diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TaskApproveFormCkPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TaskApproveFormCkPlugin.java index 4c01644..58d48cd 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TaskApproveFormCkPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TaskApproveFormCkPlugin.java @@ -8,20 +8,37 @@ import kd.bos.form.control.Control; import kd.bos.form.control.events.BeforeClickEvent; import kd.bos.form.control.events.BeforeItemClickEvent; import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.logging.Log; +import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.ssc.task.formplugin.util.VoucherUtil; import java.util.EventObject; +import java.util.HashSet; import java.util.Map; import java.util.Set; + /** * 我的共享,任务审批时增加付款完成校验 */ public class TaskApproveFormCkPlugin extends AbstractFormPlugin { + private static final Log log = LogFactory.getLog(TaskApproveFormCkPlugin.class); + private static Set billTypes = new HashSet(); + static { + billTypes.add("er_repaymentbill"); + + billTypes.add("er_dailyreimbursebill"); + billTypes.add("er_publicreimbursebill"); + billTypes.add("er_tripreimbursebill"); + billTypes.add("er_dailyloanbill"); + billTypes.add("er_prepaybill"); + billTypes.add("er_applypaybill"); + billTypes.add("cas_paybill"); + } // public void registerListener(EventObject evt) { this.addClickListeners(new String[]{"submit", "submitandnext"}); @@ -48,41 +65,49 @@ public class TaskApproveFormCkPlugin extends AbstractFormPlugin { String billid = ""; String billNo = null; if (customParams != null) { + log.info("TaskApproveFormCkPlugin:"+customParams.toString()); + log.info("TaskApproveFormCkPlugin:billtypeid "+customParams.get("billtypeid")); + log.info("TaskApproveFormCkPlugin:tasktypeid "+customParams.get("tasktypeid")); + log.info("TaskApproveFormCkPlugin:sscid "+customParams.get("sscid")); + log.info("TaskApproveFormCkPlugin:billnumber "+customParams.get("billnumber")); + log.info("TaskApproveFormCkPlugin:billid "+customParams.get("billid")); billtypeid = (Long)customParams.get("billtypeid");//单据类型id tasktypeid = (Long)customParams.get("tasktypeid");//任务类型id - sscid = (Long)customParams.get("sscid");//任务类型id + sscid = Long.valueOf((String)customParams.get("sscid"));//任务类型id billnumber = (String)customParams.get("billnumber");//单据编码(单据标识 entityName) billid = (String)customParams.get("billid");//业务单据id billNo = VoucherUtil.getTaskBillNo(billid);//业务单据编号 - IDataModel model = this.getModel(); - String operation = (String)model.getValue("operationgroupfield"); - if ("1".equals(operation)) { //如果审批操作是通过 - QFilter tasktypeFilter = new QFilter("orgfield.id", QCP.equals,sscid); - tasktypeFilter.and(new QFilter("tasklevel", QCP.equals,"2"));//任务类型为:结算时 - DynamicObject[] tasktypeArray = BusinessDataServiceHelper.load("task_tasktype", "id", new QFilter[]{tasktypeFilter}); - if(tasktypeArray != null && tasktypeArray.length > 0){ - DynamicObject tasktype = tasktypeArray[0]; - if(tasktypeid.getLong("id") == tasktype.getLong("id")) { - if(StringUtils.isNotBlank(billNo) && StringUtils.isNotBlank(billid) && StringUtils.isNotBlank(billnumber) ) { - QFilter accountTableFilter = new QFilter("id", QCP.equals,Long.valueOf(billid)); - DynamicObject sourceBillObject = BusinessDataServiceHelper.loadSingle(billnumber, new QFilter[]{accountTableFilter}); - String billstatus = sourceBillObject.getString("billstatus"); - if(!"G".equals(billstatus)) { - if("er_repaymentbill".equals(billnumber)) { - this.getView().showErrorNotification(String.format("审批结算任务:当前单据的收款未完成,请完成收款后提交。")); - evt.setCancel(true); - }else if( - "er_dailyreimbursebill".equals(billnumber) || //费用报销单 - "er_publicreimbursebill".equals(billnumber) || //对公报销的呢 - "er_tripreimbursebill".equals(billnumber) || //差旅报销单 - "er_dailyloanbill".equals(billnumber) || //借款单 - "er_prepaybill".equals(billnumber) || //预付单 - "er_applypaybill".equals(billnumber) || //付款申请单 - "cas_paybill".equals(billnumber) //付款处理单 - ){ - this.getView().showErrorNotification(String.format("审批结算任务:当前单据的付款未完成,请完成付款后提交。")); - evt.setCancel(true); + if(billTypes.contains(billnumber)){ + IDataModel model = this.getModel(); + String operation = (String)model.getValue("operationgroupfield"); + if ("1".equals(operation)) { //如果审批操作是通过 + QFilter tasktypeFilter = new QFilter("orgfield.id", QCP.equals,sscid); + tasktypeFilter.and(new QFilter("tasklevel", QCP.equals,"2"));//任务类型为:结算时 + DynamicObject[] tasktypeArray = BusinessDataServiceHelper.load("task_tasktype", "id", new QFilter[]{tasktypeFilter}); + if(tasktypeArray != null && tasktypeArray.length > 0){ + DynamicObject tasktype = tasktypeArray[0]; + if(tasktypeid == tasktype.getLong("id")) { + if(StringUtils.isNotBlank(billNo) && StringUtils.isNotBlank(billid) && StringUtils.isNotBlank(billnumber) ) { + QFilter accountTableFilter = new QFilter("id", QCP.equals,Long.valueOf(billid)); + DynamicObject sourceBillObject = BusinessDataServiceHelper.loadSingle(billnumber, new QFilter[]{accountTableFilter}); + String billstatus = sourceBillObject.getString("billstatus"); + if(!"G".equals(billstatus)) { + if("er_repaymentbill".equals(billnumber)) { + this.getView().showErrorNotification(String.format("审批结算任务:当前单据的收款未完成,请完成收款后提交。")); + evt.setCancel(true); + }else if( + "er_dailyreimbursebill".equals(billnumber) || //费用报销单 + "er_publicreimbursebill".equals(billnumber) || //对公报销的呢 + "er_tripreimbursebill".equals(billnumber) || //差旅报销单 + "er_dailyloanbill".equals(billnumber) || //借款单 + "er_prepaybill".equals(billnumber) || //预付单 + "er_applypaybill".equals(billnumber) || //付款申请单 + "cas_paybill".equals(billnumber) //付款处理单 + ){ + this.getView().showErrorNotification(String.format("审批结算任务:当前单据的付款未完成,请完成付款后提交。")); + evt.setCancel(true); + } } } } @@ -91,11 +116,6 @@ public class TaskApproveFormCkPlugin extends AbstractFormPlugin { } } - //System.out.println(billtypeid); - //System.out.println(tasktypeid); - //System.out.println(billnumber); - //System.out.println(billid); - //System.out.println(billNo); } }