Esempio n. 1
0
        private string GetStrCondition()
        {
            string condition   = "1=1";
            string QRcondition = "";

            //以下语句为准备查询条件
            //物料代码条件
            if (TextBoxCode.Text.Trim() != "")
            {
                condition = " QROut_MatCode LIKE '%" + TextBoxCode.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxCode", TextBoxCode.GetType().ToString(), TextBoxCode.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and QROut_MatCode like '%" + TextBoxCode.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }

            //物料名称条件
            if ((TextBoxName.Text.Trim() != "") && (condition != ""))
            {
                condition += " AND " + " MaterialName LIKE '%" + TextBoxName.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxName", TextBoxName.GetType().ToString(), TextBoxName.Text.Trim());
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and MaterialName like '%" + TextBoxName.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }

            //标识号
            if ((TextBoxNO.Text.Trim() != "") && (condition != ""))
            {
                condition += " AND " + " CGMODE LIKE '%" + TextBoxNO.Text.Trim().ToUpper() + "%'";
                addQueryItem(PageName, "TextBoxNO", TextBoxNO.GetType().ToString(), TextBoxNO.Text.Trim());
            }
            //计划跟踪号条件
            if ((TextBoxPTC.Text.Trim() != "") && (condition != ""))
            {
                if (TextBoxPTC.Text.Trim() == "备库")
                {
                    condition += " AND " + " (PTC LIKE '%备库%' or PTC LIKE '%BEIKU%')";
                    addQueryItem(PageName, "TextBoxPTC", TextBoxPTC.GetType().ToString(), TextBoxPTC.Text.Trim());
                }
                else
                {
                    condition += " AND " + " PTC LIKE'%" + TextBoxPTC.Text.Trim() + "%'";
                    addQueryItem(PageName, "TextBoxPTC", TextBoxPTC.GetType().ToString(), TextBoxPTC.Text.Trim());
                }
            }
            //批号条件
            if ((TextBoxLotNumber.Text != "") && (condition != ""))
            {
                condition += " AND " + " PTC LIKE '%" + TextBoxLotNumber.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxLotNumber", TextBoxLotNumber.GetType().ToString(), TextBoxLotNumber.Text.Trim());
            }
            //型号规格条件
            if ((TextBoxStandard.Text != "") && (condition != ""))
            {
                condition += " AND " + " Standard LIKE '%" + TextBoxStandard.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxStandard", TextBoxStandard.GetType().ToString(), TextBoxStandard.Text.Trim());
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and Standard like '%" + TextBoxStandard.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //长度条件
            if ((TextBoxLength.Text != "") && (condition != ""))
            {
                condition += " AND " + " Length LIKE '%" + TextBoxLength.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxLength", TextBoxLength.GetType().ToString(), TextBoxLength.Text.Trim());
            }
            //宽度条件
            if ((TextBoxWidth.Text != "") && (condition != ""))
            {
                condition += " AND " + " Width LIKE '%" + TextBoxWidth.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxWidth", TextBoxWidth.GetType().ToString(), TextBoxWidth.Text.Trim());
            }
            //材质条件
            if ((TextBoxAttribute.Text != "") && (condition != ""))
            {
                condition += " AND " + " Attribute LIKE '%" + TextBoxAttribute.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxAttribute", TextBoxAttribute.GetType().ToString(), TextBoxAttribute.Text.Trim());
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and Attribute like '%" + TextBoxAttribute.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //是否定尺
            if ((TextBoxFixed.Text != "") && (condition != ""))
            {
                condition += " AND " + " Fixed LIKE '%" + TextBoxFixed.Text.Trim().ToUpper() + "%'";
                addQueryItem(PageName, "TextBoxFixed", TextBoxFixed.GetType().ToString(), TextBoxFixed.Text.Trim());
            }
            //备注条件
            if ((TextBoxNote.Text != "") && (condition != ""))
            {
                condition += " AND " + " Note LIKE '%" + TextBoxNote.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxNote", TextBoxNote.GetType().ToString(), TextBoxNote.Text.Trim());
            }

            //订单编号条件
            if ((TextBoxOrderCode.Text != "") && (condition != ""))
            {
                condition += " AND " + " OrderCode LIKE '%" + TextBoxOrderCode.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxOrderCode", TextBoxOrderCode.GetType().ToString(), TextBoxOrderCode.Text.Trim());
            }


            //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            //是否出库(即是否生成入库单)
            if ((DropDownListQROutState.SelectedValue != "") && (condition != ""))
            {
                condition += " AND " + " QROut_State='" + DropDownListQROutState.SelectedValue + "'";
                addQueryItem(PageName, "DropDownListQROutState", DropDownListQROutState.GetType().ToString(), DropDownListQROutState.SelectedValue);

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                QRcondition += " and QROut_State='" + DropDownListQROutState.SelectedValue + "'";
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            if ((DropDownListQROutState.SelectedValue == "") && (condition != ""))
            {
                condition += " AND " + " (QROut_State='0' or QROut_State='1')";
                addQueryItem(PageName, "DropDownListQROutState", DropDownListQROutState.GetType().ToString(), DropDownListQROutState.SelectedValue);
            }
            //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

            //仓库条件
            if ((WarehouseDropDownList.SelectedValue != "0") && (ChildWarehouseDropDownList.SelectedValue != "0"))
            {
                if (condition != "")
                {
                    condition += " AND " + " WarehouseCode='" + ChildWarehouseDropDownList.SelectedValue + "'";
                    addQueryItem(PageName, "WarehouseDropDownList", WarehouseDropDownList.GetType().ToString(), WarehouseDropDownList.SelectedValue);
                    addQueryItem(PageName, "ChildWarehouseDropDownList", ChildWarehouseDropDownList.GetType().ToString(), ChildWarehouseDropDownList.SelectedValue);
                }
                else
                {
                    condition += " WarehouseCode='" + ChildWarehouseDropDownList.SelectedValue + "'";
                    addQueryItem(PageName, "WarehouseDropDownList", WarehouseDropDownList.GetType().ToString(), WarehouseDropDownList.SelectedValue);
                    addQueryItem(PageName, "ChildWarehouseDropDownList", ChildWarehouseDropDownList.GetType().ToString(), ChildWarehouseDropDownList.SelectedValue);
                }
            }
            else if ((WarehouseDropDownList.SelectedValue != "0") && (ChildWarehouseDropDownList.SelectedValue == "0"))
            {
                if (condition != "")
                {
                    condition += " AND " + " WarehouseCode LIKE '" + WarehouseDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "WarehouseDropDownList", WarehouseDropDownList.GetType().ToString(), WarehouseDropDownList.SelectedValue);
                    addQueryItem(PageName, "ChildWarehouseDropDownList", ChildWarehouseDropDownList.GetType().ToString(), ChildWarehouseDropDownList.SelectedValue);
                }
                else
                {
                    condition += " WarehouseCode LIKE '" + WarehouseDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "WarehouseDropDownList", WarehouseDropDownList.GetType().ToString(), WarehouseDropDownList.SelectedValue);
                    addQueryItem(PageName, "ChildWarehouseDropDownList", ChildWarehouseDropDownList.GetType().ToString(), ChildWarehouseDropDownList.SelectedValue);
                }
            }

            //物料条件
            if ((TypeDropDownList.SelectedValue != "0") && (SubTypeDropDownList.SelectedValue != "0"))
            {
                if (condition != "")
                {
                    condition += " AND " + " QROut_MatCode LIKE '" + SubTypeDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "TypeDropDownList", TypeDropDownList.GetType().ToString(), TypeDropDownList.SelectedValue);
                    addQueryItem(PageName, "SubTypeDropDownList", SubTypeDropDownList.GetType().ToString(), SubTypeDropDownList.SelectedValue);
                }
                else
                {
                    condition += " QROut_MatCode LIKE '" + SubTypeDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "TypeDropDownList", TypeDropDownList.GetType().ToString(), TypeDropDownList.SelectedValue);
                    addQueryItem(PageName, "SubTypeDropDownList", SubTypeDropDownList.GetType().ToString(), SubTypeDropDownList.SelectedValue);
                }
            }
            else if ((TypeDropDownList.SelectedValue != "0") && (SubTypeDropDownList.SelectedValue == "0"))
            {
                if (condition != "")
                {
                    condition += " AND " + " QROut_MatCode LIKE '" + TypeDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "TypeDropDownList", TypeDropDownList.GetType().ToString(), TypeDropDownList.SelectedValue);
                    addQueryItem(PageName, "SubTypeDropDownList", SubTypeDropDownList.GetType().ToString(), SubTypeDropDownList.SelectedValue);
                }
                else
                {
                    condition += " QROut_MatCode LIKE '" + TypeDropDownList.SelectedValue + "%'";
                    addQueryItem(PageName, "TypeDropDownList", TypeDropDownList.GetType().ToString(), TypeDropDownList.SelectedValue);
                    addQueryItem(PageName, "SubTypeDropDownList", SubTypeDropDownList.GetType().ToString(), SubTypeDropDownList.SelectedValue);
                }
            }
            if (DropDownListPlanno.SelectedValue == "1")
            {
                condition = condition;
            }
            else
            {
                condition = condition + " or ((PTC is null or PTC='')" + QRcondition + ")";
            }
            return(condition);
        }
Esempio n. 2
0
        private string GetCondition()
        {
            //总表,从表都不等于0
            string condition   = "1=1";
            string QRcondition = "";

            //订单状态
            if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "0"))
            {
                //全部
                condition = " totalstate='1' AND detailstate<>'0' ";

                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "1"))
            {
                condition = " totalstate='1' AND (detailstate='1' or detailstate='3') and detailcstate='0' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "2"))
            {
                condition = " totalstate='1' AND detailstate='2' and detailcstate='0' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "0") && (DropDownListPushState.SelectedValue == "3"))
            {
                condition = " totalstate='1' AND detailstate='1' and detailcstate='1' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }

            else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "0"))
            {
                //订单采购中,明细全部
                condition = " totalstate='1' and totalcstate='0' AND detailstate<>'0' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "1"))
            {
                //订单采购中,明细采购中
                condition = " totalstate='1' and totalcstate='0' AND (detailstate='1' or detailstate='3') and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "2"))
            {
                //订单采购中,明细采购完毕
                condition = " totalstate='1' and totalcstate='0' AND detailstate='2' and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "1") && (DropDownListPushState.SelectedValue == "3"))
            {
                //订单采购中,明细采购手动关闭
                condition = " totalstate='1' and totalcstate='0' AND detailstate='1' and detailcstate='1'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "0"))
            {
                //订单采购完毕,明细全部
                condition = " totalstate='3' and totalcstate='0' AND detailstate<>'0' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "1"))
            {
                //订单采购完毕,明细采购中
                condition = " totalstate='3' and totalcstate='0' AND (detailstate='1' or detailstate='3') and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "2"))
            {
                //订单采购完毕,明细采购完毕
                condition = " totalstate='3' and totalcstate='0' AND detailstate='2' and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "2") && (DropDownListPushState.SelectedValue == "3"))
            {
                //订单采购完毕,明细手动关闭
                condition = " totalstate='3' and totalcstate='0' AND detailstate='1' and detailcstate='1'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "0"))
            {
                //订单手动关闭,明细全部
                condition = " totalstate='1' and totalcstate='1' AND detailstate<>'0' ";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "1"))
            {
                //订单手动关闭,明细采购中
                condition = " totalstate='1' and totalcstate='1' AND (detailstate='1' or detailstate='3') and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "2"))
            {
                //订单手动关闭,明细采购完毕
                condition = " totalstate='1' and totalcstate='1' AND detailstate='2' and detailcstate='0'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            else if ((DropDownListOrderState.SelectedValue == "3") && (DropDownListPushState.SelectedValue == "3"))
            {
                //订单手动关闭,明细手动关闭
                condition = " totalstate='1' and totalcstate='1' AND detailstate='1' and detailcstate='1'";
                addQueryItem(PageName, "DropDownListOrderState", DropDownListOrderState.GetType().ToString(), DropDownListOrderState.SelectedValue);
                addQueryItem(PageName, "DropDownListPushState", DropDownListPushState.GetType().ToString(), DropDownListPushState.SelectedValue);
            }
            //订单号条件
            if (TextBoxOrderCode.Text != "")
            {
                condition += " AND orderno LIKE '%" + TextBoxOrderCode.Text.Trim().PadLeft(8, '0') + "%'";
                addQueryItem(PageName, "TextBoxOrderCode", TextBoxOrderCode.GetType().ToString(), TextBoxOrderCode.Text.Trim());
            }
            //供应商条件
            if ((TextBoxSupplier.Text != "") && (condition != ""))
            {
                condition += " AND " + " suppliernm LIKE '%" + TextBoxSupplier.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxSupplier", TextBoxSupplier.GetType().ToString(), TextBoxSupplier.Text.Trim());
            }
            //部门条件
            if ((TextBoxDep.Text != "") && (condition != ""))
            {
                condition += " AND " + " depnm LIKE'%" + TextBoxDep.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxDep", TextBoxDep.GetType().ToString(), TextBoxDep.Text.Trim());
            }
            //业务员条件
            if ((TextBoxClerk.Text != "") && (condition != ""))
            {
                condition += " AND " + " ywynm LIKE'%" + TextBoxClerk.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxClerk", TextBoxClerk.GetType().ToString(), TextBoxClerk.Text.Trim());
            }
            //下单日期条件
            if ((TextBoxDate.Text != "") && (condition != ""))
            {
                condition += " AND " + " shtime LIKE '%" + TextBoxDate.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxDate", TextBoxDate.GetType().ToString(), TextBoxDate.Text.Trim());
            }
            //交货日期
            if ((TextBoxJhuo.Text != "") && (condition != ""))
            {
                condition += " AND " + " recdate LIKE '%" + TextBoxJhuo.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxJhuo", TextBoxJhuo.GetType().ToString(), TextBoxJhuo.Text.Trim());
            }
            //物料编码条件
            if ((TextBoxCode.Text != "") && (condition != ""))
            {
                condition += " AND " + " marid LIKE '%" + TextBoxCode.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxCode", TextBoxCode.GetType().ToString(), TextBoxCode.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and marid like '%" + TextBoxCode.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //物料名称条件
            if ((TextBoxName.Text != "") && (condition != ""))
            {
                condition += " AND " + " marnm LIKE '%" + TextBoxName.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxName", TextBoxName.GetType().ToString(), TextBoxName.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and marnm like '%" + TextBoxName.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //规格型号条件
            if ((TextBoxStandard.Text != "") && (condition != ""))
            {
                condition += " AND " + " margg LIKE '%" + TextBoxStandard.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxStandard", TextBoxStandard.GetType().ToString(), TextBoxStandard.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and margg like '%" + TextBoxStandard.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //计划跟踪号条件
            if ((TextBoxPTC.Text != "") && (condition != ""))
            {
                condition += " AND patindex('%" + TextBoxPTC.Text.Trim() + "%',ptcode)>0";
                addQueryItem(PageName, "TextBoxPTC", TextBoxPTC.GetType().ToString(), TextBoxPTC.Text.Trim());
            }
            //材质
            if ((TextBoxcaizhi.Text != "") && (condition != ""))
            {
                condition += " AND " + " marcz LIKE '%" + TextBoxcaizhi.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxcaizhi", TextBoxcaizhi.GetType().ToString(), TextBoxcaizhi.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and marcz like '%" + TextBoxcaizhi.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //国标
            if ((TextBoxgb.Text != "") && (condition != ""))
            {
                condition += " AND " + " margb LIKE '%" + TextBoxgb.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxgb", TextBoxgb.GetType().ToString(), TextBoxgb.Text.Trim());

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                if (DropDownListPlanno.SelectedValue != "1")
                {
                    QRcondition += " and margb like '%" + TextBoxgb.Text.Trim() + "%'";
                }
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            //订货数量
            if ((TextBoxDnum.Text != "") && (condition != ""))
            {
                condition += " AND " + " zxnum LIKE '%" + TextBoxDnum.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxDnum", TextBoxDnum.GetType().ToString(), TextBoxDnum.Text.Trim());
            }
            //到货数量
            if ((TextBoxAnum.Text != "") && (condition != ""))
            {
                condition += " AND " + " recgdnum LIKE '%" + TextBoxAnum.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxAnum", TextBoxAnum.GetType().ToString(), TextBoxAnum.Text.Trim());
            }
            //标识号
            if ((TextBoxBSHNUM.Text != "") && (condition != ""))
            {
                condition += " AND " + " PO_TUHAO LIKE '%" + TextBoxBSHNUM.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxBSHNUM", TextBoxBSHNUM.GetType().ToString(), TextBoxBSHNUM.Text.Trim());
            }
            //计划类型
            if ((TextBoxPlanTyple.Text != "") && (condition != ""))
            {
                condition += " AND " + " PO_MASHAPE LIKE '%" + TextBoxPlanTyple.Text.Trim() + "%'";
                addQueryItem(PageName, "TextBoxPlanTyple", TextBoxPlanTyple.GetType().ToString(), TextBoxPlanTyple.Text.Trim());
            }
            //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            //是否入库(即是否生成入库单)
            if ((DropDownListQRInState.SelectedValue != "") && (condition != ""))
            {
                condition += " AND " + " QRIn_State='" + DropDownListQRInState.SelectedValue + "'";
                addQueryItem(PageName, "DropDownListQRInState", DropDownListQRInState.GetType().ToString(), DropDownListQRInState.SelectedValue);

                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                QRcondition += " and QRIn_State='" + DropDownListQRInState.SelectedValue + "'";
                //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            }
            if ((DropDownListQRInState.SelectedValue == "") && (condition != ""))
            {
                condition += " AND " + " (QRIn_State='0' or QRIn_State='1')";
                addQueryItem(PageName, "DropDownListQRInState", DropDownListQRInState.GetType().ToString(), DropDownListQRInState.SelectedValue);
            }
            //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            //质检结果
            if ((DropDownListQCResult.SelectedValue != "all") && (condition != ""))
            {
                if (DropDownListQCResult.SelectedValue.ToString().Trim() == "合格")
                {
                    condition += " AND " + " (RESULT='" + DropDownListQCResult.SelectedValue + "' or RESULT='免检')";
                }
                else
                {
                    condition += " AND " + " RESULT='" + DropDownListQCResult.SelectedValue + "'";
                }
            }
            if (DropDownListPlanno.SelectedValue == "1")
            {
                condition = condition;
            }
            else
            {
                condition = condition + " or ((QRIn_PTC is null or QRIn_PTC='')" + QRcondition + ")";
            }
            return(condition);
        }