/// <summary> /// 获取某个客户收款单的金额分配明细 /// </summary> /// <param name="paymentID"></param> /// <returns></returns> public QueryResultList <CustomerPaymentAssign> GetAssigns(string paymentID) { CustomerPaymentAssignSearchCondition con = new CustomerPaymentAssignSearchCondition(); con.PaymentID = paymentID; return(ProviderFactory.Create <IProvider <CustomerPaymentAssign, Guid> >(RepoUri).GetItems(con)); }
/// <summary> /// 获取某个单据的所有付款明细 /// </summary> /// <param name="paymentID"></param> /// <returns></returns> public QueryResultList <CustomerPaymentAssign> GetAssigns(string sheetNo) { CustomerReceivableSearchCondition con1 = new CustomerReceivableSearchCondition() { SheetID = sheetNo, }; List <CustomerReceivable> items = (new CustomerReceivableBLL(RepoUri)).GetItems(con1).QueryObjects; if (items != null && items.Count > 0) { CustomerPaymentAssignSearchCondition con = new CustomerPaymentAssignSearchCondition(); con.ReceivableIDs = items.Select(it => it.ID).ToList(); return(ProviderFactory.Create <IProvider <CustomerPaymentAssign, Guid> >(RepoUri).GetItems(con)); } return(new QueryResultList <CustomerPaymentAssign>(ResultCode.Fail, "没有找到记录", null)); }
protected override List <CustomerPaymentAssign> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search) { IQueryable <CustomerPaymentAssign> ret = dc.GetTable <CustomerPaymentAssign>(); if (search is CustomerPaymentAssignSearchCondition) { CustomerPaymentAssignSearchCondition con = search as CustomerPaymentAssignSearchCondition; if (!string.IsNullOrEmpty(con.PaymentID)) { ret = ret.Where(item => item.PaymentID == con.PaymentID); } if (con.ReceivableIDs != null && con.ReceivableIDs.Count > 0) { ret = ret.Where(item => con.ReceivableIDs.Contains(item.ReceivableID)); } } return(ret.ToList()); }
protected override void DoNullify(CustomerOtherReceivable info, IUnitWork unitWork, DateTime dt, string opt) { CustomerReceivableSearchCondition con = new CustomerReceivableSearchCondition(); con.SheetID = info.ID; List <CustomerReceivable> items = new CustomerReceivableBLL(RepoUri).GetItems(con).QueryObjects; if (items != null && items.Count > 0) { CustomerReceivable cr = items.FirstOrDefault(it => it.ClassID == CustomerReceivableType.CustomerOtherReceivable); if (cr != null) { CustomerPaymentAssignSearchCondition con1 = new CustomerPaymentAssignSearchCondition(); con1.ReceivableIDs = new List <Guid>(); con1.ReceivableIDs.Add(cr.ID); List <CustomerPaymentAssign> assigns = (new CustomerPaymentAssignBLL(RepoUri)).GetItems(con1).QueryObjects; if (assigns != null && assigns.Count > 0) { bool allSuccess = true; foreach (CustomerPaymentAssign assign in assigns) { CommandResult ret = (new CustomerPaymentAssignBLL(AppSettings.Current.ConnStr)).UndoAssign(assign); if (ret.Result != ResultCode.Successful) { allSuccess = false; } } if (!allSuccess) { throw new Exception("某些应收核销项删除失败,请手动删除这些应收核销项后再继续\"作废\"的操作"); } } ProviderFactory.Create <IProvider <CustomerReceivable, Guid> >(RepoUri).Delete(cr, unitWork); //删除应收 } } base.DoNullify(info, unitWork, dt, opt); }