本文主要是介绍EAS BOS DEP(动态扩展平台自用)基本操作,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1:DEP脚本友情链接: http://web20.kingdee.com/share/depScript/depScript.html
2:分享一些常用的DEP脚本
var imp = JavaImporter();
//imp.importPackage(Packages.);
imp.importPackage(Packages.com.kingdee.eas.util.app);
imp.importPackage(Packages.com.kingdee.bos.dao.query);
imp.importPackage(Packages.com.kingdee.eas.util.client);
imp.importPackage(Packages.com.kingdee.bos.metadata.entity);
imp.importPackage(Packages.com.kingdee.bos.metadata.query.util);
imp.importPackage(Packages.com.kingdee.util);
imp.importPackage(Packages.java.lang);
imp.importPackage(Packages.java.util);with(imp){//**公司值改变监听**//pluginCtx.getKDBizPromptBox("prmthCompany").addDataChangeListener(function(e){pluginCtx.getKDTextField("txtFEnglishName").setStringValue("");pluginCtx.getKDTextField("txtFEmpName").setStringValue("");pluginCtx.getKDTextField("txthrpcode").setStringValue("");pluginCtx.getKDTextField("txthrpid").setStringValue("");pluginCtx.getKDBizPromptBox("prmtempPosition").setValue(null);pluginCtx.getKDBizPromptBox("prmtperson").setValue(null);pluginCtx.getKDBizPromptBox("prmtdirdept").setValue(null);pluginCtx.getKDBizPromptBox("prmthperson").setValue(null);/*根据公司过滤该公司的职员*/var companyInfo = pluginCtx.getKDBizPromptBox("prmthCompany").getValue();if(companyInfo != null && companyInfo != ""){var companyID = companyInfo.get("id");var director = pluginCtx.getKDBizPromptBox("prmthperson");var emp = pluginCtx.getKDBizPromptBox("prmtperson");var empFilterInfo = new FilterInfo();var empEntityViewInfo = new EntityViewInfo();//MsgBox.showInfo(companyID);empFilterInfo.getFilterItems().add(new FilterItemInfo("CU.id", companyID ,CompareType.EQUALS));empEntityViewInfo.setFilter( empFilterInfo );director.setEntityViewInfo(empEntityViewInfo);emp.setEntityViewInfo(empEntityViewInfo);}});//**上级负责人值改变监听**//pluginCtx.getKDBizPromptBox("prmthperson").addDataChangeListener(function(e){//MsgBox.showInfo("负责人值改变监听");pluginCtx.getKDBizPromptBox("prmtdirdept").setValue(null);var companyInfo = pluginCtx.getKDBizPromptBox("prmthCompany").getValue();var directorInfo = pluginCtx.getKDBizPromptBox("prmthperson").getValue();if(companyInfo != null && companyInfo!="" && directorInfo != null && directorInfo != ""){var companyID = companyInfo.get("id");var directorID = directorInfo.get("id");var dept = pluginCtx.getKDBizPromptBox("prmtdirdept");//MsgBox.showInfo(directorID + "-" + companyID);var sql = "select FAdminOrgUnitID from T_ORG_Position WHERE FName_L2 ='负责人' AND FID IN " +"(SELECT FPositionID FROM dbo.T_ORG_PositionMember WHERE FPersonID = '" + directorID + "')";//MsgBox.showInfo(sql);var rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();var orgIdSet = new HashSet();while( rs.next() ){var FAdminOrgUnitID = rs.getString("FAdminOrgUnitID");if(!(StringUtils.isEmpty(FAdminOrgUnitID))){//MsgBox.showInfo("FAdminOrgUnitID:" + FAdminOrgUnitID);orgIdSet.add(FAdminOrgUnitID);}}var filterInfo = new FilterInfo();var entityViewInfo = new EntityViewInfo();//MsgBox.showInfo("orgIdSet:" + orgIdSet);filterInfo.getFilterItems().add( new FilterItemInfo("id", orgIdSet ,CompareType.INCLUDE) );entityViewInfo.setFilter(filterInfo);dept.setEntityViewInfo(entityViewInfo);}});//**对变更职员监听 带出 HRPCode、HRPID、中文名、英文名**//pluginCtx.getKDBizPromptBox("prmtperson").addDataChangeListener(function(e){//MsgBox.showInfo("变更职员值改变监听");pluginCtx.getKDTextField("txtFEnglishName").setStringValue("");pluginCtx.getKDTextField("txtFEmpName").setStringValue("");pluginCtx.getKDTextField("txthrpcode").setStringValue("");pluginCtx.getKDTextField("txthrpid").setStringValue("");pluginCtx.getKDBizPromptBox("prmtempPosition").setValue(null);//通过职员ID 取到cfhrpempidnew ,在T_HRP_person 取到 var empInfo = pluginCtx.getKDBizPromptBox("prmtperson").getValue();if(empInfo != null && empInfo!= ""){var empID = empInfo.get("id");var sql = "SELECT CFHrpEmpIdNew FROM T_BD_Person WHERE FID = '" + empID + "'";//MsgBox.showInfo(sql);var rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();if( rs.next() ){var CFHrpEmpIdNew = rs.getString("CFHrpEmpIdNew");if(CFHrpEmpIdNew != null && CFHrpEmpIdNew != ""){var sql2 = "SELECT FEmpCode,FEmpID,FEmpName,FEnglishName FROM dbo.t_hrp_person WHERE FEmpID_NEW = '"+ CFHrpEmpIdNew +"'";//MsgBox.showInfo(sql2);var rs2 = SQLExecutorFactory.getRemoteInstance(sql2).executeSQL();if( rs2.next() ){var FEmpCode = rs2.getString("FEmpCode");//MsgBox.showInfo(FEmpCode);var FEmpID = rs2.getString("FEmpID");var FEmpName = rs2.getString("FEmpName");var FEnglishName = rs2.getString("FEnglishName");pluginCtx.getKDTextField("txthrpcode").setStringValue(FEmpCode);pluginCtx.getKDTextField("txthrpid").setStringValue(FEmpID);pluginCtx.getKDTextField("txtFEmpName").setStringValue(FEmpName);pluginCtx.getKDTextField("txtFEnglishName").setStringValue(FEnglishName);}}else{MsgBox.showInfo("没有FEmpCode");}}}else{//MsgBox.showInfo("emp为空,不做任何处理");}});//**对Code监听**//pluginCtx.getKDTextField("txthrpcode").addFocusListener(function(event, methodName){//MsgBox.showInfo("Code值改变监听");if(methodName == "focusGained"){}if(methodName == "focusLost"){var empcode = pluginCtx.getKDTextField("txthrpcode").getText();//MsgBox.showInfo("empcode:" + empcode);if(empcode != null && empcode!= ""){var sql = "SELECT FEmpID,FEmpName,FEnglishName FROM T_HRP_person WHERE FEmpCode = '" + empcode +"'";//MsgBox.showInfo(sql);var rs = SQLExecutorFactory.getRemoteInstance(sql).executeSQL();while(rs.next()){var FEmpID = rs.getString("FEmpID");var FEmpName = rs.getString("FEmpName");var FEnglishName = rs.getString("FEnglishName");}if(FEmpID != null && FEmpID != ""){pluginCtx.getKDTextField("txthrpid").setStringValue(FEmpID);pluginCtx.getKDTextField("txtFEmpName").setStringValue(FEmpName);pluginCtx.getKDTextField("txtFEnglishName").setStringValue(FEnglishName);}}}});//MsgBox.showInfo("负责人部门值改变监听");pluginCtx.getKDBizPromptBox("prmtdirdept").addDataChangeListener(function(e){pluginCtx.getKDBizPromptBox("prmtempPosition").setValue(null);var deptInfo = pluginCtx.getKDBizPromptBox("prmtdirdept").getValue();if(deptInfo != null && deptInfo != ""){var deptID = deptInfo.get("id");var empPosition = pluginCtx.getKDBizPromptBox("prmtempPosition");var deptFilterInfo = new FilterInfo();var deptEntityViewInfo = new EntityViewInfo();//MsgBox.showInfo(deptID);deptFilterInfo.getFilterItems().add(new FilterItemInfo("AdminOrgUnit.id", deptID ,CompareType.EQUALS));deptEntityViewInfo.setFilter( deptFilterInfo );empPosition.setEntityViewInfo(deptEntityViewInfo);}});
}//默认当前组织
//如果是新增界面,则设置默认值
if(pluginCtx.getOprtState().equals("ADDNEW")){var Thcom = pluginCtx.getUIContext().get("sysContext").getCurrentFIUnit();pluginCtx.getKDBizPromptBox("prmthCompany").setValue(Thcom);
} //设置编码非必填
pluginCtx.getKDTextField("txtNumber").setRequired(false);
pluginCtx.getUIContext()pluginCtx.getUIContext().get("sysContext")pluginCtx.getOprtState()com.kingdee.eas.util.client.MsgBox.showInfo(args);
3.1:DEP与BOS的结合使用。 DEP添加字段
3.2:界面获取DEP控件 (onload是调用此方法)
KDDatePicker kdclose = new KDDatePicker();
KDPromptBox kdUser = new KDPromptBox();
KDFormattedTextField rejects = new KDFormattedTextField();
KDCheckBox moreProduct = new KDCheckBox();
KDBizPromptBox costObjectGroup = new KDBizPromptBox();
KDCheckBox lsMainMaterial = new KDCheckBox();
private void initDEPContronl() {
Hashtable srTable = new Hashtable();
Object obj = null;
CommonUtils.findComponent(ManufactureOrderEditUICTEx.this, new String[]{"pkkDclose","prmtcloseuser","txtrejects","chkmoreProduct","prmtcostObjectGroup"}, srTable);
if(srTable.size()>0){
obj = srTable.get("pkkDclose");
if(obj instanceof KDDatePicker){
kdclose = (KDDatePicker)srTable.get("pkkDclose");
kdclose.setTimeEnabled(true);
}
obj = srTable.get("prmtcloseuser");
if(obj instanceof KDPromptBox){
kdUser = (KDPromptBox)srTable.get("prmtcloseuser");
}
obj = srTable.get("txtrejects");
if(obj instanceof KDFormattedTextField){
rejects = (KDFormattedTextField)srTable.get("txtrejects");
}
obj = srTable.get("chkmoreProduct");
if(obj instanceof KDCheckBox){
moreProduct = (KDCheckBox)srTable.get("chkmoreProduct");
}
obj = srTable.get("prmtcostObjectGroup");
if(obj instanceof KDPromptBox){
costObjectGroup = (KDBizPromptBox)srTable.get("prmtcostObjectGroup");
}
obj = srTable.get("lsMainMaterial");
if(obj instanceof KDCheckBox){
lsMainMaterial = (KDCheckBox)srTable.get("lsMainMaterial");
}
}
}
3.3:DEP控件公共方法的书写
/**
* 获得通过dep添加的控件
*
* @param comp
* 当前页面.this
* @param controls
* String数组。数组里面放dep添加字段的属性名字,
* @param found
*/
public static void findComponent(Component comp, String[] controls,
Hashtable<String, Component> found) {
Container con = null;
boolean nameEquals = false;
String CompName = null;
if (comp instanceof Container) {
CompName = ((java.awt.Component) comp).getName();
System.out.println(CompName);
if (CompName != null) {
for (int i = 0; i < controls.length; i++) {
if (CompName.equals(controls[i])) {
if (!found.containsKey(CompName)) {
found.put(CompName, comp);
nameEquals = true;
break;
}
}
}
}
if (found.size() != controls.length) {
con = (Container) comp;
int count = con.getComponentCount();
for (int i = 0; i < count; i++) {
findComponent(con.getComponent(i), controls, found);
if (found.size() == controls.length)
return;
}
}
}
}
/****************************** DEP控件的赋值与取值 *************************************/
PurReceivalEntryInfo pInfo = iPurReceivalEntry.getPurReceivalEntryInfo(new ObjectUuidPK(purEntryids));
if(UIRuleUtil.isNull(pInfo.getString("lotNumber"))){
pInfo.setString("lotNumber", pInfo.getString("lotNumber")+lotNumber);
}else{
pInfo.setString("lotNumber", pInfo.getString("lotNumber")+";"+lotNumber);
}
}
/******************************** DEP控件的赋值与取值 ************************************/
//为DEP添加的按钮绑定action
KDWorkButton a = null;
Hashtable hashTable2 = new Hashtable();
findComponent(this.toolBar, new String[] { "btnduifangjianjin", },
hashTable2);
if (hashTable2.size() > 0) {
Object oo = hashTable2.get("btnduifangjianjin");
if (oo != null) {
a = (KDWorkButton) oo;
a.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { // 此处是为按钮绑定方法 相当于在业务设计界面绑定action
try {
showDuiFangJianJinBuLvUI();// 我自己的方法
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
}
}
这篇关于EAS BOS DEP(动态扩展平台自用)基本操作的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!