Example #1
0
        //清除条件
        private void clearCondition()
        {
            //领料单编号
            TextBoxOrderCode.Text = string.Empty;
            //加工单位
            TextBoxSupplier.Text  = string.Empty;
            TextBoxClerk.Text     = string.Empty;
            TextBoxDate.Text      = string.Empty;
            TextBoxCode.Text      = string.Empty;
            TextBoxName.Text      = string.Empty;
            TextBoxStandard.Text  = string.Empty;
            TextBoxPTC.Text       = string.Empty;
            TextBoxAnum.Text      = string.Empty;
            TextBoxBSHNUM.Text    = string.Empty;
            TextBoxcaizhi.Text    = string.Empty;
            TextBoxJhuo.Text      = string.Empty;
            TextBoxPlanTyple.Text = string.Empty;
            TextBoxDep.Text       = string.Empty;
            TextBoxDnum.Text      = string.Empty;
            TextBoxgb.Text        = string.Empty;

            DropDownListOrderState.ClearSelection();
            DropDownListOrderState.Items[1].Selected = true;

            DropDownListPushState.ClearSelection();
            DropDownListPushState.Items[1].Selected = true;

            DropDownListFatherLogic.ClearSelection();
            DropDownListFatherLogic.Items[0].Selected = true;

            DropDownListQCResult.ClearSelection();
            DropDownListQCResult.Items[0].Selected = true;
        }
Example #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);
        }