EAS BOS 不常用方法介绍

/************************************* 所有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);
	}	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) {  	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();
		}


	}
		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();
		}


	}
  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值