s-HR8.5及以上判断单据是否上传了附件
举例如下代码demo,以handler(AttachmentDemoHandler)为例,其继承至EditHandler,详细逻辑建代码及其注释,二开代码可以自行灵活组装或者调用
目前对新增单据上传附件,同一个用户,同一个功能(uipk),不要并行操作(开启多个浏览器,同时录入多个表单数据并上传附件),会导致判断失效,需要一个一个录入
package com.kingdee.shr.base.syssetting.web.handler; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.ui.ModelMap; import com.kingdee.bos.BOSException; import com.kingdee.bos.Context; import com.kingdee.bos.metadata.entity.FilterInfo; import com.kingdee.bos.metadata.entity.FilterItemInfo; import com.kingdee.eas.base.attachment.BoAttchAssoFactory; import com.kingdee.eas.common.EASBizException; import com.kingdee.shr.attachment.SHRAttachmentExtFactory; import com.kingdee.shr.base.syssetting.app.filter.HRFilterUtils; import com.kingdee.shr.base.syssetting.context.SHRContext; import com.kingdee.shr.base.syssetting.exception.SHRWebException; import com.kingdee.shr.base.syssetting.exception.ShrWebBizException; import com.kingdee.util.StringUtils; public class AttachmentDemoHandler extends EditHandler { /** * 前端方法入口,js调用 * @param request * @param response * @param modelMap * @return * @throws SHRWebException */ public String checkIsExistsAttachmentAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException { this.writeSuccessData(checkIsExistsAttachment(request));//这个前端需要处理ajax的回调结果 return null; } /** * 后端判断单据是否上传了附件附件 * @param request * @return * @throws SHRWebException */ private boolean checkIsExistsAttachment(HttpServletRequest request) throws SHRWebException { Context ctx = SHRContext.getInstance().getContext(); String boId = request.getParameter("billId"); try { if (StringUtils.isEmpty(boId)) { //新增单据时候,判断是否有附件只需判断s-HR附件扩展表是否上传附件 String uipk = request.getParameter("uipk"); String userId = HRFilterUtils.getCurrentUserId(ctx); String bunding = userId + "#" + uipk; FilterInfo filter1 = new FilterInfo(); filter1.getFilterItems().add(new FilterItemInfo("bunding", bunding)); if (SHRAttachmentExtFactory.getLocalInstance(ctx).exists(filter1)) { return true; } } else { //修改单据,判断bos附件表是否有新增单据 FilterInfo filter = new FilterInfo(); filter.getFilterItems().add(new FilterItemInfo("boID", boId)); if (BoAttchAssoFactory.getLocalInstance(ctx).exists(filter)) { return true; } } return false; } catch (EASBizException e) { throw new ShrWebBizException(e); } catch (BOSException e) { throw new SHRWebException(e); } } }
s-HR8.5及以上判断单据是否上传了附件
举例如下代码demo,以handler(AttachmentDemoHandler)为例,其继承至EditHandler,详细逻辑建代码及其注释,二开代码可以自行灵活组装或...
点击下载文档
本文2024-09-16 23:44:17发表“s-hr cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-shr-56478.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章