using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using CoreFS.CA06; using DbHelp = Core.StlMes.Client.Sale.DbHelp; namespace Core.StlMes.Client.Sale.SaleFundMgt.FundBLL.FundPactAccount { public class FundPactAccountMgt:FundBaseBLL.FundBaseBLL { private OpeBase _ob; public FundPactAccountMgt(OpeBase ob) : base(ob) { _ob = ob; } private Model.SEL_FUND_PACT_ACCOUNT GetFundPactAccount(string balansub, string buyercode, string secondeaccount) { Model.SEL_FUND_PACT_ACCOUNT acct = new Model.SEL_FUND_PACT_ACCOUNT(); acct.BALANCESUBJECT = balansub; acct.BUYERCODE = buyercode; acct.SECONDACCOUNT = secondeaccount; return acct; } /// /// 通过结算单位,客户编码,二级账户返回其合同账户信息 /// /// /// /// /// public DataSet GetFundPactAccountByBalanceAndBuyercodeAndSecondAccount(string balansub,string buyercode,string secondeaccount) { DataSet ds = this.GetFundPactAccountInstance(). GetSelFundPactAccountByBalAndBuyercodeAndSecAccount(GetFundPactAccount(balansub,buyercode,secondeaccount),true); return ds; } /// /// 通过结算单位,客户编码,二级账户返回其合同账户信息,并带标题 /// /// /// /// /// public DataSet GetFundPactAccountByBalanceAndBuyercodeAndSecondAccountWithCaption(string balansub, string buyercode, string secondeaccount) { DataSet ds = this.GetFundPactAccountInstance(). GetSelFundPactAccountByBalAndBuyercodeAndSecAccount(GetFundPactAccount(balansub, buyercode, secondeaccount),true); return ds; } /// /// 通过结算单位,客户编码,二级账户,合同号,返回其所有信息 /// /// /// public DataSet GetFundPactUsedDetail(Model.SEL_FUND_PACT_FUNDUSEDETAIL detail) { return base.GetFundPactUsedDetailInstance().GetSelFundPactFundUsedDetailByBalAndBuyercodeAndSecAccountAndPactno(detail); } public DataSet GetFundPactUsedDetail(string balansub, string buyercode, string secondeaccount, string pactno) { Model.SEL_FUND_PACT_FUNDUSEDETAIL detal = new Model.SEL_FUND_PACT_FUNDUSEDETAIL(); detal.BALANCESUBJECT = balansub; detal.BUYERCODE = buyercode; detal.SECONDACCOUNT = secondeaccount; detal.PACTNO = pactno; return GetFundPactUsedDetail(detal); } /// /// 返回有效数据,并按TRANS_TIME时间降序 /// /// /// public DataSet GetFundPactUsedDetailValid(Model.SEL_FUND_PACT_FUNDUSEDETAIL detail) { DataSet ds = GetFundPactUsedDetail(detail); DataSet dsvalid = Util.DataSetUtil.GetDataSetByRowFilter(ds, " ISMONEYVALID = '0' "); DataSet dsDesc = Util.DataSetUtil.ReturnDsByDescOrderFromSourceDataSet(dsvalid, "TRANS_TIME"); return dsDesc; } /// /// 通过结算单位,客户编码,二级账户,合同号,返回有效数据,并按TRANS_TIME时间降序 /// /// /// public DataSet GetFundPactUsedDetailValid(string balansub, string buyercode, string secondeaccount,string pactno) { Model.SEL_FUND_PACT_FUNDUSEDETAIL detal = new Model.SEL_FUND_PACT_FUNDUSEDETAIL(); detal.BALANCESUBJECT = balansub; detal.BUYERCODE = buyercode; detal.SECONDACCOUNT = secondeaccount; detal.PACTNO = pactno; return GetFundPactUsedDetailValid(detal); } /// /// 通过结算单位,客户单位,二级单位,合同号返回其资金转移记录 /// /// /// /// /// /// public DataSet GetSelFundPactTransDetailByBalAndBuyercodeAndSecondAndPactno(string balansub, string buyercode, string secondeaccount, string pactno) { return base.GetFundPactTransDetailInstance().GetSelFundPactTransDetailByBalAndBuyercodeAndSecondAndPactno (balansub,buyercode,secondeaccount,pactno); } /// /// 通过结算单位,客户编码,二级单位返回其实体列表 /// /// /// /// /// public List GetFundPactAccountModelListByBalanceAndBuyercodeAndSecondAccount(string balansub, string buyercode, string secondeaccount) { return this.GetFundPactAccountInstance(). GetSelFundPactAccountModelListByBalAndBuyercodeAndSecAccount(GetFundPactAccount(balansub, buyercode, secondeaccount)); } public void CreatePactAccountInfo(string balanceSubject,string buyercode,string secondAccount,string pactno,out string errMsg) { errMsg = ""; Model.SEL_FUND_PACT_ACCOUNT acct = GetFundPactAccount(balanceSubject,buyercode,secondAccount,pactno); // 原则上同结算单位,同客户,一个合同号只能在一个二级账户,不能多个二级账户分布 List< Model.SEL_FUND_PACT_ACCOUNT> acctmodel = this.GetFundPactAccountInstance().GetSelFundPactAccountByBalanceAndPactno(balanceSubject,buyercode,pactno); if (acctmodel != null) { if (acctmodel.Count > 0) { errMsg = "账号:" + pactno + "已经存在"; return; } } this.GetFundPactAccountInstance().CreateFundPactAccount(acct,out errMsg); } /// /// 创建合同账户,不做错误提示 /// 有则直接退出 /// /// /// /// /// public void CreatePactAccountInfoWithNoErrMsg(string balanceSubject, string buyercode, string secondAccount, string pactno) { string errMsg = ""; Model.SEL_FUND_PACT_ACCOUNT acct = GetFundPactAccount(balanceSubject, buyercode, secondAccount, pactno); // 原则上同结算单位,同客户,一个合同号只能在一个二级账户,不能多个二级账户分布 List acctmodel = this.GetFundPactAccountInstance().GetSelFundPactAccountByBalanceAndPactno(balanceSubject, buyercode, pactno); if (acctmodel != null) { if (acctmodel.Count > 0) { return; } } this.GetFundPactAccountInstance().CreateFundPactAccount(acct, out errMsg); } /// /// 删除合同账户 /// /// /// /// /// /// public void DeletePactAccount(string balanceSubject, string buyercode, string secondAccount, string pactno, out string errMsg) { errMsg = ""; if ( !FundVariable.FundConstVariable.isDefaultAccountCanBeDelete && pactno == FundVariable.FundConstVariable.defaultPactLevelAccount) { errMsg = "默认账号,不允许删除"; return; } Model.SEL_FUND_PACT_ACCOUNT acct = this.GetFundPactAccount(balanceSubject,buyercode,secondAccount,pactno); // 检查合同账号信息,只要总资金大于0,则不允许删除 Model.SEL_FUND_PACT_ACCOUNT pactact = this.GetFundPactAccountInstance().GetSelFundPactAccountModel(acct); if (pactact != null) { if (pactact.TOTALMONEY > 0) { errMsg = "账户资金不为0"; return; } } this.GetFundPactAccountInstance().DeleteFundPactAccount(acct,out errMsg); } } }