8.1DEP脚本,求教
金蝶云社区-muyangleyuan
muyangleyuan
0人赞赏了该文章 1,384次浏览 未经作者许可,禁止转载编辑于2016年08月19日 09:09:39

需求:销售订单上单据和含税单价,不允许修改。
使用了在dep里写脚本,在后置脚本onload里,脚本如下。启用后,销售订单上可以控制价格,但是在保存销售订单时报错。请问该怎么解决?
var easNames = JavaImporter();
easNames.importPackage(Packages.java.util);
with(easNames){
var table = pluginCtx.getKDTable("kdtEntries");
table.getColumn("taxPrice").getStyleAttributes().setLocked(true);
table.getColumn("price").getStyleAttributes().setLocked(true);
table.getColumn("taxPrice").getStyleAttributes().setBackground(java.awt.Color.white);
table.getColumn("price").getStyleAttributes().setBackground(java.awt.Color.white);
table.addKDTEditListener(function(event,methodName){
if(methodName == "editStarted"||methodName == "editStopped"||methodName == "editStarting"||methodName == "editStopping"||methodName == "editValueChanged"){
var rowindex = event.getRowIndex();
var colIndex = event.getColIndex();
if(rowindex==null||rowindex==-1){
return;
}
var colName = table.getColumnKey(colIndex);
var row = table.getRow(rowindex);
row.getCell("taxPrice").getStyleAttributes().setLocked(true);
row.getCell("price").getStyleAttributes().setLocked(true);
table.getColumn("taxPrice").getStyleAttributes().setLocked(true);
table.getColumn("price").getStyleAttributes().setLocked(true);
table.getColumn("taxPrice").getStyleAttributes().setBackground(java.awt.Color.white);
table.getColumn("price").getStyleAttributes().setBackground(java.awt.Color.white);
if("taxPrice"==colName||"price"==colName){
com.kingdee.eas.util.SysUtil.abort();
}
}
});
}