package com.amarsoft.acct.accounting.web; import com.amarsoft.awe.util.SqlObject; import com.amarsoft.awe.util.Transaction; public class GetAllowApplyFlag { private String transactionCode; private String relativeObjectType; private String relativeObjectNo; public String getTransactionCode() { return transactionCode; } public void setTransactionCode(String transactionCode) { this.transactionCode = transactionCode; } public String getRelativeObjectType() { return relativeObjectType; } public void setRelativeObjectType(String relativeObjectType) { this.relativeObjectType = relativeObjectType; } public String getRelativeObjectNo() { return relativeObjectNo; } public void setRelativeObjectNo(String relativeObjectNo) { this.relativeObjectNo = relativeObjectNo; } //获取当前这笔交易是否存在 public String getAllowApplyFlag(Transaction Sqlca) throws Exception{ if("3006".equals(transactionCode) || "3007".equals(transactionCode)){ //若为贷款核销或出售交易 return getHXAllowApplyFlag(Sqlca); } else{ SqlObject sqlo = new SqlObject("select count(*) from acct_transaction where RelativeObjectType =:ObjectType and " + "RelativeObjectNo =:ObjectNo and (TransStatus in('3','0') or TransStatus is null or TransStatus ='') and :TransCode in('2001','2002','3001','3002','3003','3004','4001','4002','4003')"); sqlo.setParameter("ObjectType",relativeObjectType).setParameter("ObjectNo",relativeObjectNo).setParameter("TransCode",transactionCode); String sResult = Sqlca.getString(sqlo); if(sResult.equals("0")) return "true"; return "false"; } } //判断当前许核销交易是否允许 public String getHXAllowApplyFlag(Transaction Sqlca) throws Exception{ SqlObject sqlo = new SqlObject("select count(*) from acct_transaction where RelativeObjectType =:ObjectType and " + "RelativeObjectNo =:ObjectNo and (TransStatus in('3','1','0') or TransStatus is null or TransStatus ='') and TransCode in('3006','3007')"); sqlo.setParameter("ObjectType",relativeObjectType).setParameter("ObjectNo",relativeObjectNo).setParameter("TransCode",transactionCode); String sResult = Sqlca.getString(sqlo); if(sResult.equals("0")) return "true"; return "false"; } }