예제 #1
0
        /// <summary>
        /// SAP公司查询
        /// </summary>
        /// <param name="query"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public virtual DataTable QueryCompany(SAPCompanyQueryFilter query, out int totalCount)
        {
            PagingInfoEntity pagingEntity = new PagingInfoEntity();

            pagingEntity.SortField     = query.PagingInfo.SortBy;
            pagingEntity.MaximumRows   = query.PagingInfo.PageSize;
            pagingEntity.StartRowIndex = query.PagingInfo.PageIndex * query.PagingInfo.PageSize;

            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QuerySAPCompany");

            using (DynamicQuerySqlBuilder sqlBuilder = new DynamicQuerySqlBuilder(
                       dataCommand.CommandText, dataCommand, pagingEntity, "SC.WarehouseNumber desc"))
            {
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SC.WarehouseNumber",
                                                             DbType.Int32, "@WarehouseNumber", QueryConditionOperatorType.Equal, query.StockID);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SC.WarehouseName",
                                                             DbType.StringFixedLength, "@WarehouseName", QueryConditionOperatorType.Equal, query.StockName);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SC.SapCoCode",
                                                             DbType.StringFixedLength, "@SapCoCode", QueryConditionOperatorType.Equal, query.SapCompanyCode);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "SC.CompanyCode",
                                                             DbType.StringFixedLength, "@CompanyCode", QueryConditionOperatorType.Equal, query.CompanyCode);
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();

                EnumColumnList enumColumnList = new EnumColumnList();
                enumColumnList.Add("WorkStatus", typeof(SAPStatus));
                DataTable dt = dataCommand.ExecuteDataTable(enumColumnList);
                totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));
                return(dt);
            }
        }
예제 #2
0
        public void QueryCompany(SAPCompanyQueryVM queryVM, int pageSize, int pageIndex, string sortField, Action <dynamic> callback)
        {
            SAPCompanyQueryFilter filter = queryVM.ConvertVM <SAPCompanyQueryVM, SAPCompanyQueryFilter>();

            filter.PagingInfo = new PagingInfo()
            {
                PageIndex = pageIndex,
                PageSize  = pageSize,
                SortBy    = sortField
            };
            filter.CompanyCode = CPApplication.Current.CompanyCode;
            string relativeUrl = "/InvoiceService/SAP/QueryCompany";

            restClient.QueryDynamicData(relativeUrl, filter, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                callback(args.Result);
            });
        }