dep扩展-付款申请单
业务场景:付款申请单需要根据工作流中的当前处理人和当前用户是否一致控制单据附件的新增删除功能是否可用
1.新建付款申请单dep方案,添加扩展脚本
![image.webp](/download/01004e72f9a93abd45239fdf9924ffefe3e3.webp)
2.在附件管理功能添加前置脚本,根据现场的业务场景修改附件控制
![image.webp](/download/010085eac676ec1a431c9da238ee92373e7a.webp)
付款申请单编辑界面脚本:
```language
var imp = JavaImporter();
imp.importPackage(Packages.com.kingdee.eas.base.attachment.common);
imp.importPackage(Packages.com.kingdee.eas.fi.ar);
with(imp){
var acm = AttachmentManagerFactory.getClientManager();
var editData = pluginCtx.getDataObject();//获取当前界面对象
if ("ADDNEW".equals(pluginCtx.getUI().getOprtState())) {
//新增状态不要处理走原逻辑
} else {
var boID = editData.getId() != null? editData.getId().toString() : null;
var sql = new java.lang.StringBuilder(100);
sql.append(" SELECT distinct ");
sql.append(" ASSIGN.FACTDEFNAME_L2 AS FACTDEFNAME ,");
sql.append(" ASSIGN.FPERSONEMPNAME_L2 AS FPERSONEMPNAME ,");
sql.append(" ASSIGN.FPERSONUSERID AS FPERSONID ");
sql.append(" FROM T_WFR_ProcInst AS PROCINST ");
sql.append(" INNER JOIN T_WFR_Assign AS ASSIGN ON ASSIGN.FPROCINSTID=PROCINST.FPROCINSTID ");
sql.append(" WHERE (PROCINST.FPROCDEFTYPE = 'NORMAL' OR PROCINST.FPROCDEFTYPE = 'MICRO') ");
sql.append(" AND PROCINST.FSTATE LIKE 'open%' ");
sql.append(" AND ASSIGN.FBIZOBJID = '").append(boID).append("'");
var currentUserId = com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentUserInfo().getId().toString();
var rowSet = com.kingdee.eas.fi.arap.DbUtilFacadeFactory.getRemoteInstance().executeQuery(sql.toString());
var personCol = new java.util.HashSet();
while(rowSet.next()){
personCol.add(rowSet.getString("FPERSONID"));
}
if(personCol.size() > 0 && !personCol.contains(currentUserId)){//工作流当前处理人中不包含当前登录用户时处理
acm.showAttachmentListUIByBoID(boID, this,
false, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
} else if (BillStatusEnum.SAVE.equals(editData.getBillStatus())){//保存
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
true, //是否允许删除
true); //是否允许编辑
} else if(BillStatusEnum.SUBMITED.equals(editData.getBillStatus())){//提交
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
true, //是否允许删除
true); //是否允许编辑
}else if(BillStatusEnum.AUDITED.equals(editData.getBillStatus())){//审核
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
}else{//默认
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
}
com.kingdee.eas.util.SysUtil.abort(); //直接中断原逻辑处理
}
}
```
付款申请单序时簿脚本:
```language
//通过DEP在编辑界面-操作-附件管理中增加前置脚本
var imp = JavaImporter();
imp.importPackage(Packages.com.kingdee.eas.base.attachment.common);
imp.importPackage(Packages.com.kingdee.eas.fi.ar);
with(imp){
var acm = AttachmentManagerFactory.getClientManager();
var table = pluginCtx.getKDTable("tblMain");
//获取选择单据ID
var selectRows = com.kingdee.bos.ctrl.kdf.table.util.KDTableUtil.getSelectedRows(table);
var boID =com.kingdee.eas.framework.client.ListUiHelper.getSelectedKeyValue(selectRows,table,"id");
var billInfo = com.kingdee.eas.fi.ap.PayRequestBillFactory.getRemoteInstance().getPayRequestBillInfo("select billstatus where id ='" + boID + "'");
var billStatus = billInfo.getBillStatus();
var sql = new java.lang.StringBuilder(100);
sql.append(" SELECT distinct ");
sql.append(" ASSIGN.FACTDEFNAME_L2 AS FACTDEFNAME ,");
sql.append(" ASSIGN.FPERSONEMPNAME_L2 AS FPERSONEMPNAME ,");
sql.append(" ASSIGN.FPERSONUSERID AS FPERSONID ");
sql.append(" FROM T_WFR_ProcInst AS PROCINST ");
sql.append(" INNER JOIN T_WFR_Assign AS ASSIGN ON ASSIGN.FPROCINSTID=PROCINST.FPROCINSTID ");
sql.append(" WHERE (PROCINST.FPROCDEFTYPE = 'NORMAL' OR PROCINST.FPROCDEFTYPE = 'MICRO') ");
sql.append(" AND PROCINST.FSTATE LIKE 'open%' ");
sql.append(" AND ASSIGN.FBIZOBJID = '").append(boID).append("'");
var currentUserId = com.kingdee.eas.common.client.SysContext.getSysContext().getCurrentUserInfo().getId().toString();
var rowSet = com.kingdee.eas.fi.arap.DbUtilFacadeFactory.getRemoteInstance().executeQuery(sql.toString());
var personCol = new java.util.HashSet();
while(rowSet.next()){
personCol.add(rowSet.getString("FPERSONID"));
}
if(personCol.size() > 0 && !personCol.contains(currentUserId)){//工作流当前处理人中不包含当前登录用户时处理
acm.showAttachmentListUIByBoID(boID, this,
false, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
} else if (BillStatusEnum.SAVE.equals(billStatus)){//保存
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
true, //是否允许删除
true); //是否允许编辑
} else if(BillStatusEnum.SUBMITED.equals(billStatus)){//提交
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
true, //是否允许删除
true); //是否允许编辑
}else if(BillStatusEnum.AUDITED.equals(billStatus)){//审核
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
}else{//默认
acm.showAttachmentListUIByBoID(boID, this,
true, //是否允许新增
false, //是否允许删除
false); //是否允许编辑
}
com.kingdee.eas.util.SysUtil.abort(); //直接中断原逻辑处理
}
```
dep扩展-付款申请单
业务场景:付款申请单需要根据工作流中的当前处理人和当前用户是否一致控制单据附件的新增删除功能是否可用1.新建付款申请单dep方案,添加...
点击下载文档
本文2024-09-22 19:05:49发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-105020.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章