public ActionResult AjaxRequestOrderQuery() { RMARequestQueryFilter filter = BuildQueryFilterEntity <RMARequestQueryFilter>(); filter.SellerSysNo = UserAuthHelper.GetCurrentUser().SellerSysNo; var result = RMARequestService.RMARequestOrderQuery(filter); return(AjaxGridJson(result)); }
public QueryResult QueryRequest(RMARequestQueryFilter request) { int totalCount; var dataTable = ObjectFactory <IRMARequestQueryDA> .Instance.QueryRMARequest(request, out totalCount); return(new QueryResult() { Data = dataTable, TotalCount = totalCount }); }
public void Query(RequestQueryReqVM vm, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback) { RMARequestQueryFilter filter = vm.ConvertVM <RequestQueryReqVM, RMARequestQueryFilter>(); filter.CompanyCode = CPApplication.Current.CompanyCode; filter.PagingInfo = new QueryFilter.Common.PagingInfo { PageSize = PageSize, PageIndex = PageIndex, SortBy = SortField }; string relativeUrl = "/RMAService/Request/Query"; restClient.QueryDynamicData(relativeUrl, filter, (obj, args) => { if (args.FaultsHandle()) { return; } callback(obj, args); }); }
public static QueryResult <RMARequestQueryResultInfo> RMARequestOrderQuery(RMARequestQueryFilter filter) { return(RMARequestDA.QueryList(filter)); }
/// <summary> /// 获取订单相关RMA /// </summary> /// <param name="query">过滤条件</param> /// <param name="callback">回调函数</param> public void QueryRMARequest(RMARequestQueryFilter query, EventHandler <RestClientEventArgs <dynamic> > callback) { GetRestClient(ConstValue.DomainName_RMA).QueryDynamicData("/RMAService/Request/Query", query, callback); }
public DataTable QueryRMARequest(RMARequestQueryFilter filter, out int totalCount) { if (filter == null) { totalCount = -1; return(null); } CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryRequests"); PagingInfoEntity pagingInfo = new PagingInfoEntity() { SortField = filter.PagingInfo.SortBy, StartRowIndex = filter.PagingInfo.PageIndex * filter.PagingInfo.PageSize, MaximumRows = filter.PagingInfo.PageSize }; using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, "request.SysNo DESC")) { #region build query conditions if (filter.CreateDateFrom != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.CreateTime", DbType.DateTime, "@CreateTimeFrom", QueryConditionOperatorType.MoreThanOrEqual, filter.CreateDateFrom); } if (filter.CreateDateTo != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.CreateTime", DbType.DateTime, "@CreateTimeTo", QueryConditionOperatorType.LessThan, filter.CreateDateTo); } if (filter.ReceivedDateFrom != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.RecvTime", DbType.DateTime, "@RecvTimeFrom", QueryConditionOperatorType.MoreThanOrEqual, filter.ReceivedDateFrom); } if (filter.ReceivedDateTo != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.RecvTime", DbType.DateTime, "@RecvTimeTo", QueryConditionOperatorType.LessThan, filter.ReceivedDateTo); } if (filter.ETakeDateFrom != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.ETakeDate", DbType.DateTime, "@ETakeDateFrom", QueryConditionOperatorType.MoreThanOrEqual, filter.ETakeDateFrom); } if (filter.ETakeDateTo != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.ETakeDate", DbType.DateTime, "@ETakeDateTo", QueryConditionOperatorType.LessThan, filter.ETakeDateTo); } if (!string.IsNullOrEmpty(filter.SOID)) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "so.SOID", DbType.String, "@SOID", QueryConditionOperatorType.Equal, filter.SOID); } if (!string.IsNullOrEmpty(filter.RequestID)) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.RequestID", DbType.String, "@RequestID", QueryConditionOperatorType.Equal, filter.RequestID); } if (filter.IsVIP.HasValue) { using (GroupCondition group = new GroupCondition(builder, QueryConditionRelationType.AND)) { if (filter.IsVIP.Value) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "customer.VIPRank", DbType.Int32, "@AutoVIP", QueryConditionOperatorType.Equal, 2 // VIPRank.AutoVIP ); builder.ConditionConstructor.AddCondition( QueryConditionRelationType.OR, "customer.VIPRank", DbType.Int32, "@ManualVIP", QueryConditionOperatorType.Equal, 4 // VIPRank.ManualVIP ); } else { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "customer.VIPRank", DbType.Int32, "@AutoNonVIP", QueryConditionOperatorType.Equal, 1 // VIPRank.AutoNonVIP ); builder.ConditionConstructor.AddCondition( QueryConditionRelationType.OR, "customer.VIPRank", DbType.Int32, "@ManualNonVIP", QueryConditionOperatorType.Equal, 3 // VIPRank.ManualNonVIP ); } } } if (filter.CustomerSysNo.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "customer.SysNo", DbType.Int32, "@SysNo", QueryConditionOperatorType.Equal, filter.CustomerSysNo); } if (!string.IsNullOrEmpty(filter.CustomerID)) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "customer.CustomerID", DbType.String, "@CustomerID", QueryConditionOperatorType.Equal, filter.CustomerID); } if (filter.ReceiveUserSysNo.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.RecvUserSysNo", DbType.Int32, "@RecvUserSysNo", QueryConditionOperatorType.Equal, filter.ReceiveUserSysNo); } if (filter.IsSubmit.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.IsSubmit", DbType.Int32, "@IsSubmit", QueryConditionOperatorType.Equal, filter.IsSubmit); } if (filter.Status.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.Status", DbType.Int32, "@Status", QueryConditionOperatorType.Equal, filter.Status ); } if (filter.SysNo.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.SysNo", DbType.Int32, "@SysNo", QueryConditionOperatorType.Equal, filter.SysNo ); } if (filter.SOSysNo.HasValue) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.SOSysNo", DbType.Int32, "@SOSysNo", QueryConditionOperatorType.Equal, filter.SOSysNo ); } if (!string.IsNullOrEmpty(filter.CompanyCode)) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.CompanyCode", DbType.AnsiStringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, filter.CompanyCode ); } if (filter.IsLabelPrinted != null) { string strIsLabelPrinted = "N"; if (filter.IsLabelPrinted.Value) { strIsLabelPrinted = "Y"; } builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.IsLabelPrinted", DbType.AnsiStringFixedLength, "@IsLabelPrinted", QueryConditionOperatorType.Equal, strIsLabelPrinted ); } if (filter.SellersType != null) { if (filter.SellersType == SellersType.Self) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.InvoiceType", DbType.AnsiStringFixedLength, "@InvoiceType", QueryConditionOperatorType.Equal, 0 ); } else { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.InvoiceType", DbType.AnsiStringFixedLength, "@InvoiceType", QueryConditionOperatorType.Equal, 1 ); } } //服务编码 add by norton 2012.11.21 if (!string.IsNullOrEmpty(filter.ServiceCode)) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.ServiceCode", DbType.String, "@ServiceCode", QueryConditionOperatorType.Equal, filter.ServiceCode); } if (filter.AuditUserSysNo.HasValue) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.AuditUserSysNo", DbType.Int32, "@AuditUserSysNo", QueryConditionOperatorType.Equal, filter.AuditUserSysNo); } if (filter.AuditDateFrom != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.AuditTime", DbType.DateTime, "@AuditDateFrom", QueryConditionOperatorType.MoreThanOrEqual, filter.AuditDateFrom); } if (filter.AuditDateTo != null) { builder.ConditionConstructor.AddCondition( QueryConditionRelationType.AND, "request.AuditTime", DbType.DateTime, "@AuditDateTo", QueryConditionOperatorType.LessThanOrEqual, filter.AuditDateTo); } #endregion dataCommand.CommandText = builder.BuildQuerySql(); #region 扩展字段读取 string columnExtendColumnRMAItemSysNos = string.Empty; //需要读取额外的单件连接数据 if (filter.IsReadRMAItemSysNos) { columnExtendColumnRMAItemSysNos = string.Format(",{0}", "(SELECT [OverseaOrderManagement].[dbo].[UF_GetRMAItemSysNos] (request.SysNo)) as RMAItemSysNos"); } dataCommand.CommandText = dataCommand.CommandText.Replace("#ExtendColRMAItemSysNos#", columnExtendColumnRMAItemSysNos); #endregion dataCommand.SetParameterValue("@StartNumber", filter.PagingInfo.PageSize * filter.PagingInfo.PageIndex); dataCommand.SetParameterValue("@EndNumber", filter.PagingInfo.PageSize * filter.PagingInfo.PageIndex + filter.PagingInfo.PageSize); DataTable dt = dataCommand.ExecuteDataTable("Status", typeof(RMARequestStatus)); totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount")); return(dt); } }
public static QueryResult <RMARequestQueryResultInfo> QueryList(RMARequestQueryFilter filter) { QueryResult <RMARequestQueryResultInfo> result = new QueryResult <RMARequestQueryResultInfo>(); CustomDataCommand command = DataCommandManager.CreateCustomDataCommandFromConfig("QueryRMARequestList"); using (DynamicQuerySqlBuilder builder = new DynamicQuerySqlBuilder(command.CommandText, command, filter, !string.IsNullOrWhiteSpace(filter.SortFields) ? filter.SortFields : "SysNo DESC")) { //订单编号 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SOSysNo", DbType.Int32 , "@SOSysNo", QueryConditionOperatorType.Equal, filter.SOSysNo); //订单日期 DateTime orderDateFrom, orderDateTo; if (!string.IsNullOrWhiteSpace(filter.OrderDateFrom) && DateTime.TryParse(filter.OrderDateFrom, out orderDateFrom)) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "OrderDate", DbType.DateTime , "@OrderDateFrom", QueryConditionOperatorType.MoreThanOrEqual, orderDateFrom); } if (!string.IsNullOrWhiteSpace(filter.OrderDateTo) && DateTime.TryParse(filter.OrderDateTo, out orderDateTo)) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "OrderDate", DbType.DateTime , "@OrderDateTo", QueryConditionOperatorType.LessThan, orderDateTo.Date.AddDays(1)); } //顾客帐号 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "CustomerID", DbType.String , "@CustomerID", QueryConditionOperatorType.Like, filter.CustomerID); //退货单编号 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "RequestID", DbType.String , "@RequestID", QueryConditionOperatorType.Equal, filter.RequestID); //申请日期 DateTime requestDateFrom, requestDateTo; if (!string.IsNullOrWhiteSpace(filter.RequestDateFrom) && DateTime.TryParse(filter.RequestDateFrom, out requestDateFrom)) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.CreateTime", DbType.DateTime , "@RequestDateFrom", QueryConditionOperatorType.MoreThanOrEqual, requestDateFrom); } if (!string.IsNullOrWhiteSpace(filter.RequestDateTo) && DateTime.TryParse(filter.RequestDateTo, out requestDateTo)) { builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.CreateTime", DbType.DateTime , "@RequestDateTo", QueryConditionOperatorType.LessThan, requestDateTo.Date.AddDays(1)); } //退换货状态 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.Status", DbType.Int32 , "@Status", QueryConditionOperatorType.Equal, filter.Status); //商品编号 if (!string.IsNullOrWhiteSpace(filter.ProductSysNo)) { builder.ConditionConstructor.AddCustomCondition(QueryConditionRelationType.AND, String.Format(@" EXISTS (SELECT TOP 1 1 FROM dbo.RMA_Request_Item WITH(NOLOCK) INNER JOIN dbo.RMA_Register WITH(NOLOCK) ON RMA_Request_Item.RegisterSysno = RMA_Register.Sysno INNER JOIN dbo.Product WITH(NOLOCK) ON Product.Sysno = RMA_Register.ProductSysNo WHERE RMA_Request_Item.RequestSysno =request.Sysno AND RMA_Register.ProductSysNo= {0})", filter.ProductSysNo)); } //电话号码 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.Phone", DbType.String , "@Phone", QueryConditionOperatorType.Equal, filter.ReceiverPhone); //商家编号 builder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "request.MerchantSysno", DbType.Int32 , "@MerchantSysNo", QueryConditionOperatorType.Equal, filter.SellerSysNo); command.CommandText = builder.BuildQuerySql(); StringBuilder sb = new StringBuilder(); List <RMARequestQueryResultInfo> resultList = command.ExecuteEntityList <RMARequestQueryResultInfo>((s, t) => { sb.Clear(); if (!String.IsNullOrWhiteSpace((string)s["RequestType"])) { string[] types = s["RequestType"].ToString().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < types.Length; i++) { sb.AppendFormat("{0}/", EnumHelper.GetDescription((RMARequestType)Enum.Parse(typeof(RMARequestType), types[i]))); } t.RequestType = sb.ToString().TrimEnd('/'); } t.Status = EnumHelper.GetDescription((RMARequestStatus)Enum.Parse(typeof(RMARequestStatus), s["Status"].ToString())); }); int totalCount = Convert.ToInt32(command.GetParameterValue("@TotalCount")); result.PageInfo = new PageInfo() { PageIndex = filter.PageIndex, PageSize = filter.PageSize, TotalCount = totalCount, SortBy = filter.SortFields }; result.ResultList = resultList; } return(result); }