public virtual QueryResultList QueryRMAProductInventory(RMAInventoryQueryFilter request) { QueryResultList resultList = new QueryResultList(); int totalCount; decimal totalMisCost; var dataTable = ObjectFactory <IReportQueryDA> .Instance.QueryRMAProductInventory(request, out totalCount, out totalMisCost); QueryResult resultTable = new QueryResult() { Data = dataTable, TotalCount = totalCount }; DataTable dt = new DataTable(); dt.Columns.Add("TotleMisCost", typeof(decimal)); dt.Rows.Add(totalMisCost); QueryResult MisCost = new QueryResult() { Data = dt }; resultList.Add(resultTable); resultList.Add(MisCost); return(resultList); }
public virtual QueryResult QueryRMAProductInventoryForExport(RMAInventoryQueryFilter request) { int totalCount; decimal totalMisCost; var dataTable = ObjectFactory <IReportQueryDA> .Instance.QueryRMAProductInventory(request, out totalCount, out totalMisCost); return(new QueryResult() { Data = dataTable, TotalCount = totalCount }); }
/// <summary> /// NoBizQuery RMA单件库存 /// </summary> /// <param name="filter">查询条件</param> /// <param name="totalCount">out数据条数</param> /// <returns>DataTable</returns> public virtual DataTable QueryRMAItemInventory(RMAInventoryQueryFilter filter, out int totalCount) { PagingInfoEntity pagingEntity = new PagingInfoEntity(); pagingEntity.SortField = filter.PagingInfo.SortBy; pagingEntity.MaximumRows = filter.PagingInfo.PageSize; pagingEntity.StartRowIndex = filter.PagingInfo.PageIndex * filter.PagingInfo.PageSize; var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryGetRMAItemsInventory"); using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, " A.SysNo ")) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.Status", DbType.Int32, "@Status", QueryConditionOperatorType.Equal, RMARequestStatus.Handling); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "D.RecvTime", DbType.DateTime, "@RecvTime", QueryConditionOperatorType.IsNotNull, DBNull.Value); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "B.SysNo", DbType.Int32, "@SysNo", QueryConditionOperatorType.Equal, filter.ProductSysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.OwnBy", DbType.Int32, "@OwnBy", QueryConditionOperatorType.Equal, filter.RMAOwnBy); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.SysNo", DbType.Int32, "@RMASysNo", QueryConditionOperatorType.Equal, filter.RMASysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.LocationWarehouse", DbType.AnsiStringFixedLength, "@LocationWarehouse", QueryConditionOperatorType.Equal, filter.LocationWarehouse); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.OwnByWarehouse", DbType.AnsiStringFixedLength, "@OwnByWarehouse", QueryConditionOperatorType.Equal, filter.OwnByWarehouse); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.CompanyCode", DbType.String, "@CompanyCode", QueryConditionOperatorType.Equal, filter.CompanyCode); cmd.CommandText = sqlBuilder.BuildQuerySql(); EnumColumnList enumList = new EnumColumnList(); enumList.Add("OutBoundStatus", typeof(RMAOutBoundStatus)); enumList.Add("RevertStatus", typeof(RMARevertStatus)); enumList.Add("RefundStatus", typeof(RMARefundStatus)); enumList.Add("NewProductStatus", typeof(RMANewProductStatus)); enumList.Add("ReturnStatus", typeof(RMAReturnStatus)); DataTable dt = cmd.ExecuteDataTable(enumList); totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); return(dt); } }
public void ExportRMAItemExcelFile(RMAInventoryQueryVM queryVM, ColumnSet[] columns) { RMAInventoryQueryFilter queryFilter = new RMAInventoryQueryFilter(); queryFilter = queryVM.ConvertVM <RMAInventoryQueryVM, RMAInventoryQueryFilter>(); queryFilter.PagingInfo = new PagingInfo { PageSize = ConstValue.MaxRowCountLimit, PageIndex = 0, SortBy = string.Empty }; queryFilter.CompanyCode = CPApplication.Current.CompanyCode; string relativeUrl = "/RMAService/Report/RMAInventory/QueryRMAItem"; restClient.ExportFile(relativeUrl, queryFilter, columns); }
/// <summary> /// NoBizQuery RMA商品库存 /// </summary> /// <param name="filter">查询条件</param> /// <param name="totalCount">out 数据数量</param> /// <param name="totalMisCost">out 未税(增值税)成本</param> /// <returns>DataTable</returns> public virtual DataTable QueryRMAProductInventory(RMAInventoryQueryFilter filter, out int totalCount, out decimal totalMisCost) { PagingInfoEntity pagingEntity = new PagingInfoEntity(); pagingEntity.SortField = filter.PagingInfo.SortBy; pagingEntity.MaximumRows = filter.PagingInfo.PageSize; pagingEntity.StartRowIndex = filter.PagingInfo.PageIndex * filter.PagingInfo.PageSize; var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("QueryRMAProductsInventory"); using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, " p.SysNo ")) { sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "R.Status", DbType.Int32, "@Status", QueryConditionOperatorType.Equal, RMARequestStatus.Handling); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "RMA_Request.RecvTime", DbType.DateTime, "@RecvTime", QueryConditionOperatorType.IsNotNull, DBNull.Value); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "P.SysNo", DbType.Int32, "@ProductSysNo", QueryConditionOperatorType.Equal, filter.ProductSysNo); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "OwnBy", DbType.Int32, "@OWnBy", QueryConditionOperatorType.Equal, filter.RMAOwnBy); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "LocationWarehouse", DbType.AnsiStringFixedLength, "@LocationWarehouse", QueryConditionOperatorType.Equal, filter.LocationWarehouse); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "OwnByWarehouse", DbType.AnsiStringFixedLength, "@OwnByWarehouse", QueryConditionOperatorType.Equal, filter.OwnByWarehouse); sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "R.CompanyCode", DbType.String, "@CompanyCode", QueryConditionOperatorType.Equal, filter.CompanyCode); cmd.CommandText = sqlBuilder.BuildQuerySql(); cmd.AddOutParameter("@TotleMisCost", DbType.String, 20); DataTable dt = cmd.ExecuteDataTable(); totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount")); object temp = cmd.GetParameterValue("@TotleMisCost"); decimal.TryParse(temp != null ? temp.ToString() : string.Empty, out totalMisCost); return(dt); } }
public virtual QueryResult QueryRMAItemInventory(RMAInventoryQueryFilter request) { int totalCount; DataTable dataTable = ObjectFactory <IReportQueryDA> .Instance.QueryRMAItemInventory(request, out totalCount); dataTable.Columns.Add("Inventory", typeof(int)); if (dataTable.Rows.Count > 0) { foreach (DataRow dr in dataTable.Rows) { RMAOutBoundStatus OutBoundStatus; if (!Enum.TryParse(dr["OutBoundStatus"].ToString(), out OutBoundStatus)) { //转换失败赋个条件判断不需要的值... OutBoundStatus = RMAOutBoundStatus.Abandon; } RMARevertStatus RevertStatus; if (!Enum.TryParse(dr["RevertStatus"].ToString(), out RevertStatus)) { RevertStatus = RMARevertStatus.Abandon; } RMANewProductStatus NewProductStatus; if (!Enum.TryParse(dr["NewProductStatus"].ToString(), out NewProductStatus)) { NewProductStatus = RMANewProductStatus.OtherProduct; } dr["Inventory"] = (OutBoundStatus == RMAOutBoundStatus.SendAlready || RevertStatus == RMARevertStatus.Reverted && NewProductStatus == RMANewProductStatus.Origin) ? 0 : 1; } } return(new QueryResult() { Data = dataTable, TotalCount = totalCount }); }
public void QueryRMAItemInventory(RMAInventoryQueryVM queryVM, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback) { RMAInventoryQueryFilter queryFilter = new RMAInventoryQueryFilter(); queryFilter = queryVM.ConvertVM <RMAInventoryQueryVM, RMAInventoryQueryFilter>(); queryFilter.PagingInfo = new PagingInfo { PageSize = PageSize, PageIndex = PageIndex, SortBy = SortField }; queryFilter.CompanyCode = CPApplication.Current.CompanyCode; string relativeUrl = "/RMAService/Report/RMAInventory/QueryRMAItem"; restClient.QueryDynamicData(relativeUrl, queryFilter, (obj, args) => { if (args.FaultsHandle()) { return; } callback(obj, args); }); }