动态扩展平台常用脚本集

更新时间:2023-12-03 16:05:01 阅读量: 教育文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

动态扩展平台常用脚本集

EAS 产品部产品支持部 白敏

导读

本文档截取了DEP以前项目开发过程中的一些常用功能的脚本实现,可以仿照该实现,快速编写项目中实际的业务逻辑的脚本。

适用对象

DEP扩展脚本开发人员

请注意:本文件只作为产品介绍之用,不属于您与金蝶签署的任何协议。本文件仅包括金蝶既定策略、产品及功能方面的信息,不能以本文件作为要求金蝶履行商务条款、产品策略以及开发义务的依据。本文件内容可能随时变更,恕不另行通知。

//客户端在扩展点提交时给F7控件增加监听器

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos); with(easNames){

var roadMap = pluginCtx.getKDBizPromptBox(\roadMap.addPreChangeListener(function(){ throw new BOSException(\路线图不允许为空!\}); }

//客户端设置F7默认值

var easImporter = 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){

var prmtCurrency =pluginCtx.getKDBizPromptBox(\var cur = new CurrencyInfo();

cur.setId(BOSUuid.create(\cur.setNumber(\cur.setName(\

prmtCurrency.setValue(cur); }

//服务端更新单据状态

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); with(imp){

var ctx = pluginCtx.getContext();

var billId = methodCtx.getParamValue(0); var status = 11;

var sql = \T_SD_SALEORDER SET FBASESTATUS = \+ status + \WHERE FID = '\

DbUtil.execute(ctx, sql);

methodCtx.setResultValue(java.lang.Boolean.TRUE); }

//客户端调用服务端方法

var easNames = 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){ var pk = new MetaDataPK(\ var name = \ var params = [BOSUuid.read(\ var result = BOClientTool.callCmethod(pk,name,params); MsgBox.showInfo(\ com.kingdee.eas.util.SysUtil.abort(); }

//服务端检查编码重复

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); imp.importPackage(Packages.com.kingdee.bos); with(imp){

var ctx = pluginCtx.getContext();

var sql = \

var rowset = DbUtil.executeQuery(ctx, sql); if(rowset.size() > 0){

throw new BOSException(\编码重复!\ } }

var easNames = 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){

var entry = pluginCtx.getKDTable(\var column = entry.getColumn(\

var format = PrecisionUtil.getFormatString(10);

var editor = FormattedEditorFactory.getBigDecimalCellEditor(10, false); column.setEditor(editor);

column.getStyleAttributes().setNumberFormat(format); }

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app);

with(imp){

var ctx = pluginCtx.getContext();

var billId = methodCtx.getParamValue(0); var status = 2;

var sql = \T_SD_SALEORDER SET FBASESTATUS = \+ status + \WHERE FID = '\

DbUtil.execute(ctx, sql);

methodCtx.setsetResultValue(java.lang.Boolean.TRUE); }

//客户端设置编码规则脚本

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.eas.base.codingrule); with(easNames){

var editData = pluginCtx.getDataObject();

var bizOrgUnit= pluginCtx.getKDBizPromptBox(\var number = CodingRuleManagerFactory.getRemoteInstance().getNumber(editData, bizOrgUnit.getId());

pluginCtx.getKDTextField(\}

//客户端设置销售订单分录数量列背景色为红色,注意该脚本需要为后置脚本才能用

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.eas.scm.common.client); with(easNames){

var entry = pluginCtx.getKDTable(\

var column = entry.getColumn(\}

//客户端设置空间字体属性

var font = new java.awt.Font(\pluginCtx.getKDTextField(\

//建滔替换物料验证

var easNames = 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){

var editData = pluginCtx.getDataObject();

var detailTable = pluginCtx.getKDTable(\

var prmtMaterial = new KDBizPromptBox();

prmtMaterial.setQueryInfo(QueryInfoConstants.MATERIAL_INVENTORY_NO_GROUP); var labelMaterial = new JLabel(\物料\labelMaterial.setLabelFor(prmtMaterial);

var prmtAssitAttribute = new KDBizPromptBox(); var labelAssitAttribute = new JLabel(\辅助属性\labelAssitAttribute.setLabelFor(prmtAssitAttribute);

prmtAssitAttribute.setQueryInfo(\Query\

var pane = new JPanel();

pane.border = BorderFactory.createEmptyBorder(30,30,10,30); pane.add(labelMaterial); pane.add(prmtMaterial);

pane.add(labelAssitAttribute); pane.add(prmtAssitAttribute);

var frame = new easNames.JFrame(\替换物料\

frame.getContentPane().add(pane, BorderLayout.CENTER);

frame.addWindowListener(function(event, methodName){ if(methodName == \ frame.setVisible(false); var detailTable = pluginCtx.getKDTable(\ var selectManager = detailTable.getSelectManager(); var selectBlock =selectManager.get(); if (selectBlock != null) { var rowIndex = selectBlock.getTop(); var material = prmtMaterial.getValue(); var assitAttr = prmtAssitAttribute.getValue(); detailTable.getCell(rowIndex,\ detailTable.getCell(rowIndex,\ } } });

frame.pack();

frame.setVisible(true); }

//服务端更新单据状态

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); with(imp){

var ctx = pluginCtx.getContext();

var billId = methodCtx.getParamValue(0);

var sql = \CT_SCA_CheckWeightNoteBill SET CFSTATUSID '2WiVgufPSLmUJJ9rb9F+4b8ogLw=' WHERE FNUMBER = '001'\

=

DbUtil.execute(ctx, sql);

methodCtx.setResultValue(java.lang.Boolean.TRUE); }

//客户端处理送货单位

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.eas.scm.common.constants);

with(easNames){ var prmtDispatch = pluginCtx.getKDBizPromptBox(\ prmtDispatch.setQueryInfo(QueryInfoConstants.SUPPLIER_COMPANY); }

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.eas.scm.common.constants);

with(easNames){ var editData = pluginCtx.getDataObject(); var prmtDispatch = pluginCtx.getKDBizPromptBox(\ var queryInfoOrigin = prmtDispatch.getQueryInfo(); if(queryInfoOrigin != null){ var queryInfo = queryInfoOrigin.replaceAll(\ if(QueryInfoConstants.SUPPLIER_COMPANY.equals(queryInfo)){ editData.put(\ }else{ editData.put(\ }} }

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.eas.scm.common.constants);

with(easNames){

var editData = pluginCtx.getDataObject(); var prmtDispatch = pluginCtx.getKDBizPromptBox(\ var queryInfoOrigin = prmtDispatch.getQueryInfo(); if(queryInfoOrigin != null){ var queryInfo = queryInfoOrigin.replaceAll(\ if(QueryInfoConstants.SUPPLIER_COMPANY.equals(queryInfo)){ prmtDispatch.setValue(editData.get(\ }else{ prmtDispatch.setValue(editData.get(\ }} }

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.eas.scm.common.constants); easNames.importPackage(Packages.com.kingdee.bos);

with(easNames){ var editData = pluginCtx.getDataObject(); var prmtDispatch = pluginCtx.getKDBizPromptBox(\ var queryInfoOrigin = prmtDispatch.getQueryInfo(); if(editData.getSourceBillId() == null) throw new BOSException(\检斤通知单不允许手工新增!\ if(editData.get(\ prmtDispatch.setQueryInfo(QueryInfoConstants.SUPPLIER_COMPANY); prmtDispatch.setValue(editData.get(\ }else{ prmtDispatch.setQueryInfo(\ prmtDispatch.setValue(editData.get(\ } }

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); with(imp){

var ctx = pluginCtx.getContext();

var billId = methodCtx.getParamValue(0); var sumQTY = 0;

var sql = \T_IM_PurReceivalEntry SET CFSumCheckQTY = '\WHERE

FNUMBER = 'qq-2010-03-12-00000626'\DbUtil.execute(ctx, sql);

methodCtx.setResultValue(java.lang.Boolean.TRUE); }

//服务端根据物料计划页签检查项目号与跟踪号

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); imp.importPackage(Packages.com.kingdee.bos);

imp.importPackage(Packages.com.kingdee.eas.basedata.master.material); imp.importPackage(Packages.com.kingdee.bos.metadata.entity); imp.importPackage(Packages.com.kingdee.bos.metadata.query.util);

with(imp){

var ctx = pluginCtx.getContext();

var billInfo = methodCtx.getParamValue(0); var entrys = billInfo.getEntries(); var entry = entrys.get(0);

var material = entry.getMaterial(); var materialId = material.getId();

var ev = new EntityViewInfo(); var fi = new FilterInfo();

fi.getFilterItems().add(new FilterItemInfo(\ev.setFilter(fi);

var iMaterialPlan = MaterialPlanFactory.getLocalInstance(ctx);

var materialPlanCol = iMaterialPlan.getMaterialPlanCollection(ev);

if(materialPlanCol.size() > 0){ if(entry.get(\ throw new BOSException(\项目号与跟踪号不能同时为空!\ } }

//Scm_DynProException需要预先定义 var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos); with(easNames){ var prmtCurrency = pluginCtx.getKDBizPromptBox(\ if(prmtCurrency.getValue() == null) com.kingdee.eas.ep.plugin.ExceptionUtil.throwOnClient('Scm_DynProException','ScmCom

pany'); }

var imp = JavaImporter();

imp.importPackage(Packages.com.kingdee.eas.util.app); imp.importPackage(Packages.com.kingdee.bos); with(imp){

var ctx = pluginCtx.getContext(); if(true){

throw new BOSException(\编码重复!\ } }

var easNames = 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){

var pre = pluginCtx.getKDFormattedTextField(\pre.setPrecision(10); }

//KDTable加入监听器

var swingNames = JavaImporter();

swingNames.importPackage(Packages.com.kingdee.bos.ctrl.kdf.table.event); swingNames.importPackage(Packages.com.kingdee.eas.scm.common.client);

var tblMain = pluginCtx.getKDTable(\with (swingNames) { tblMain.addKDTEditListener(KDTEditListener(this)); }

function editStarting(e) {}

function editStarted(e)

{ var entry = pluginCtx.getKDTable(\ var column

entry.getColumn(\}

function editValueChanged(e)

=

{}

function editStopping(e) {}

function editStopped(e) {}

function editCanceled(e) {}

//Scm_DynProException需要预先定义 var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos); easNames.importPackage(Packages.com.kingdee.bos.ui);

with(easNames){

this.setFocusTraversalPolicy(new com.kingdee.bos.ui.UIFocusTraversalPolicy(new java.awt.Component[]

{kDDateLastUpdateTime,prmtLastUpdateUser,kDDateCreateTime,prmtCreator,prmtAuditor,txtDescription,pkBizDate,txtNumber,kdtEntrys})); }

//调用Onload出错

var easNames = JavaImporter();

easNames.importPackage(Packages.com.kingdee.eas.common.client); easNames.importPackage(Packages.com.kingdee.eas.scm.common.util); easNames.importPackage(Packages.com.kingdee.bos.ui.face);

easNames.importPackage(Packages.com.kingdee.eas.common.client);

with(easNames){

var ui = pluginCtx.getUI();

var uiContext = new UIContext(ui);

//uiContext.put(ui.getMainBizOrgType(), ui.getMainOrgContext().get( //ui.getMainBizOrgType()));

//uiContext.put(%uiContext.put(UIContext.ID,%uiContext.put(\var uiFactory = UIFactory .createUIFactory(com.kingdee.eas.common.client.UIFactoryName.MODEL); var window;

window = uiFactory.create( \ uiContext, null);

window.show(); }

//传递数组参数

var imp = JavaImporter(); imp.importPackage(Packages.com.kingdee.eas.qm.qc.util); imp.importPackage(Packages.java.lang); imp.importPackage(Packages.java.util); with(imp){ var ctx = pluginCtx.getContext(); var result = methodCtx.getResultValue(); var list = result.get(HQHPUtil.Result_Error); var ary = [\ var msg = new HQHPMsg(\ list.add(msg); result.put(HQHPUtil.Result_SubmitBills, new Integer(0)); methodCtx.setResultValue(result); }

本文来源:https://www.bwwdw.com/article/96xt.html

Top