Esempio n. 1
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            string where = " where 1=1 ";
            string wherec = " where 1=1 ";

            foreach (CommonSearchCriterionItem item in SearchCriterion.Searches.Searches)
            {
                if (item.PropertyName == "Code")
                {
                    if (item.Value + "" != "")
                    {
                        where += " and Id in (select DId from " + db + "..DelieryOrderPart where PCode like '%" + item.Value + "%')";
                    }
                }
                else
                {
                    where += " and " + item.PropertyName + " like '%" + item.Value + "%' ";
                }
            }
            if (RequestData.Get <string>("type") == "yi")
            {
                where  += " and [State]='已出库' ";
                wherec += " and p.[State]='已出库' ";
            }
            else
            {
                where  += " and ([State] is null or [State]<>'已出库') ";
                wherec += " and (p.[State] is null or p.[State]<>'已出库') ";
            }
            string sql = @"select * from " + db + "..DeliveryOrder " + where;

            this.PageState.Add("OrderList", GetPageData(sql, SearchCriterion));

            //查询详细产品的数量
            CommonSearchCriterionItem itemtp = SearchCriterion.Searches.Searches.Where(obj => obj.PropertyName == "Code").FirstOrDefault <CommonSearchCriterionItem>();

            SearchCriterion.Searches.RemoveSearch("Code");
            foreach (CommonSearchCriterionItem search in SearchCriterion.Searches.Searches)
            {
                wherec += " and p." + search.PropertyName + " like '%" + search.Value + "%'";
            }
            if (itemtp != null && itemtp.Value + "" != "")
            {
                wherec += " and c.PCode like '%" + itemtp.Value + "%'";
            }
            PageState.Add("quantity", DataHelper.QueryValue("select sum([Count]) from " + db + "..DeliveryOrder p inner join " + db + "..DelieryOrderPart c on c.DId=p.Id" + wherec));
        }
Esempio n. 2
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            string db = ConfigurationManager.AppSettings["ExamineDB"];

            if (!SearchCriterion.Orders.Exists(en => en.PropertyName == "CreateTime"))
            {
                SearchCriterion.Orders.Add(new OrderCriterionItem("CreateTime", false));
            }

            string where = "";
            string wherec = " where 1=1 ";

            if (RequestData.Get <string>("type") == "yi")
            {
                where  += " [State]='已出库' ";
                wherec += " and p.[State]='已出库' ";
            }
            else
            {
                where  += " ([State] is null or [State]<>'已出库') ";
                wherec += " and (p.[State] is null or p.[State]<>'已出库') ";
            }

            CommonSearchCriterionItem item = SearchCriterion.Searches.Searches.Where(obj => obj.PropertyName == "Code").FirstOrDefault <CommonSearchCriterionItem>();

            SearchCriterion.Searches.RemoveSearch("Code");
            if (item != null && item.Value + "" != "")
            {
                ents = DeliveryOrder.FindAll(SearchCriterion, Expression.Sql(" Id in (select DId from " + db + "..DelieryOrderPart where PCode like '%" + item.Value + "%') and " + where));
            }
            else
            {
                ents = DeliveryOrder.FindAll(SearchCriterion, Expression.Sql(where));
            }
            this.PageState.Add("OrderList", ents);

            //查询详细产品的数量
            foreach (CommonSearchCriterionItem search in SearchCriterion.Searches.Searches)
            {
                wherec += " and p." + search.PropertyName + " like '%" + search.Value + "%'";
            }
            if (item != null && item.Value + "" != "")
            {
                wherec += " and c.PCode like '%" + item.Value + "%'";
            }
            PageState.Add("quantity", DataHelper.QueryValue("select sum([Count]) from " + db + "..DeliveryOrder p inner join " + db + "..DelieryOrderPart c on c.DId=p.Id" + wherec));
        }