NC65的审批二次开发

改变审批状态的时候,会改变元数据固定字段fstatusflag的状态,-1为自由状态,1为审批通过。
然后如果再审批当前单据,改变其他单据的某个字段的状态,

在nc.impl.pub.ace包下面找到对应的审批代码如下

package nc.impl.pub.ace;

import java.util.Collection;

import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsApproveBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsDeleteBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsInsertBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsSendApproveBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsUnApproveBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsUnSendApproveBP;
import nc.bs.lcm.applydocubills.ace.bp.AceApplyDocuBillsUpdateBP;
import nc.bs.lcm.open.proxy.LCOpenProxy;
import nc.bs.lcm.pub.util.LcmConstant;
import nc.impl.pubapp.pattern.data.bill.BillLazyQuery;
import nc.impl.pubapp.pattern.data.bill.BillQuery;
import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool;
import nc.impl.pubapp.pattern.database.DataAccessUtils;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.bd.pub.sqlutil.BDSqlInUtil;
import nc.vo.lcm.docuapply.AggDocuApplyVO;
import nc.vo.lcm.docuapply.DocuApplyVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.VOStatus;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pubapp.bill.pagination.util.PaginationUtils;
import nc.vo.pubapp.pattern.data.IRowSet;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.pubapp.query2.sql.process.QuerySchemeProcessor;
import nc.vo.tmpub.util.TmpubQueryUtil;

public abstract class AceApplyDocuBillsPubServiceImpl {
    
    
	// 新增
	public AggDocuApplyVO[] pubinsertBills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		try {
    
    
			// 数据库中数据和前台传递过来的差异VO合并后的结果
			BillTransferTool<AggDocuApplyVO> transferTool = new BillTransferTool<AggDocuApplyVO>(
					clientFullVOs);
			// 调用BP
			AceApplyDocuBillsInsertBP action = new AceApplyDocuBillsInsertBP();
			AggDocuApplyVO[] retvos = action.insert(clientFullVOs);
			// 构造返回数据
			return transferTool.getBillForToClient(retvos);
		} catch (Exception e) {
    
    
			ExceptionUtils.marsh(e);
		}
		return null;
	}

	// 删除
	public void pubdeleteBills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		try {
    
    
			// 调用BP
			new AceApplyDocuBillsDeleteBP().delete(clientFullVOs);
		} catch (Exception e) {
    
    
			ExceptionUtils.marsh(e);
		}
	}

	// 修改
	public AggDocuApplyVO[] pubupdateBills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		try {
    
    
			// 加锁 + 检查ts
			BillTransferTool<AggDocuApplyVO> transferTool = new BillTransferTool<AggDocuApplyVO>(
					clientFullVOs);
			AceApplyDocuBillsUpdateBP bp = new AceApplyDocuBillsUpdateBP();
			AggDocuApplyVO[] retvos = bp.update(clientFullVOs, originBills);
			// 构造返回数据
			return transferTool.getBillForToClient(retvos);
		} catch (Exception e) {
    
    
			ExceptionUtils.marsh(e);
		}
		return null;
	}

	public AggDocuApplyVO[] pubquerybills(IQueryScheme queryScheme)
			throws BusinessException {
    
    
		AggDocuApplyVO[] bills = null;
		try {
    
    
			this.preQuery(queryScheme);
			BillLazyQuery<AggDocuApplyVO> query = new BillLazyQuery<AggDocuApplyVO>(
					AggDocuApplyVO.class);
			bills = query.query(queryScheme, null);
		} catch (Exception e) {
    
    
			ExceptionUtils.marsh(e);
		}
		return bills;
	}

	/**
	 * 由子类实现,查询之前对queryScheme进行加工,加入自己的逻辑
	 * 
	 * @param queryScheme
	 */
	protected void preQuery(IQueryScheme queryScheme) {
    
    
		// 查询之前对queryScheme进行加工,加入自己的逻辑
	}

	// 提交
	public AggDocuApplyVO[] pubsendapprovebills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		AceApplyDocuBillsSendApproveBP bp = new AceApplyDocuBillsSendApproveBP();
		AggDocuApplyVO[] retvos = bp.sendApprove(clientFullVOs, originBills);
		return retvos;
	}

	// 收回
	public AggDocuApplyVO[] pubunsendapprovebills(
			AggDocuApplyVO[] clientFullVOs, AggDocuApplyVO[] originBills)
			throws BusinessException {
    
    
		AceApplyDocuBillsUnSendApproveBP bp = new AceApplyDocuBillsUnSendApproveBP();
		AggDocuApplyVO[] retvos = bp.unSend(clientFullVOs, originBills);
		return retvos;
	};

	// 审批
	public AggDocuApplyVO[] pubapprovebills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		for (int i = 0; clientFullVOs != null && i < clientFullVOs.length; i++) {
    
    
			clientFullVOs[i].getParentVO().setStatus(VOStatus.UPDATED);
		}
		AceApplyDocuBillsApproveBP bp = new AceApplyDocuBillsApproveBP();
		AggDocuApplyVO[] retvos = bp.approve(clientFullVOs, originBills);
		return retvos;
	}

	// 弃审

	public AggDocuApplyVO[] pubunapprovebills(AggDocuApplyVO[] clientFullVOs,
			AggDocuApplyVO[] originBills) throws BusinessException {
    
    
		for (int i = 0; clientFullVOs != null && i < clientFullVOs.length; i++) {
    
    
			clientFullVOs[i].getParentVO().setStatus(VOStatus.UPDATED);
		}
		AceApplyDocuBillsUnApproveBP bp = new AceApplyDocuBillsUnApproveBP();
		AggDocuApplyVO[] retvos = bp.unApprove(clientFullVOs, originBills);
		return retvos;
	}

	// 分页查询方法,查询所有PK
	public String[] pubquerypkbills(IQueryScheme queryScheme)
			throws BusinessException {
    
    
		// String beanId=(String) queryScheme.get(QueryConstants.BEAN_ID);
		StringBuffer sql = new StringBuffer();
		QuerySchemeProcessor processor = new QuerySchemeProcessor(queryScheme);
		String mainAlias = processor.getMainTableAlias();
		sql.append(" select distinct ");
		sql.append(mainAlias);
		sql.append(".");
		sql.append("pk_apply");
		processor.appendFuncPermissionOrgSql();
		sql.append(processor.getFinalFromWhere());
		DataAccessUtils dao = new DataAccessUtils();
		IRowSet rowset = dao.query(sql.toString());
		String[] keys = rowset.toOneDimensionStringArray();
		
		// V63 增加待我审批查询方案
	    keys = TmpubQueryUtil.filterForApprove(queryScheme, keys, DocuApplyVO.class,
	    		LcmConstant.docuApply);
		return keys;
	}

	// 分页查询方法,根据PK查单据
	public AggDocuApplyVO[] pubquerybillbypkbills(String[] pks)
			throws BusinessException {
    
    
		AggDocuApplyVO[] bills = null;
		BillQuery<AggDocuApplyVO> query = new BillQuery<AggDocuApplyVO>(
				AggDocuApplyVO.class);
		bills = query.query(pks);
		return PaginationUtils.filterNotExistBills(bills, pks);
	}
	/**
	 * 根据信用证号,联查主键(联查使用)
	 * @param pk 信用证号(出口信用证,进口信用证)
	 * @param isOut 是否出口信用证
	 * @return
	 * @throws BusinessException
	 */
	public String[] pubquerypksbylcno(String pk,UFBoolean isOut)
			throws BusinessException {
    
    
		// String beanId=(String) queryScheme.get(QueryConstants.BEAN_ID);
		StringBuffer sql = new StringBuffer();
		sql.append(" select distinct ");
		sql.append(" pk_apply ");
		sql.append(" from lcm_docuapply ");
		StringBuffer wheresql = new StringBuffer();
		if(isOut.booleanValue()){
    
    
			wheresql.append("where outlcno = '"+pk+"'");
		}else{
    
    
			wheresql.append("where inlcno = '"+pk+"'");
		}
		wheresql.append(" and isnull(dr,0)=0");
		sql.append(wheresql.toString());
		DataAccessUtils dao = new DataAccessUtils();
		IRowSet rowset = dao.query(sql.toString());
		String[] keys = rowset.toOneDimensionStringArray();
		return keys;
	}
	/**
	 * 
	 * function:
	 * @param srcpks
	 * @return
	 * @throws BusinessException
	 * 2012-12-12 下午08:24:38
	 */
	@SuppressWarnings("unchecked")
	public AggDocuApplyVO[] queryByArrivalPKs(String[] srcpks)
			throws BusinessException {
    
    
		String sql = BDSqlInUtil.formInSQLWithoutAnd(
				DocuApplyVO.PK_SRCBILL, srcpks, false);
		Collection<AggDocuApplyVO> collection = LCOpenProxy
				.getInstance()
				.getMDPersistenceQueryService()
				.queryBillOfVOByCond(AggDocuApplyVO.class, sql, true,
						false);
		return collection.toArray(new AggDocuApplyVO[collection.size()]);
	}

	public String[] pubquerypksbysubmission(String pk) {
    
    
		StringBuffer sql = new StringBuffer();
		sql.append(" select distinct ");
		sql.append(" pk_apply ");
		sql.append(" from lcm_docuapply ");
		StringBuffer wheresql = new StringBuffer();
		wheresql.append("where outdocubillno = '"+pk+"'");
		wheresql.append(" and isnull(dr,0)=0");
		sql.append(wheresql.toString());
		DataAccessUtils dao = new DataAccessUtils();
		IRowSet rowset = dao.query(sql.toString());
		String[] keys = rowset.toOneDimensionStringArray();
		return keys;
	}
}

/**
* 由子类实现,查询之前对queryScheme进行加工,加入自己的逻辑
*
* @param queryScheme
*/
protected void preQuery(IQueryScheme queryScheme) {
// 查询之前对queryScheme进行加工,加入自己的逻辑
}

这个可参考:nc.impl.ifac.ia.ace.AceDemandintcalQueryImpl 中的 preQuery()方法

猜你喜欢

转载自blog.csdn.net/u010741112/article/details/129954224