物料审核时,在不打开内嵌基础资料界面的情况下,同步审核内嵌基础资料原创
5人赞赏了该文章
835次浏览
编辑于2020年12月25日 10:34:44
1、在单据已提交状态下根据条件显示采购信息、库存信息、销售信息、生产信息
2、插件调用子页签
Tab tab = this.getView().getControl("页签控件标识");
tab.activeTab("子页签标识");
调用子页签时,最后面是在调用一次基本信息页签,这样界面就不会显示到我们插件调用的采购信息等页签
3、获取页面打开状态
FormShowParameter formShowParameter = this.getView().getFormShowParameter(); OperationStatus status = formShowParameter.getStatus();
4、打开信息页签
//bd_materialpurchaseinfo -物料采购信息基础资料标识
//purchaseinfo -物料基础资料中采购信息页签标识
//status -页面打开状态
this.openInfoPage("bd_materialpurchaseinfo", "purchaseinfo", "", (Object) null, status, true);
private void openInfoPage(String entityNumber, String curSelTabKey, String pageId, Object dataId, OperationStatus operationStatus, boolean isAllEnable) { BaseShowParameter lsp = new BaseShowParameter(); pageId = lsp.getPageId(); if (kd.bos.dataentity.utils.StringUtils.isNotBlank(dataId)) { lsp.setPkId(dataId); } BaseShowParameter baseShowParameter = (BaseShowParameter) this.getView().getFormShowParameter(); lsp.setAppId(baseShowParameter.getAppId()); lsp.setFormId(entityNumber); lsp.getOpenStyle().setTargetKey(curSelTabKey); lsp.getOpenStyle().setShowType(ShowType.InContainer); Map<String, Object> params = new HashMap(6); params.put("openFromMaterial", Boolean.TRUE); params.put("materialid", this.getModel().getDataEntity().getPkValue()); params.put("createorg", this.getModel().getDataEntity().getDynamicObject("createorg").getPkValue()); params.put("baseunit", this.getModel().getDataEntity().getDynamicObject("baseunit").getPkValue()); params.put("curseltabkey", curSelTabKey); params.put("isAllEnable", isAllEnable); lsp.setCustomParams(params); lsp.setParentFormId(this.getView().getFormShowParameter().getFormId()); lsp.setStatus(operationStatus); this.getPageCache().put(curSelTabKey, pageId); this.getView().showForm(lsp); }
5、处理必录字段赋值:
String childPageId = this.getPageCache().get("purchaseinfo"); IFormView childView = null; if (StringUtils.isNotBlank(childPageId)) { //获取子页面的view childView = this.getView().getView(childPageId); //字段赋值 childView.getModel().setValue("showcreateorg", createOrg); childView.getModel().setValue("purchaseunit", baseunit); childView.getModel().setValue("masterid", mater); //发送指令,不可缺少 this.getView().sendFormAction(childView);
}
参考路径:https://club.kdcloud.com/article/123910067124010752
6、调用保存、提交、审核
//operate 操作代码:save、submit、audit
//permItem 这个应该是操作状态码之类的
save-4715a0df000000ac,submit-804f6478000000ac,audit-47162f66000000ac
//pageId 页面随机生成的页面id
//entityNumber 内嵌界面标识
//itemKey 页签标识
//status 单据状态
//保存 this.handleOperate("save", childPageId, "4715a0df000000ac", createOrg, "bd_materialpurchaseinfo", "purchaseinfo", (String) null); //提交 this.handleOperate("submit", childPageId, "804f6478000000ac", createOrg, "bd_materialpurchaseinfo", "purchaseinfo", "B"); //审核 this.handleOperate("audit", childPageId, "47162f66000000ac", createOrg, "bd_materialpurchaseinfo", "purchaseinfo", "C");
private void handleOperate(String operate, String permItem, String pageId, String entityNumber, String itemKey, String status) { DynamicObject createorg = this.getView().getView(pageId).getModel().getDataEntity().getDynamicObject("createorg"); if (createorg == null) { this.getView().showTipNotification(ResManager.loadKDString("请先选择创建组织", "MaterialDataFormPlugin_7", "bd-master-formplugin", new Object[0])); } else { DynamicObject showcreateorg = this.getView().getView(pageId).getModel().getDataEntity().getDynamicObject("showcreateorg"); if (showcreateorg == null) { this.getView().showTipNotification(ResManager.loadKDString("请先选择创建组织", "MaterialDataFormPlugin_7", "bd-master-formplugin", new Object[0])); } else { if (pageId != null && this.getView().getView(pageId) != null) { DynamicObject data = this.getView().getView(pageId).getModel().getDataEntity(); Object pkValue = data.getPkValue(); if (pkValue != null && Long.parseLong(pkValue.toString()) != 0L && "save".equals(operate)) { permItem = "4715a0df000000ac"; } boolean isPerm = this.checkPerm(permItem, pageId, entityNumber, Long.parseLong(createorg.getPkValue().toString())); if (isPerm) { String operateName = OperteUtils.getOperteName(permItem); this.getView().showTipNotification(String.format(ResManager.loadKDString("该用户在当前业务组织下没有%s权限!", "MaterialDataFormPlugin_5", "bd-master-formplugin", new Object[0]), operateName)); return; } OperationResult invokeOperation = this.getView().getView(pageId).invokeOperation(operate); this.getView().sendFormAction(this.getView().getView(pageId)); if (invokeOperation.isSuccess() && StringUtils.isNotBlank(status)) { this.setVisible(itemKey, status, (OperationStatus)null); } } } } }