您的位置:首页 > 其它

EAS BOS 不常用方法介绍

2016-11-29 13:49 204 查看
/************************************* 所有action方法前  ************************************************/

/**************************** 有时候某些方法不进时可以在这里进行操作 ********************************/

@Override

public void afterAction(BatchActionEnum arg0, BatchSelectionEntries arg1, int arg2) {

if (BatchActionEnum.DELETE.equals(arg0)) {  //DELETE  action的动作
try {
ArrayList<KDTSelectBlock> blocks = tblMain.getSelectManager().getBlocks();
Iterator<KDTSelectBlock> iterator = blocks.iterator();
String purEntryids="";
String purids="";
while(iterator.hasNext()){
KDTSelectBlock block = (KDTSelectBlock)iterator.next();
int top = block.getTop();
int bottom = block.getBottom();
for(int i=top;i <= bottom;i++ ){
purids += "'"+tblMain.getRow(i).getCell("id").getValue()+"',";
purEntryids += "'"+tblMain.getRow(i).getCell("entry.id").getValue()+"',";
}
}
purEntryids = purEntryids.substring(0, purEntryids.length()-1);
purids = purids.substring(0, purids.length()-1);
PurReceivalBatchEntryFactory.getRemoteInstance().deleteBatch(purids,purEntryids);
} catch (Exception e) {
handUIException(e);
}
}

super.afterAction(arg0, arg1, arg2);
}

/************************************* 所有action方法前  ************************************************/

/**************************** 有时候某些方法不进时可以在这里进行操作 ******************************/

与 afterAction 的区别:例如删除的时候afterAction 先提示确认执行你的操作然后再删除
beforeAction先执行你的操作然后在提示和删除。

@Override
public boolean beforeAction(BatchActionEnum bizAction,
BatchSelectionEntries selectionEntries, ActionEvent event) {
if (BatchActionEnum.DELETE.equals(bizAction)) {
try {
你的逻辑!
} catch (Exception e) {
handUIException(e);
}
}
return super.beforeAction(bizAction, selectionEntries, event);
}


/*************************************    batchExecute 方法      ************************************************/
/****************************  不知道什么时候执行,只知道不进审核的时候回进这里  ******************************/
 @Override
    public void batchExecute(Context ctx, BatchActionEnum batchAction,
    BatchActionResults batchResults) throws BOSException, EASBizException {
    super.batchExecute(ctx, batchAction, batchResults);
    String idStr = SQLUtil.arrayToString(batchResults.getToDoIdsArray());
// AUDIT 操作动作 也可是CLOSED、UNCLOSED、RELEASED等
    	if ("AUDIT".equals(batchAction.getBizAction())&&idStr.length()>0) {

    		AuditUpdateDate(ctx, idStr);
    	}
    }

/**
* 
* @Title: AuditUpdateDate 
* @Description: TODO(审核时反写采购申请单的数据) 
*/
private void AuditUpdateDate(Context ctx, String pk) {
PurOrderInfo info;
try {
info = PurOrderFactory.getLocalInstance(ctx).getPurOrderInfo(pk);
PurOrderEntryCollection entryColl = info.getEntries();
for(int i=0;i<entryColl.size();i++){
PurOrderEntryInfo entryInfo = entryColl.get(i);
}
ArrayList<Object[]> list = new ArrayList<Object[]>();
StringBuffer buffer = new StringBuffer();
buffer.append(" SELECT poEntry.fid pofid,prEntry.fid preid,prEntry.FQty auditQty,poEntry.cfroll roll, \n");
buffer.append(" prEntry.CFCREATETOTAL total,prentry.CFCREATENOTTOTAL notTotal FROM T_SM_PurORderEntry poEntry \n");
buffer.append(" JOIN T_SM_PurOrder pur ON pur.fid=poEntry.FParentID \n");
buffer.append(" JOIN T_SM_PurRequestEntry prEntry ON prEntry.fid=poEntry.FSourceBillEntryID \n");
buffer.append(" WHERE poEntry.FParentID='"+pk.toString()+"' \n");
IRowSet rs = DBUtil.executeQuery(ctx, buffer.toString());
while(rs.next()){
int createTotal = rs.getInt("roll")+rs.getInt("total"); //已生成PO的数量
int createNotTotal = rs.getInt("notTotal")-rs.getInt("roll");//未生成PO的数量
list.add(new Object []{createTotal,createNotTotal,rs.getString("preid")});
}
String updateSql = " UPDATE T_SM_PurRequestEntry SET CFCreateTotal=? ,CFCreateNotTotal=? WHERE Fid=? ";
DBUtil.executeBatch(ctx, updateSql, list);

} catch (EASBizException e1) {
e1.printStackTrace();
} catch (BOSException e1) {
e1.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: