动态扩展平台常用脚本集EAS产品部产品支持部白敏导读本文档截取了DEP以前项目开发过程中的一些常用功能的脚本实现,可以仿照该实现,快速编写项目中实际的业务逻辑的脚本。适用对象DEP扩展脚本开发人员请注意:本文件只作为产品介绍之用,不属于您与金蝶签署的任何协议。本文件仅包括金蝶既定策略、产品及功能方面的信息,不能以本文件作为要求金蝶履行商务条款、产品策略以及开发义务的依据。本文件内容可能随时变更,恕不另行通知。//客户端在扩展点提交时给F7控件增加监听器vareasNames=JavaImporter();easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols);easNames.importPackage(Packages.com.kingdee.bos);with(easNames){varroadMap=pluginCtx.getKDBizPromptBox(prmtprmtMyRoadMap);roadMap.addPreChangeListener(function(){thrownewBOSException(路线图不允许为空!);});}//客户端设置F7默认值vareasImporter=JavaImporter();easImporter.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols);easImporter.importPackage(Packages.com.kingdee.eas.basedata.scm.common);easImporter.importPackage(Packages.com.kingdee.bos.util);easImporter.importPackage(Packages.com.kingdee.eas.basedata.assistant);with(easImporter){varprmtCurrency=pluginCtx.getKDBizPromptBox(prmtCurrency);varcur=newCurrencyInfo();cur.setId(BOSUuid.create(DEB58FDC));cur.setNumber(1001);cur.setName(BMD);prmtCurrency.setValue(cur);}//服务端更新单据状态varimp=JavaImporter();imp.importPackage(Packages.com.kingdee.eas.util.app);with(imp){varctx=pluginCtx.getContext();varbillId=methodCtx.getParamValue(0);varstatus=11;varsql=updateT_SD_SALEORDERSETFBASESTATUS=+status+WHEREFID='+billId+';DbUtil.execute(ctx,sql);methodCtx.setResultValue(java.lang.Boolean.TRUE);}//客户端调用服务端方法vareasNames=JavaImporter();easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols);easNames.importPackage(Packages.com.kingdee.bos);easNames.importPackage(Packages.com.kingdee.bos.util);easNames.importPackage(Packages.com.kingdee.bos.metadata);easNames.importPackage(Packages.com.kingdee.eas.util.client);easNames.importPackage(Packages.com.kingdee.bos.framework);with(easNames){varpk=newMetaDataPK(com.kingdee.eas.scm.sd.sale.app.SaleOrder);varname=java.lang.BooleanupdateStatus(com.kingdee.bos.util.BOSUuidbillId);varparams=[BOSUuid.read(2s5eatuISSqb7TuLMfibSMSKQjo=)];varresult=BOClientTool.callCmethod(pk,name,params);MsgBox.showInfo(Resultis:+result);com.kingdee.eas.util.SysUtil.abort();}//服务端检查编码重复varimp=JavaImporter();imp.importPackage(Packages.com.kingdee.eas.util.app);imp.importPackage(Packages.com.kingdee.bos);with(imp){varctx=pluginCtx.getContext();varsql=select*fromT_SD_SALEORDERWHEREFNumber='SO2007000001';varrowset=DbUtil.executeQuery(ctx,sql);if(rowset.size()0){thrownewBOSException(编码重复!);}}vareasNames=JavaImporter();easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols);easNames.importPackage(Packages.com.kingdee.eas.scm.common.util);easNames.importPackage(Packages.com.kingdee.eas.scm.common.client.helper);with(easNames){varentry=pluginCtx.getKDTable(kdtEntries);varcolumn=entry.getColumn(qty);varformat=PrecisionUtil.getFormatString(10);vareditor=FormattedEditorFactory.getBigDecimalCellEditor(10,false);column.setEditor(editor);column.getStyleAttributes().setNumberFormat(format);}varimp=JavaImporter();imp.importPackage(Packages.com.kingdee.eas.util.app);with(imp){varctx=pluginCtx.getContext();varbillId=methodCtx.getParamValue(0);varstatus=2;varsql=updateT_SD_SALEORDERSETFBASESTATUS=+status+WHEREFID='+billId+';DbUtil.execute(ctx,sql);methodCtx.setsetResultValue(java.lang.Boolean.TRUE);}//客户端设置编码规则脚本vareasNames=JavaImporter();easNames.importPackage(Packages.com.kingdee.eas.base.codingrule);with(easNames){vareditData=pluginCtx.getDataObject();varbizOrgUnit=pluginCtx.getKDBizPromptBox(prmtSaleOrgUnit).getValue();varnumber=CodingRuleManagerFactory.getRemoteInstance().getNumber(editData,bizOrgUnit.getId());pluginCtx.getKDTextField(txtNumber).setText(number);}//客户端设置销售订单分录数量列背景色为红色,注意该脚本需要为后置脚本才能用vareasNames=JavaImporter();easNames.importPackage(Packages.com.kingdee.eas.scm.common.client);with(easNames){varentry=pluginCtx.getKDTable(kdtEntries);varcolumn=entry.getColumn(qty).getStyleAttributes().setBackground(java.awt.Color.RED);}//客户端设置空间字体属性varfont=newjava.awt.Font(SansSerif,java.awt.Font.BOLD,14);pluginCtx.getKDTextField(txtDescription).setFont(font);//建滔替换物料验证vareasNames=JavaImporter();easNames.importPackage(Packages.javax.swing);easNames.importPackage(Packages.java.awt);easNames.importPackage(Packages.java.event);easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols);easNames.importPackage(Packages.com.kingdee.eas.util);easNames.importPackage(Packages.com.kingdee.eas.scm.common.constants);easNames.importPackage(Packages.com.kingdee.bos.ctrl.kdf.table);with(easNames){vareditData=pluginCtx.getDataObject();vardetailTable=pluginCtx.getKDTable(detailTable);varprmtMaterial=newKDBizPromptBox();prmtMaterial.setQueryInfo(QueryInfoConstants.MATERIAL_INVENTORY_NO_GROUP);varlabelMaterial=newJLabel(物料);labelMaterial.setLabelFor(prmtMaterial);varprmtAssitAttribute=newKDBizPromptBox();varlabelAssitAttribute=newJLabel(辅助属性);labelAssitAttribute.setLabelFor(prmtAssitAttribute);prmtAssitAttribute.setQueryInfo(com.kingdee.eas.basedata.master.material.app.F7AsstAttrValueQuery);varpane=newJPanel();pane.border=BorderFactory.createEmptyBorder(