protected void btnReceiveNew_Click(object sender, System.EventArgs e)
        {
            strBeginDate = Request.Form["txtBegin"].ToString();
            DataTable dtDetail = (DataTable)Session["ReceiveDetail"];
            Hashtable htapp    = (Hashtable)Application["appconf"];
            string    strcons  = (string)htapp["cons"];

            StoBusi = new BusiComm.StorageBusi(strcons);
            Hashtable htpara = new Hashtable();

            CMSMStruct.LoginStruct ls1 = (CMSMStruct.LoginStruct)Session["Login"];

            switch (this.txtBillState.Text.Trim())
            {
            case "":
                #region 新领料单录入
                if (dtDetail.Rows.Count == 0)
                {
                    this.SetErrorMsgPageBydirHistory("领用货品为空,请先添加产品!");
                    return;
                }
                string strBillType               = this.ddlBillType.SelectedItem.Text;
                string strReceiveDeptID          = this.ddlReceiveDeptID.SelectedValue;
                string strReceiveDate            = strBeginDate;
                string strSysTime                = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString();
                string strGroup                  = this.ddlGroup.SelectedValue;
                string strClass                  = this.txtClass.Text.Trim();
                string strMaterialInchargeOperID = this.txtMaterialInchargeOperID.Text.Trim();
                string strStorageInchargeOperID  = this.txtStorageInchargeOperID.Text.Trim();
                string strSendOperID             = this.txtSendOperID.Text.Trim();

                if (strReceiveDeptID == "")
                {
                    this.SetErrorMsgPageBydirHistory("领料单位不能为空!");
                    return;
                }

                htpara.Add("strBillType", strBillType);
                htpara.Add("strReceiveDeptID", strReceiveDeptID);
                htpara.Add("strReceiveDate", strReceiveDate);
                htpara.Add("strSysTime", strSysTime);
                htpara.Add("strGroup", strGroup);
                htpara.Add("strClass", strClass);
                htpara.Add("strMaterialInchargeOperID", strMaterialInchargeOperID);
                htpara.Add("strStorageInchargeOperID", strStorageInchargeOperID);
                htpara.Add("strSendOperID", strSendOperID);
                htpara.Add("strOperID", ls1.strOperName);

                try
                {
                    if (StoBusi.NewBillOfReceiveAdd(htpara, dtDetail))
                    {
                        this.SetSuccMsgPageBydir("新领料单录入成功!", "Storage/wfmBillOfReceive.aspx");
                    }
                    else
                    {
                        this.SetErrorMsgPageBydir("新领料单录入时发生错误,请重试!");
                    }
                }
                catch (Exception er)
                {
                    this.clog.WriteLine(er);
                    this.SetErrorMsgPageBydir("查询错误,请重试!");
                }
                #endregion
                break;

            case "0":
                #region 领料单--发货
                htpara.Add("ReceiveID", this.txtReceiveID.Text.Trim());
                htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
                htpara.Add("strOperID", ls1.strOperName);
                try
                {
                    if (StoBusi.UpdateBillOfReceiveOut(htpara, dtDetail))
                    {
                        this.SetSuccMsgPageBydir("填写领料单发货量成功!", "Storage/wfmBillOfReceiveSend.aspx");
                    }
                    else
                    {
                        this.SetErrorMsgPageBydir("填写领料单发货量时发生错误,请重试!");
                    }
                }
                catch (Exception er)
                {
                    this.clog.WriteLine(er);
                    this.SetErrorMsgPageBydir("查询错误,请重试!");
                }
                #endregion
                break;

            case "1":
                #region 领料单--验收入库
                htpara.Add("ReceiveID", this.txtReceiveID.Text.Trim());
                htpara.Add("strReceiveDeptID", this.ddlReceiveDeptID.SelectedValue);
                htpara.Add("strOperDate", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString());
                htpara.Add("strOperID", ls1.strOperName);
                try
                {
                    if (StoBusi.UpdateBillOfReceiveValidEnter(htpara, dtDetail))
                    {
                        this.SetSuccMsgPageBydir("领料单收货成功!", "Storage/wfmBillOfReceive.aspx");
                    }
                    else
                    {
                        this.SetErrorMsgPageBydir("领料单收货时发生错误,请重试!");
                    }
                }
                catch (Exception er)
                {
                    this.clog.WriteLine(er);
                    this.SetErrorMsgPageBydir("查询错误,请重试!");
                }
                #endregion
                break;
            }
        }