示例#1
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));
        }
示例#2
0
        /// <summary>
        /// 查询
        /// </summary>
        private void DoSelect()
        {
            if (SearchCriterion.Orders.Count == 0)
            {
                if (!SearchCriterion.Orders.Exists(en => en.PropertyName == "CreateTime"))
                {
                    SearchCriterion.Orders.Add(new OrderCriterionItem("CreateTime", false));
                }
            }

            string type = "all";

            foreach (CommonSearchCriterionItem sear in SearchCriterion.Searches.Searches)
            {
                if (sear.PropertyName == "Name" && sear.Value + "" != "")
                {
                    type = "Logistic";
                }
                else if ((sear.PropertyName == "CName" && sear.Value + "" != "") || (sear.PropertyName == "Number" && sear.Value + "" != ""))
                {
                    type = "Order";
                }
            }

            string did = RequestData.Get <string>("did");

            if (type == "all" || type == "Logistic" || !string.IsNullOrEmpty(did))
            {
                //if (!string.IsNullOrEmpty(did))
                //{
                //    SearchCriterion.Searches.Clear();
                //}
                ents = Logistic.FindAll(SearchCriterion, Expression.Sql(" charindex('" + did + "',DeliveryId)>0 "));

                //if (ents.Count == 0 && !string.IsNullOrEmpty(did))
                //{
                //    DeliveryOrder doent = DeliveryOrder.TryFind(did);
                //    if (doent != null)
                //    {
                //        ents = Logistic.FindAll(SearchCriterion, Expression.Eq("CustomerId", doent.CId));
                //    }
                //}

                this.PageState.Add("LogisticList", ents);
            }

            if (type == "all" || type == "Order")
            {
                string     wtype = RequestData.Get <string>("wtype");
                ICriterion crit  = null;
                if (wtype == "1")
                {
                    SearchCriterion.AddSearch("LogisticState", "已填写");
                }
                else
                {
                    crit = Expression.Or(Expression.Sql(" LogisticState <> '已填写' "), Expression.IsNull("LogisticState"));
                }
                SearchCriterion.AddSearch("State", "已出库");
                DeliveryOrder[] ents2 = DeliveryOrder.FindAll(SearchCriterion, crit);
                this.PageState.Add("OrderList", ents2);

                SearchCriterion.RemoveSearch("State");
            }
        }