1.打开DEP扩展平台,打开销售订单编辑界面。
2.点击销售订单编辑界面上的扩展定义弹出脚本扩展界面。
3.在扩展界面上添加onload方法 添加后置脚本如下:
var setmaterialF7Funcation = function(event,methodName){
if(methodName == "equals"){return event.toString().length()==9;}
var kdtEntries = pluginCtx.getKDTable("kdtEntries");
var rowIndex = kdtEntries.getSelectManager().getActiveRowIndex();
var colIndex = kdtEntries.getSelectManager().getActiveColumnIndex();
if (rowIndex < 0) { return; }
if(methodName == "editStopped"){
if (kdtEntries.getColumn("materialNum").getColumnIndex() == colIndex) {
var material = pluginCtx.getKDTable("kdtEntries").getRow(rowIndex).getCell("materialNum").getValue();
var materialid = material.id ;
var materialGroup = material.getMaterialGroup() ;
var materialGroupInfo=com.kingdee.eas.basedata.master.material.MaterialGroupFactory.getRemoteInstance().getValue(new com.kingdee.bos.dao.ormapping.ObjectUuidPK(materialGroup.id))
var longNumber=materialGroupInfo.longNumber;
var number = longNumber.split("!")[0];
var materialGroupInfo1;
var view = new com.kingdee.bos.metadata.entity.EntityViewInfo();
var filterInfo = new com.kingdee.bos.metadata.entity.FilterInfo();
filterInfo.getFilterItems().add(
new com.kingdee.bos.metadata.entity.FilterItemInfo("number",number,
com.kingdee.bos.metadata.query.util.CompareType.EQUALS));
view.setFilter(filterInfo);
var col = com.kingdee.eas.basedata.master.material.MaterialGroupFactory.getRemoteInstance().getCollection(view);
if(col!=null && col.size()>0){
materialGroupInfo1=col.get(0);
}
pluginCtx.getKDTable("kdtEntries").getRow(rowIndex).getCell("materialGroup").setValue(materialGroupInfo1);
}
}
};
pluginCtx.getKDTable("kdtEntries").addKDTEditListener(setmaterialF7Funcation );
推荐阅读