《EAS-DEP常用脚本模板.docx》由会员分享,可在线阅读,更多相关《EAS-DEP常用脚本模板.docx(16页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、EAS-DEP 常用脚本模板1. 转变工具栏中按钮的状态with(easNames)var auditAction = pluginCtx.getUI.getActionManager.getAction(“actionBtnAssign“); auditAction.setEnabled(false);/禁用工具栏按钮auditAction.setVisible(false);/隐蔽工具栏按钮注:取工具栏中的按钮,取其对应的功能即可,区分大小写2. 转变分录右上角的按钮的状态with(easNames)var controlPanel = pluginCtx.getKDTable(“kdtE
2、ntry“).getParent.getParent.getComponent(0); MsgBox.showWarning(controlPanel.getComponentCount);for(var i = 1; i controlPanel.getComponentCount; i+) controlPanel.getComponent(i).setEnabled(false);注:想转变具体的按钮状态,将i 改成具体的数字即可资料参考: :/3. 依据选中列表行的状态转变工具栏按钮的状态pluginCtx.getKDTable(“tblMain“).addKDTActiveCellL
3、istener( function(afterSelectLine,methodName)/对选中行之后的事情进展监听with(easNames)var entry = pluginCtx.getKDTable(“tblMain“);var baseStatus = SCMClientUtils.getSelectRowFieldValue(entry,“status“);var auditAction = pluginCtx.getUI.getActionManager.getAction(“actionRemove“); auditAction.setEnabled(false);if(“
4、已保存“.equals(baseStatus0) auditAction.setEnabled(true););注:假设想猎取多行,则加 for 循环,baseStatus0baseStatusi4. 把握代办效劳单,上牌备注不能为空var easImporter = JavaImporter;easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .kingdee.eas.util); easImporter.importPackage(Packages .kingdee.eas
5、.util.client); with(easImporter)var txtCause = pluginCtx.getKDTextArea(“txtHangtagRemark“);/取上牌备注控件值/把握分录字段为必录项if(txtCause.getText.equals(“)/推断取值条件MsgBox.showInfo(“); SysUtil.abort;5. 把握代办调整单审核后可调整分录var easNames = JavaImporter;easNames.importPackage(Packages .kingdee.bos.ctrl.swing); easNames.import
6、Package(Packages.java.math); easNames.importPackage(Packages .kingdee.eas.scm mon.client); easNames.importPackage(Packages .kingdee.eas.util.client); easNames.importPackage(Packages .kingdee.bos.util); easNames.importPackage(Packages .kingdee.eas.scm.im.dt); easNames.importPackage(Packages .kingdee.
7、eas.scm mon.client); easNames.importPackage(Packages .kingdee.bos.metadata); easNames.importPackage(Packages .kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages .kingdee.bos.util); easNames.importPackage(Packages .kingdee.bos.metadata); easNames.importPackage(Packages .kingdee.bos.fra
8、mework); easNames.importPackage(Packages .kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages .kingdee.bos.util); easNames.importPackage(Packages .kingdee.eas.util); with(easNames)var kdtEntrys = pluginCtx.getKDTable(“kdtEntrys“);var controlPanel = pluginCtx.getKDTable(“kdtEntrys“).get
9、Parent.getParent.getComponent(0);/定义分录按钮/取当前用户var user=pluginCtx.getUIContext.get(“sysContext“).getCurrentUserInfo;/当前组织 getCurrentCtrlUnitvar company = pluginCtx.getUIContext.get(“sysContext“).getCurrentFIUnit;/指定人员可编辑if(user.getPerson=”XXX”) MsgBox.showWarning(user.getPerson); MsgBox.showWarning(c
10、ompany);kdtEntrys.getColumn(“AgentItem“).getStyleAttributes.setLocked(false); kdtEntrys.getColumn(“PreReceiveAmount“).getStyleAttributes.setLocked(false);controlPanel.getComponent(1).setEnabled(true); controlPanel.getComponent(2).setEnabled(true); controlPanel.getComponent(3).setEnabled(true);6. 整车库
11、存配车屏蔽var easNames = JavaImporter; easNames.importPackage(Packages .kingdee.bos.ctrl.swing); easNames.importPackage(Packages.java.math); easNames.importPackage(Packages .kingdee.eas.scm mon.client); easNames.importPackage(Packages .kingdee.eas.util.client); easNames.importPackage(Packages .kingdee.bo
12、s.util);easNames.importPackage(Packages .kingdee.eas.scm.im.dt); easNames.importPackage(Packages .kingdee.eas.scm mon.client); easNames.importPackage(Packages .kingdee.bos.metadata); easNames.importPackage(Packages .kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages .kingdee.bos.util)
13、; easNames.importPackage(Packages .kingdee.bos.metadata); easNames.importPackage(Packages .kingdee.bos.framework); easNames.importPackage(Packages .kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages .kingdee.bos.util); easNames.importPackage(Packages .kingdee.eas.util); with(easNames)
14、var auditAction = pluginCtx.getUI.getActionManager.getAction(“actionDecorationOrderAlter“);auditAction.setEnabled(false);7. 把握分录字段不能为空整车销售订单分录为例 var easImporter = JavaImporter; easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .kingdee.eas.util);easImporter.importP
15、ackage(Packages .kingdee.eas.util.client); with(easImporter)var kdtEntrys = pluginCtx.getKDTable(“kdtEntrys“); if(kdtEntrys.getRow(0).getCell(“Color“).getValue=null)/推断字段条件MsgBox.showInfo(“);SysUtil.abort;if(kdtEntrys.getRow(0).getCell(“SubscriptionAmount“).getValue=0)MsgBox.showInfo(“); SysUtil.abo
16、rt;8. 把握整车订单已出库已开票不能做订单变更var easImporter = JavaImporter; easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .kingdee.eas.util); easImporter.importPackage(Packages .kingdee.eas.util.client); with(easImporter)var kdtEntrys = pluginCtx.getKDTable(“kdtEntrys“); if(kdtEn
17、trys.getRow(0).getCell(“TotalIssueQty“).getValue0) MsgBox.showInfo(“);SysUtil.abort;if(kdtEntrys.getRow(0).getCell(“TotalInvoiceAmount“).getValue0) MsgBox.showInfo(“);SysUtil.abort;9. 把握 依据精品销售单类型把握分录字段var easImporter = JavaImporter; easImporter.importPackage(Packages .kingdee.bos); easImporter.impo
18、rtPackage(Packages .kingdee.eas.util); easImporter.importPackage(Packages .kingdee.eas.util.client); with(easImporter)var saletype=pluginCtx.getKDBizPromptBox(“prmtdecorationSaleType“); var kdtEntrys = pluginCtx.getKDTable(“kdtEntry“);var rowCount = kdtEntrys.getRowCount;for(var i = 0;i0)MsgBox.show
19、Info(“销售类型为整车赠送,分录折扣率或折扣额不能填“); SysUtil.abort;if(saletype.getValue=”整车赠送” & kdtEntrys.getRow(i).getCell(“favorAmount“).getValue=0)MsgBox.showInfo(“销售类型为整车赠送,分录随车金额不能为空!“); SysUtil.abort;if(kdtEntrys.getRow(i).getCell(“taxPrice“).getValue=0)MsgBox.showInfo(“分录精品含税单价不能为O“); SysUtil.abort;if(kdtEntrys.
20、getRow(i).getCell(“discountRate“).getValue55 &saletype.getValue=”整车现金销售”)MsgBox.showInfo(“折扣率不能大于 5.5 折“); SysUtil.abort;if(kdtEntrys.getRow(i).getCell(“discountRate“).getValue55 &saletype.getValue=”售后销售”)MsgBox.showInfo(“折扣率不能大于 5.5 折“); SysUtil.abort;10. 把握整车销售出库分录的源单类型不能为空var easImporter = JavaIm
21、porter; easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .kingdee.eas.util);easImporter.importPackage(Packages .kingdee.eas.util.client); with(easImporter)var kdtEntry = pluginCtx.getKDTable(“detailTable“);/把握分录字段源单类型不能为空if(kdtEntry.getRow(0).getCell(“coreBillType
22、“).getValue=null)MsgBox.showInfo(“); SysUtil.abort;if(kdtEntry.getRow(0).getCell(“ys“).getValuekdtEntry.getRow(0).getCell(“ysk“).getValue& &kdtEntry.getRow(0).getCell(“remark“).getValue=”整车赠送”)MsgBox.showInfo(“精品销售单应收小于已收,不能出库,请收款后再作出库!“); SysUtil.abort;if(kdtEntry.getRow(0).getCell(“ys“).getValuekd
23、tEntry.getRow(0).getCell(“ysk“).getValue& &kdtEntry.getRow(0).getCell(“remark“).getValue=”整车现金销售”)MsgBox.showInfo(“精品销售单应收小于已收,不能出库,请收款后再作出库!“); SysUtil.abort;11. 把握整车调拨单调出调入公司不能一样var easImporter = JavaImporter; easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .ki
24、ngdee.eas.util); easImporter.importPackage(Packages .kingdee.eas.util.client); with(easImporter)var outcompany = pluginCtx.getKDBizPromptBox(“prmtoutOrgUnit“).getValue.tostring;/取调出控件值var incompany = pluginCtx.getKDBizPromptBox(“prmtinOrgUnit“).getValue.tostring;/取调入控件值if(outcompany=incompany)MsgBox
25、.showInfo(“); SysUtil.abort;12. 整车价格特批设置/*var easImporter = JavaImporter; easImporter.importPackage(Packages .kingdee.bos); easImporter.importPackage(Packages .kingdee.eas.util); easImporter.importPackage(Packages .kingdee.eas.util.client); easImporter.importPackage(Packages.java.lang); with(easImpo
26、rter)var kdtEntrys = pluginCtx.getKDTable(“kdtEntrys“); var rowCount = kdtEntrys.getRowCount;var p1 = 0.0;/整车优待var p2 = 0.0;/精品优待var p3 = 0.0;/裸车总额度var p4 = 0.0;/整车加装优待var p5 = 0.0;/精品加装优待var p6 = 0.0;/加装总额度for(var i = 0;i p3)MsgBox.showInfo(“”整车特批额度”和”精品特批额度”之和不能大于”裸车总特批额度”“); SysUtil.abort;if(p2 p
27、6)MsgBox.showInfo(“”整车加装特批额度”和”精品加装特批额度”之和不能大于”加装车总特批额度”“);SysUtil.abort;if(p5 p6 * 0.3)MsgBox.showInfo(“”精品加装特批额度”不能小于”加装车总特批额度”的 30%“); SysUtil.abort;*/13. 客户端调用效劳端方法自定义方法脚本:var easImporter = JavaImporter; easImporter.importPackage(Packages.java.math); easImporter.importPackage(Packages .kingdee.b
28、os.util); easImporter.importPackage(Packages .kingdee.eas.util); easImporter.importPackage(Packages .kingdee.eas.util.app); easImporter.importPackage(Packages .kingdee.bos.dao.ormapping); easImporter.importPackage(Packages .kingdee.eas.basedata.scm mon); easImporter.importPackage(Packages .kingdee.e
29、as.basedata.master.material);/加载包,可直接拷贝with(easImporter)var ctx = pluginCtx.getContext;/获得上下文。var fn = methodCtx.getParamValue(0);/获得参数的方式。此参数是个数组。留意个数。var sql = “select fvin from T_ATS_AutoPurOrderEntry where fvin = ”“ + fn + “” and rownum =1“;/SQL取值var cc=com.kingdee.eas.util.app.DbUtil.executeQue
30、ry(ctx, sql); /执行,并返回结果值if(cc.next)/从 irowset 中取数varvalue1 = cc.getString(1);methodCtx.setResultValue(value1);/返回值的方法。客户端调用:var easNames = JavaImporter; easNames.importPackage(Packages .kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages .kingdee.bos.util); easNames.importPackage(Packa
31、ges .kingdee.bos.metadata); easNames.importPackage(Packages .kingdee.bos.framework); easNames.importPackage(Packages .kingdee.eas.util.client); easNames.importPackage(Packages.java.math); easNames.importPackage(Packages .kingdee.eas.util.app); easNames.importPackage(Packages .kingdee.eas.ec.contract
32、.sub); easNames.importPackage(Packages .kingdee.eas mon.client); easNames.importPackage(Packages .kingdee.eas.scm mon.util); easNames.importPackage(Packages .kingdee.bos.ui.face); with(easNames)var kdtEntrys=pluginCtx.getKDTable(“kdtEntrys“);var rowCount = kdtEntrys.getRowCount; for(var i=0;irowCoun
33、t;i+)var pv=kdtEntrys.getRow(i).getCell(“vin“);/循环取分录车架号var arg1=pv.getValue.toString;var pk = new MetaDataPK(“com.kingdee.eas.auto4s.vm.vp.app.AutoPurOrder“); var name = “String getvin(String arg1)“;var params = arg1;var result = BOClientTool.callCmethod(pk,name,params);/接收业务方法返回的值if(result!=“undef
34、ined“)com.kingdee.eas.util.client.MsgBox.showInfo(“第“+(i+1)+“行“+“VIN:“+pv.getValue+“车辆已存在“); com.kingdee.eas.util.SysUtil.abort;if(kdtEntrys.getRow(i).getCell(“payWay“).getValue = null) MsgBox.showError(“付款方式不能为空“); com.kingdee.eas.util.SysUtil.abort;14. 转变列值,值更公式:var table = pluginCtx.getKDTable(“k
35、dtEntry“); table.addKDTPropertyChangeListener(function(event,methodName)if(methodName = “equals“)return this =event;if(methodName = “propertyChange“) if (event.getType =com.kingdee.bos.ctrl.kdf.table.KDTStyleConstants.BODY_ROW) & (event.getPropertyName= “cellValue“)var curRow =table.getRow(event.get
36、RowIndex); var colName=table.getColumn(event.getColIndex).getKey;/假设当前列为物料if(“material“=colName)var material = curRow.getCell(“material“).getValue;/库存组织var sou = pluginCtx.getKDBizPromptBox (“prmtstorageOrgUnit“).getValue;/财务组织var cou =com.kingdee.eas.scm.im.inv.client.InvClientUtils.getCompanyInfo(
37、sou);/依据物料和财务组织,取单位标准本钱var cost =com.kingdee.eas.scm.im.inv.client.InvClientUtils.getUnitStandardCost (material,cou);curRow.getCell(“unitStandardCost“).setValue(cost);/单数量列转变时,计算标准本钱if(“qty“=colName)var unitcost = curRow.getCell (“unitStandardCost“).getValue;var qty= curRow.getCell(“qty“).getValue; var cost=qty*unitcost;curRow.getCell(“standardCost“).setValue(cost);if(“ManHour“=colName|“recievePayAmount“=colName|“favorAmount“=colName|“IsApyGi fts“=colName)var ManHour= curRow.getCell(“ManHour“).getValue;var recie
限制150内