内容发布更新时间 : 2024/11/20 14:30:18星期一 下面是文章的全部内容请认真阅读。
EAS-DEP常用脚本模板
1. 改变工具栏中按钮的状态
with(easNames){
var auditAction = pluginCtx.getUI().getActionManager().getAction(\auditAction.setEnabled(false); //禁用工具栏按钮 auditAction.setVisible(false); //隐藏工具栏按钮 }
注:取工具栏中的按钮,取其对应的功能即可,区分大小写
2. 改变分录右上角的按钮的状态
with(easNames){
var controlPanel =
pluginCtx.getKDTable(\MsgBox.showWarning(controlPanel.getComponentCount());
for(var i = 1; i < controlPanel.getComponentCount(); i++){ controlPanel.getComponent(i).setEnabled(false); } }
注:想改变具体的按钮状态,将i改成具体的数字即可
资料参考:http://blog.csdn.net/wiser/article/details/4348038
3. 根据选中列表行的状态改变工具栏按钮的状态
pluginCtx.getKDTable(\
function(afterSelectLine,methodName){ //对选中行之后的事情进行监听 with(easNames){
var entry = pluginCtx.getKDTable(\
var baseStatus = SCMClientUtils.getSelectRowFieldValue(entry,\
var auditAction = pluginCtx.getUI().getActionManager().getAction(\ auditAction.setEnabled(false); if(\已保存\
auditAction.setEnabled(true); } } });
注:如果想获取多行,则加for循环,baseStatus[0]→baseStatus[i]
4. 控制代办服务单,上牌备注不能为空
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos); easImporter.importPackage(Packages.com.kingdee.eas.util);
easImporter.importPackage(Packages.com.kingdee.eas.util.client);
with(easImporter){ var txtCause = pluginCtx.getKDTextArea(\取上牌备注控件值 //控制分录字段为必录项 if(txtCause.getText().equals(\判断取值条件 { MsgBox.showInfo(\上牌备注不能为空>\ SysUtil.abort(); } }
5. 控制代办调整单审核后可调整分录 var easNames = JavaImporter();
easNames.importPackage(Packages.com.kingdee.bos.ctrl.swing); easNames.importPackage(Packages.java.math);
easNames.importPackage(Packages.com.kingdee.eas.scm.common.client); easNames.importPackage(Packages.com.kingdee.eas.util.client); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.eas.scm.im.dt); easNames.importPackage(Packages.com.kingdee.eas.scm.common.client); easNames.importPackage(Packages.com.kingdee.bos.metadata);
easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.bos.metadata); easNames.importPackage(Packages.com.kingdee.bos.framework);
easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.eas.util); with(easNames){
var kdtEntrys = pluginCtx.getKDTable(\
var controlPanel =
pluginCtx.getKDTable(\定义分录按钮 //取当前用户
var user=pluginCtx.getUIContext().get(\ //当前组织 getCurrentCtrlUnit
var company = pluginCtx.getUIContext().get(\ //指定人员可编辑
if(user.getPerson()=='XXX'){
MsgBox.showWarning(user.getPerson()); MsgBox.showWarning(company);
kdtEntrys.getColumn(\ kdtEntrys.getColumn(\ controlPanel.getComponent(1).setEnabled(true); controlPanel.getComponent(2).setEnabled(true); controlPanel.getComponent(3).setEnabled(true); } }
6. 整车库存配车屏蔽
var easNames = JavaImporter();
easNames.importPackage(Packages.com.kingdee.bos.ctrl.swing); easNames.importPackage(Packages.java.math);
easNames.importPackage(Packages.com.kingdee.eas.scm.common.client); easNames.importPackage(Packages.com.kingdee.eas.util.client); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.eas.scm.im.dt); easNames.importPackage(Packages.com.kingdee.eas.scm.common.client);
easNames.importPackage(Packages.com.kingdee.bos.metadata);
easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.bos.metadata); easNames.importPackage(Packages.com.kingdee.bos.framework);
easNames.importPackage(Packages.com.kingdee.bos.ctrl.extendcontrols); easNames.importPackage(Packages.com.kingdee.bos.util); easNames.importPackage(Packages.com.kingdee.eas.util); with(easNames){
var auditAction =
pluginCtx.getUI().getActionManager().getAction(\ }
auditAction.setEnabled(false);
7. 控制分录字段不能为空(整车销售订单分录为例)
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos); easImporter.importPackage(Packages.com.kingdee.eas.util); easImporter.importPackage(Packages.com.kingdee.eas.util.client); with(easImporter){
var kdtEntrys = pluginCtx.getKDTable(\
if(kdtEntrys.getRow(0).getCell(\判断字段条件 {
MsgBox.showInfo(\整车订单分录颜色不能为空>\SysUtil.abort(); }
if(kdtEntrys.getRow(0).getCell(\{
MsgBox.showInfo(\订金不能为0>\SysUtil.abort(); } }
8.控制整车订单已出库已开票不能做订单变更
var easImporter = JavaImporter();
easImporter.importPackage(Packages.com.kingdee.bos); easImporter.importPackage(Packages.com.kingdee.eas.util); easImporter.importPackage(Packages.com.kingdee.eas.util.client); with(easImporter){
var kdtEntrys = pluginCtx.getKDTable(\
if(kdtEntrys.getRow(0).getCell(\
{ MsgBox.showInfo(\当前单据已生成整车销售出库单,不能进行变更操作,请反审核删除整车销售出库单!>\
}
SysUtil.abort();
if(kdtEntrys.getRow(0).getCell(\
{ MsgBox.showInfo(\当前单据已开票,不能进行变更操作,请反审核删除开票登记单!>\ }
}
SysUtil.abort();
9.控制 根据精品销售单类型控制分录字段