/// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();
        DataSet ds = new DataSet();

        try
        {
            string arriveBillNo = "", FinanceBillNo = "", Material = "", custno = "";
            arriveBillNo = this.tbArriveBillNo.Text.Trim();
            FinanceBillNo = this.tbFinanceBillNo.Text.Trim();
            Material = this.tbMaterial.Text.Trim();
            custno = this.tbCustNO.Text.Trim();
            if (!Checkbox.Checked)
            {
                ds = commBB.Query("exec Proc_GetSapInStockArriveBillListNew '" + arriveBillNo + "','" + FinanceBillNo + "','" + Material + "','" + custno + "'");//查询的是没有同步的
            }
            else
            {
                //[Proc_GetSapInStockArriveBillListNewAreadyInstocked] 这个是获取已经入库的
                ds = commBB.Query("exec Proc_GetSapInStockArriveBillListNewAreadyInstocked '" + arriveBillNo + "','" + FinanceBillNo + "','" + Material + "','" + custno + "'");//查询的是没有同步的
            }

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 绑定库存汇总列表
    /// </summary>
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();

        try
        {
            DataSet ds = new DataSet();

            ds = commBB.Query("exec proc_StockTotalReportNew '" + this.ddlWare.SelectedValue + "','"
                + this.ddlWareLocater.SelectedValue + "','" + this.tbFinanceBillNo.Text.Trim().Replace("'", "''").Trim() + "','"
                + this.tbMaterial.Text.Trim().Replace("'", "''").Trim() + "','" + this.ddlIsOutStocking.SelectedValue + "','" + this.ddlCheckResult.SelectedValue + "'");

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            commBB.Dispose();
        }
    }
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();
        DataSet ds = new DataSet();

        try
        {
            string arriveBillNo = "", FinanceBillNo = "", Material = "", custno = "";
            arriveBillNo = this.tbarrivebillNo.Text.ToString();
            FinanceBillNo = "";
            Material = this.tbMaterial.Text.Trim();

            ds = commBB.Query("exec [Proc_GetSapOtherInStockArriveBillListNew] '" + arriveBillNo + "','" + FinanceBillNo + "','" + Material + "','" + custno + "'");

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            commBB.Dispose();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (Request.Params["functionNo"] != null && Request.Params["functionNo"].Trim() != "")
            {
                this.FunctionNo = Request.Params["functionNo"];
            }
        }

        if (this.SET_SQL.Value != "")
        {
            this.SET_SQL.Value = this.SET_SQL.Value.Substring(0, this.SET_SQL.Value.Length - 1);
            SCommBB commBB = new SCommBB();
            try
            {
                string[] updateSqls = this.SET_SQL.Value.Split(';');
                foreach (string updateSql in updateSqls)
                {
                    commBB.ExecuteSql(updateSql);
                }
            }
            finally
            {
                commBB.Dispose();
            }
            this.SET_SQL.Value = "";
        }

        this.ShowPullInfo(this.FunctionNo);
    }
    /// <summary>
    /// 绑定Grid
    /// </summary>
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();
        DataSet ds = new DataSet();

        try
        {
            //ds = commBB.Query("exec Proc_GetSapOutStockSaleBillList '" + this.tbAbsEntry.Text.Trim().Replace("'", "''")
            //    + "','" + this.tbSaleBillNo.Text.Trim().Replace("'", "''") + "','"
            //    + this.tbMaterial.Text.Trim().Replace("'", "''") + "'");
            string AbsEntry = "";
            string SaleBillNo = this.tbSaleBillNo.Text.Trim();
            string material = this.tbMaterial.Text.Trim();
            string invoiceNo = this.tbinvoiceNo.Text;
            string custNo = this.tbcustNo.Text;
            //ds = commBB.Query("exec [dbo].[Proc_ newGetSapOutStockSaleBillList] '" + this.tbAbsEntry.Text.Trim().Replace("'", "''")
            //    + "','" + this.tbSaleBillNo.Text.Trim().Replace("'", "''") + "','"
            //    + "','" + this.tbMaterial.Text.Trim().Replace("'", "''") + "','"
            //    + this.tbinvoiceNo.Text.Trim().Replace("'", "''") + "'");

            ds = commBB.Query("exec [dbo].[Proc_GetSapOutStockSaleBillListNew] '" + AbsEntry + "','" + SaleBillNo + "','" + material + "','" + invoiceNo + "','"+custNo+"'");
            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            commBB.Dispose();
        }
    }
 /// <summary>
 /// չʾ����
 /// </summary>
 /// <param name="id">��¼Id</param>
 private void ShowInfo(int id)
 {
     SFileBB fileBB = new SFileBB();
     LMessageBB messageBB = new LMessageBB();
     vLMessageData model = new vLMessageData();
     try
     {
         model = messageBB.GetVModel(id);
         this.title.Text = model.title;
         this.content.Text = model.content;
         this.fileId.Text = fileBB.GetDownBatchFileNm(model.fileId);
         this.sort.Text = model.sortNm;
         this.author.Text = model.author;
     }
     finally
     {
         fileBB.Dispose();
         messageBB.Dispose();
     }
     //�����Ѷ��˴�
     SCommBB commBB = new SCommBB();
     try
     {
         string strSql = "select count(distinct empId) from LMessageReaded where messageId=" + id.ToString();
         this.readedEmpCount.Text = commBB.ExecuteScalar(strSql).ToString();
     }
     finally
     {
         commBB.Dispose();
     }
 }
    protected void btnCommit_Click(object sender, EventArgs e)
    {
        //判断上传控件是否为空
        if (this.FileInsertImg.PostedFile.FileName == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请首先选择一个图片文件!\");", true);
            return;
        }
        this.btnCommit.Enabled = false;

        //判断文件格式(0无限制、1图片)
        FileInfo file = new FileInfo(this.FileInsertImg.PostedFile.FileName);
        string extension = file.Extension;
        SCommBB commBB = new SCommBB();
        try
        {
            //查看文件格式是否存在与系统表“图片文件格式”中
            if (commBB.Query("select 1 from SImageFileType where fileExtension='" + extension + "'").Tables[0].Rows.Count == 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"本次附件上传要求为图片格式文件,请重新选择!\");", true);
                this.btnCommit.Enabled = true;
                return;
            }
        }
        finally
        {
            commBB.Dispose();
        }

        string fileId = "";
        string insertImgPath = "";
        if (this.FileId == "")
        {
            //获取文件名称
            string fileNm = DateTime.Now.ToString("yyyyMMddHHmmss");
            Random ro = new Random();
            fileNm += ro.Next(1000, 9999).ToString() + extension;
            //上传文件到指定目录
            this.FileInsertImg.PostedFile.SaveAs(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Images\\UpImg\\" + fileNm);

            string level = "";
            for (int i = 0; i < Convert.ToInt32(DirectLevel); i++)
            {
                level += "../";
            }
            insertImgPath = level + "Images/UpImg/" + fileNm;
        }
        else
        {
            SFileData fileData = this.UpImg(this.FileInsertImg.PostedFile);
            fileId = fileData.fileId.ToString();
            insertImgPath = fileData.preFileNm;
        }

        this.btnCommit.Enabled = true;

        this.ClientScript.RegisterStartupScript(this.GetType(), "returnParent", "returnParent('" + fileId + "','" + insertImgPath + "');", true);
    }
    /// <summary>
    /// ���ͼƬ
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnInsertImg_Click(object sender, EventArgs e)
    {
        //�ж��ϴ��ؼ��Ƿ�Ϊ��
        if (this.FileInsertImg.PostedFile.FileName == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"������ѡ��һ��ͼƬ�ļ�!\");", true);
            return;
        }
        this.btnInsertImg.Enabled = false;

        //�ж��ļ���ʽ��0�����ơ�1ͼƬ��
        FileInfo file = new FileInfo(this.FileInsertImg.PostedFile.FileName);
        string extension = file.Extension;
        SCommBB commBB = new SCommBB();
        try
        {
            //�鿴�ļ���ʽ�Ƿ������ϵͳ���ͼƬ�ļ���ʽ����
            if (commBB.Query("select 1 from SImageFileType where fileExtension='" + extension + "'").Tables[0].Rows.Count == 0)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"���θ����ϴ�Ҫ��ΪͼƬ��ʽ�ļ���������ѡ��!\");", true);
                this.btnInsertImg.Enabled = true;
                return;
            }
        }
        finally
        {
            commBB.Dispose();
        }

        //��ȡ�ļ�����
        string fileNm = DateTime.Now.ToString("yyyyMMddHHmmss");
        Random ro = new Random();
        fileNm += ro.Next(1000, 9999).ToString() + extension;
        //�ϴ��ļ���ָ��Ŀ¼
        this.FileInsertImg.PostedFile.SaveAs(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Images\\UpImg\\" + fileNm);

        //�ж�ͼƬ�ߴ磬�����ʾΪ400/300
        System.Drawing.Image image = System.Drawing.Image.FromFile(System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\\Images\\UpImg\\" + fileNm);

        if (image.Width > 400)
        {
            this.content.Value += "<img alt=\"\" src=\"../../../Images/UpImg/" + fileNm + "\" width=\"400\" height=\"" + 400 * image.Height / image.Width + "\" />";
        }
        else if (image.Height > 300)
        {
            this.content.Value += "<img alt=\"\" src=\"../../../Images/UpImg/" + fileNm + "\" width=\"" + 300 * image.Width / image.Height + "\" height=\"300\" />";
        }
        else
        {
            this.content.Value += "<img alt=\"\" src=\"../../../Images/UpImg/" + fileNm + "\" />";
        }

        this.btnInsertImg.Enabled = true;
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        PRolePermissionsData rolePermissionsData = new PRolePermissionsData();
        SCommBB commBB = new SCommBB();
        PRolePermissionsBB rolePermissionsBB = new PRolePermissionsBB();
        try
        {
            //删除当前角色所有权限
            rolePermissionsBB.DeleteRecordByRole(this.RoleId, 2);

            //保存权限
            string strPermissions = "";
            CheckBox checkBox = new CheckBox();
            foreach (DataListItem item in this.DataList1.Items)
            {
                //获取ItemoNo
                Label label = (Label)item.FindControl("itemNo");
                string itemNo = label.Text;
                if (itemNo.IndexOf('-') >= 0)
                {
                    itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1);
                }

                foreach (System.Web.UI.Control control in item.Controls)
                {
                    if (control.GetType() == checkBox.GetType())
                    {
                        if (((CheckBox)control).Checked == true)
                        {
                            strPermissions += itemNo + "," + ((CheckBox)control).ToolTip + ",0|";
                        }
                    }
                }
            }
            //保存权限
            commBB.ExecuteSql("exec sys_BatchSavePermissions " + this.RoleId.ToString() + ",'" + strPermissions.Remove(strPermissions.Length - 1) + "'");
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            commBB.Dispose();
            rolePermissionsBB.Dispose();
        }

        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('保存成功!');", true);
    }
 private void BindGrid()
 {
     string billNo = this.tbBillNo.Text.ToString();
     string material = this.tbMaterial.Text.ToString();
     string saleBillNo = this.tbsaleBillNo.Text.ToString();
     SCommBB commBB = new SCommBB();
     try
     {
         this.gridSaleBill.DataSource = commBB.Query("exec [dbo].[pro_GetoutSaleDetailShow] '" + material + "','" + billNo + "','" + saleBillNo + "'").Tables[0];
         this.gridSaleBill.DataBind();
     }
     catch { }
     finally
     {
         commBB.Dispose();
     }
 }
    private void BindGrid()
    {
        SCommBB commbb = new SCommBB();
        try
        {
            string material = this.tbMaterial.Text.ToString();
            string arriveBillNo = this.tbBillNo.Text.ToString();
            string financeBillNo = this.tbfinanceBillNo.Text.ToString();

            this.gridSaleBill.DataSource = commbb.Query(" exec [dbo].[pro_GetinSaleDetailShow] '" + material + "','" + arriveBillNo + "','" + financeBillNo + "'").Tables[0];
            this.gridSaleBill.DataBind();
        }
        catch { }
        finally
        {
            commbb.Dispose();
        }
    }
 private void ShowInfo()
 {
     string id = Request.Params["id"];
     string sql = " select  stockUpBillNo,saleBillNo ,materialNo from vCStockUpDetail  where id ='"+id+"'";
     SCommBB commBB = new SCommBB();
     try
     {
         DataTable dt = commBB.Query(sql).Tables[0];
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             this.tbBillNo.Text = dt.Rows[i][0].ToString();
             this.tbsaleBillNo.Text = dt.Rows[i][1].ToString();
             this.tbMaterial.Text = dt.Rows[i][2].ToString();
         }
     }
     catch { }
     finally
     {
         commBB.Dispose();
     }
 }
    /// <summary>
    /// 获取SAP数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnData_Click(object sender, EventArgs e)
    {
        SCommBB commBB = new SCommBB();

        try
        {
            //获取SAP到货单、销售订单
            commBB.ExecuteSql("exec up_SAP_GetNewData");

            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('同步SAP到货\\拣货数据成功!');", true);
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 修改关联的托盘号
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnChangeBox_Click(object sender, EventArgs e)
    {
        if (txtBoxNo.Text.ToString() == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"箱号不能为空!\");", true);
            return;
        }
        if (txtPalletNewNo.Text.ToString()=="")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"托盘号不能为空!\");", true);
            return;
        }
        if (txtBoxNo.Text.ToString().ToUpper().Substring(0, 1) != "X" || txtPalletNewNo.Text.ToString().ToUpper().Substring(0,1)!="T")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"箱号或是托盘号不正确!\");", true);
            return;
        }

        SCommBB comm = new SCommBB();
        try
        {
            comm.ExecuteSql("Update BarrangeBillBox set PalletNo = '" + txtPalletNewNo.Text.Trim().ToUpper() + "' where boxNo = '" + txtBoxNo.Text.Trim().ToUpper() + "'");

            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"更新托盘号成功 箱号 " + txtBoxNo.Text.Trim().ToUpper() + " 更新后的托盘是" + txtPalletNewNo.Text.Trim().ToUpper() + "!\");", true);

        }
        catch (Exception ee)
        {

            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"更新托盘号失败 " + ee.Message + "!\");", true);

        }
        finally
        {
            txtBoxNo.Text = "";
            txtPalletNewNo.Text = "";
            comm.Dispose();

        }
    }
    /// <summary>
    /// 绑定集货区库位使用情况列表
    /// </summary>
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();

        try
        {
            DataSet ds = new DataSet();

            ds = commBB.Query("exec Proc_GetJHQWareInfo '" + this.tbCustNo.Text.Trim().Replace("'", "''") + "'");

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();
        }
        finally
        {
            commBB.Dispose();
        }
    }
    protected void BindGrid()
    {
        SCommBB commBB = new SCommBB();
        try
        {
            string strStartDt = "";
            string strEndDt = "";
            //开始入库日期
            if (!string.IsNullOrEmpty(this.tbStartDt.Text.Trim()))
            {
                strStartDt = this.tbStartDt.Text.Trim().ToUpper();
            }

            //截止入库日期
            if (!string.IsNullOrEmpty(this.tbEndDt.Text.Trim()))
            {
                strEndDt = this.tbEndDt.Text.Trim().ToUpper();
            }

            string material = this.lblmaterialNo.Text.ToString();
            DataSet ds = new DataSet();

            ds = commBB.Query(" exec [dbo].[up_inventory_OutIn_list] '" + material + "','" + strStartDt + "','" + strEndDt + "'");

            this.gridSaleBill.DataSource = ds.Tables[0];
            this.gridSaleBill.DataBind();
            this.Label1.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label4.Text = this.gridSaleBill.PageCount.ToString();
            this.TextBox1.Text = (this.gridSaleBill.PageIndex + 1).ToString();
        }
        catch { }
        finally
        {
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 提交
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnCommit_Click(object sender, EventArgs e)
    {
        bool retChecked = false;
        BBackBillBB backBillBB = new BBackBillBB();

        try
        {
            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
                if (chkId.Checked == true)
                {
                    int id = int.Parse(chkId.ValidationGroup);
                    BBackBillData backBillModel = backBillBB.GetModel(Convert.ToInt32(id));

                    if (backBillModel.instantState != "03")
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条未提交退货单记录!\");", true);
                        return;
                    }
                    else
                    {
                        retChecked = true;
                        backBillModel.commitDt = System.DateTime.Now.ToString();
                        backBillModel.commitEmpId = this.currentUser.empId;
                        backBillModel.instantState = "02";
                        backBillBB.ModifyRecord(backBillModel);
                    }

                    DataTable dtDetail = new DataTable();
                    BBackDetailBB backDetailBB = new BBackDetailBB();
                    //获取退货明细数据源
                    dtDetail = backDetailBB.GetList("backBillNo='" + backBillModel.backBillNo + "'").Tables[0];
                    string commadPallet = "";
                    for (int i = 0; i < dtDetail.Rows.Count; i++)
                    {
                        if (i == dtDetail.Rows.Count - 1)
                        {
                            commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "'";
                        }
                        else
                        {
                            commadPallet += "BoxNO = '" + dtDetail.Rows[i]["BoxNo"].ToString().ToUpper().Trim() + "' or ";
                        }
                    }
                    string command = "select distinct palletNo  from BArrangeBillBox where " + commadPallet;//获取订单下的托盘号码
                    SCommBB bb = new SCommBB();
                    DataTable dt = bb.Query(command).Tables[0];
                    bb.Dispose();
                    //BForkliftTaskBC bforkTaskBC = new BForkliftTaskBC();
                    //for (int j = 0; j < dt.Rows.Count; j++)
                    //{
                    //    bforkTaskBC.SaveForkliftTaskWithTHD(dt.Rows[j][0].ToString(), "YCQ", "N01.01", "30", this.currentUser.empId,backBillModel.backBillNo);
                    //}
                }

            }

        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            backBillBB.Dispose();
        }

        if (retChecked)
        {
            this.BindGrid();
        }
    }
Beispiel #18
0
    protected void btnUp_Click(object sender, EventArgs e)
    {
        this.lblMsg.Text = "";
        this.isUpSucess = false;
        if (this.SingleLimit == "1" && this.selectedFiles.Items.Count > 0)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"本次文件上传只允许选择单个文件!\");", true);
            return;
        }

        int userId = this.currentUser.empId;
        int fileID = 0;
        string preFileNm = "";
        SFileData model = new SFileData();
        SSpaceBC spaceBC = new SSpaceBC();

        try
        {
            //判断文件格式(0无限制、1图片)
            switch (this.FileType)
            {
                case "0":
                    break;
                case "1":
                    FileInfo file = new FileInfo(this.File1.PostedFile.FileName);
                    string extension = file.Extension;
                    //查看文件格式是否存在与系统表“图片文件格式”中
                    SCommBB commBB = new SCommBB();
                    try
                    {
                        if (commBB.Query("select 1 from SImageFileType where fileExtension='" + extension + "'").Tables[0].Rows.Count == 0)
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"本次附件上传要求为图片格式文件,请重新选择!\");", true);
                            return;
                        }
                    }
                    finally
                    {
                        commBB.Dispose();
                    }
                    break;
                default:
                    break;
            }

            fileID = spaceBC.UploadFile(model, this.File1.PostedFile, userId, this.FileType == "1");

            if (fileID != 0)
            {
                preFileNm = model.preFileNm;
            }

            ListItem item = new ListItem();
            item.Text = preFileNm;
            item.Value = fileID.ToString();
            this.selectedFiles.Items.Add(item);

            this.isUpSucess = true;
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",1);", true);
            return;
        }
        finally
        {
            spaceBC.Dispose();
        }
    }
    private void ShowPullInfo(string functionNo)
    {
        StringBuilder vmlStr = new StringBuilder();
        SCommBB commBB = new SCommBB();
        WFunctionStepBB functionStepBB = new WFunctionStepBB();
        DataSet ds = new DataSet();
        try
        {
            //������ù�����������������ͬ�������������������
            int stepLevels = 0;
            int maxStepSeq = 0;
            int stepIntervalX = 0;
            int stepIntervalY = 0;

            ds = commBB.Query("select max(seq) from WFunctionStep where functionNo='" + functionNo + "'");
            if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0][0] != DBNull.Value)
            {
                maxStepSeq = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            }

            ds = commBB.Query("select distinct stepNo from WFunctionStep where functionNo='" + functionNo + "'");
            stepLevels = ds.Tables[0].Rows.Count;

            //����Y��������
            if (stepLevels > 1)
            {
                stepIntervalY = 400 / (stepLevels - 1);
            }

            int roundrectId = 1;
            int currCenterRoundrectId = 0;
            int preCenterRoundrectId = 0;

            //��ʼ��ͼ������
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow row = ds.Tables[0].Rows[i];

                DataSet levelDs = new DataSet();
                levelDs = functionStepBB.GetVList("functionNo='" + functionNo + "' and stepNo=" + row["stepNo"].ToString());

                for (int j = 0; j < levelDs.Tables[0].Rows.Count; j++)
                {
                    DataRow levelRow = levelDs.Tables[0].Rows[j];
                    string stepId = levelRow["id"].ToString();
                    string stepNm = levelRow["stepNm"].ToString();
                    string stepNo = levelRow["stepNo"].ToString();
                    string seq = levelRow["seq"].ToString();
                    string nodeType = "";
                    string fillcolor = "";
                    int coordinateX;
                    int coordinateY;
                    //��ǰ��������������
                    int currLevelSteps = levelDs.Tables[0].Rows.Count;

                    //���㵱ǰ������X������
                    if (currLevelSteps > 1)
                    {
                        stepIntervalX = 400 / (currLevelSteps - 1);
                    }

                    if (roundrectId == 1)
                    {
                        nodeType = "start";
                        fillcolor = "#00EE00";
                    }
                    else if (i == ds.Tables[0].Rows.Count - 1 && j == levelDs.Tables[0].Rows.Count - 1)
                    {
                        nodeType = "end";
                        fillcolor = "#F4A8BD";
                    }
                    else
                    {
                        fillcolor = "#EEEEEE";
                    }

                    //����X����
                    if (Convert.ToInt32(levelRow["coordinateX"]) != 0)
                    {
                        coordinateX = Convert.ToInt32(levelRow["coordinateX"]);
                    }
                    else
                    {
                        if (currLevelSteps > 1)
                        {
                            coordinateX = 30 + stepIntervalX * j;
                        }
                        else
                        {
                            coordinateX = 230;
                        }
                    }

                    //����Y����
                    if (Convert.ToInt32(levelRow["coordinateY"]) != 0)
                    {
                        coordinateY = Convert.ToInt32(levelRow["coordinateY"]);
                    }
                    else
                    {
                        if (stepLevels > 1)
                        {
                            coordinateY = 30 + stepIntervalY * i;
                        }
                        else
                        {
                            coordinateY = 230;
                        }
                    }

                    vmlStr.Append("        <vml:roundrect inset='2pt,2pt,2pt,2pt' id='" + roundrectId.ToString() + "' stepId='" + stepId + "' nodeType='" + nodeType + "'\r\n");
                    vmlStr.Append("            readonly='0' fillcolor='" + fillcolor + "' ondblclick='EditStep(" + stepId + ");' style='left: " + coordinateX.ToString() + ";\r\n");
                    vmlStr.Append("            top: " + coordinateY.ToString() + "; width: 100; position: absolute; height: 50; vertical-align: middle; cursor: hand; text-align: center;\r\n");
                    vmlStr.Append("            z-index: 1' arcsize='4321f' coordsize='21600,21600' title='��'>\r\n");
                    vmlStr.Append("            <vml:shadow on='T' type='single' color='#b3b3b3' offset='3px,3px' />\r\n");
                    vmlStr.Append("            <vml:textbox inset='1pt,2pt,1pt,1pt' onselectstart='return false;'><b>" + stepNo + "-" + seq + "</b><br />" + stepNm + "</vml:textbox>\r\n");
                    vmlStr.Append("        </vml:roundrect>\r\n");
                    vmlStr.Append("\r\n");

                    if (j > 0)
                    {
                        //��ͬ������֮������
                        vmlStr.Append("        <vml:line mfrid='1' title='' source='" + Convert.ToString(roundrectId - 1) + "' object='" + roundrectId.ToString() + "' from='0,0' to='0,0' style='position: absolute;\r\n");
                        vmlStr.Append("            display: none; z-index: 2' arcsize='4321f' coordsize='21600,21600'>\r\n");
                        vmlStr.Append("            <vml:shadow on='T' type='single' color='#b3b3b3' offset='1px,1px' />\r\n");
                        vmlStr.Append("        </vml:line>\r\n");
                        vmlStr.Append("\r\n");
                    }

                    if (j == currLevelSteps / 2)
                    {
                        currCenterRoundrectId = roundrectId;
                    }

                    roundrectId += 1;
                }

                if (i > 0)
                {
                    //����ͬ����֮������
                    vmlStr.Append("        <vml:line mfrid='1' title='' source='" + Convert.ToString(preCenterRoundrectId) + "' object='" + Convert.ToString(currCenterRoundrectId) + "' from='0,0' to='0,0' style='position: absolute;\r\n");
                    vmlStr.Append("            display: none; z-index: 2' arcsize='4321f' coordsize='21600,21600'>\r\n");
                    vmlStr.Append("            <vml:stroke endarrow='block'>\r\n");
                    vmlStr.Append("            </vml:stroke>\r\n");
                    vmlStr.Append("            <vml:shadow on='T' type='single' color='#b3b3b3' offset='1px,1px' />\r\n");
                    vmlStr.Append("        </vml:line>\r\n");
                    vmlStr.Append("\r\n");
                }

                preCenterRoundrectId = currCenterRoundrectId;
            }
        }
        finally
        {
            commBB.Dispose();
            functionStepBB.Dispose();
        }
        this.vmlStr = vmlStr;
    }
    /// <summary>
    /// 展示数据
    /// </summary>
    /// <param name="id">记录Id</param>
    private void ShowInfo(int id)
    {
        BCheckBillBB checkBillBB = new BCheckBillBB();
        SCommBB commBB = new SCommBB();

        try
        {
            vBCheckBillData model = new vBCheckBillData();
            DataSet ds = new DataSet();
            string strSQL = "";

            model = checkBillBB.GetVModel(id);
            this.lbCheckBillNo.Text = model.checkBillNo;
            this.tbArriveBillNo.Text = model.arriveBillNo;
            this.tbFinanceBillNo.Text = model.financeBillNo;
            this.hidMaterialNo.Value = model.materialNo;
            this.tbMaterialDesc.Text = model.materialDesc;
            this.tbCheckMark.Text = model.checkMark;

            //查找到货单明细ID
            strSQL = "select id,num from BArriveDetail where arriveBillNo='" + model.arriveBillNo
                + "' and financeBillNo='" + model.financeBillNo + "' and materialNo='" + model.materialNo + "'";
            ds = commBB.Query(strSQL);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                this.hidArriveDetailID.Value = ds.Tables[0].Rows[0]["id"].ToString();
                this.tbNum.Text = ds.Tables[0].Rows[0]["num"].ToString();
            }

            this.BindMateriel2();//绑定物料对应检测标准明细表
        }
        finally
        {
            checkBillBB.Dispose();
        }
    }
    /// <summary>
    /// 绑定检测明细
    /// </summary>
    /// <param name="NewOrOld">new/old 分别表示 走检验标准结构,走单据结构。如果传空值,请确认DtResult不为空</param>
    protected void BindDetailTable(string strNewOrOld)
    {
        #region 初始化检测明细

        if (this.DtResult == null)//第一次初始化模板,分两种情况。新增和修改。
        {
            SCommBB commBB = new SCommBB();
            try
            {
                string strSQL = "";

                if (strNewOrOld == "new")//以标准为模板,走结构。
                {
                    strSQL = "exec Proc_InitCheckDetailAdd '" + this.hidMaterialNo.Value + "','" + this.hidArriveDetailID.Value + "'";
                }
                else if (strNewOrOld == "old")//以订单内容为主,走结构。一般是修改状态进来的单据。
                {
                    strSQL = "exec Proc_InitCheckDetailModify '" + this.IdValue.ToString() + "'";
                }

                DataSet ds = commBB.Query(strSQL);
                if (ds != null && ds.Tables.Count > 0)
                {
                    this.DtResult = ds.Tables[0];
                    this.DtResult.Columns.Add(new DataColumn("rowId", typeof(string)));
                    this.DtResult.Columns.Add(new DataColumn("isdel", typeof(string)));

                    foreach (DataRow dr in this.DtResult.Rows)
                    {
                        dr["rowId"] = Guid.NewGuid().ToString();
                        dr["isdel"] = "0";
                    }
                }
            }
            catch (Exception ex)
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",4);", true);
                return;
            }
            finally
            {
                commBB.Dispose();
            }
        }

        DataView dv = this.DtResult.DefaultView;
        dv.RowFilter = "isdel=0";
        this.grid.DataSource = dv;
        this.grid.DataBind();

        #endregion 初始化检测明细
    }
    /// <summary>
    /// 保存分配线体
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_GZT_Click(object sender, EventArgs e)
    {
        SCommBB commBB = new SCommBB();

        try
        {
            if (this.ddlWareLocator.SelectedValue == "")
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('请首先选择分配线体!');", true);
                return;
            }

            foreach (GridViewRow gvrow in this.gridStockUpDetail.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");

                if (chkId.Checked == true)
                {
                    string strPalletIndex = this.gridStockUpDetail.DataKeys[gvrow.RowIndex].Values["palletIndex"].ToString();

                    commBB.ExecuteSql("update dbo.CStockUpDetail set GZT='" + this.ddlWareLocator.SelectedValue
                        + "' where stockUpBillNo='" + this.stockUpBillNo.Text.Trim() + "' and palletIndex='" + strPalletIndex + "'");
                }
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 根据树列表绑定DataList
    /// </summary>
    private void BindDataList()
    {
        STreeBB treeBB = new STreeBB();
        SCommBB commBB = new SCommBB();
        DataSet ds = new DataSet();

        try
        {
            //除了超级管理员,其他用户只能在自己的权限列表范围之内进行分配
            if (this.IsHaveRole(1))
            {
                ds = treeBB.GetList("");
            }
            else
            {
                ds = commBB.Query("select distinct nodeId,itemNo,nodeNm,orderId,parentId from vSTree where empId="
                    + this.currentUser.empId.ToString() + " order by itemNo");
            }
            DataTable dt = treeBB.ConvertTreeList(ds.Tables[0]);
            this.DataList1.DataSource = dt;
            this.DataList1.DataKeyField = "nodeId";
            this.DataList1.DataBind();
        }
        finally
        {
            treeBB.Dispose();
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 保存判断结果
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSaveRet_click(object sender, EventArgs e)
    {
        BCheckBillBB checkBillBB = new BCheckBillBB();
        SCommBB commBB = new SCommBB();

        try
        {
            HS.Model.BCheckBillData data = checkBillBB.GetModel(Convert.ToInt32(this.IdValue));

            if (data.instantState == "04")
            {
                data.instantState = this.rdopass.Checked ? "05" : "06";//05 合格  06不合格
                data.checkMark = this.txtMark.Text;
                data.checkDt = DateTime.Now.ToString();
                data.checkEmpId = this.currentUser.empId;
                data.checkResult = this.rdopass.Checked ? "合格" : "不合格";

                if (checkBillBB.ModifyRecord(data))
                {
                    bool checkResult = rdopass.Checked ? true : false;

                    //更改所有箱的判定结果
                    commBB.ExecuteSql("update dbo.BArrangeBillBox set checkResult='" + checkResult
                        + "',checkResultDt='" + System.DateTime.Now.ToString() + "',checkResultEmpId='" + this.currentUser.empId
                        + "' where arriveBillNo='" + Request.QueryString["ano"] + "' and financeBillNo='" + Request.QueryString["fno"]
                        + "' and materialNo='" + Request.QueryString["mno"] + "'");

                    this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"检测单判定录入成功!\");location.replace('BCheckBillListResult.aspx?itemNo=0402&pTypeNo=main');", true);
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"检测单判定录入失败!\");", true);
                }
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前检测单已经判定完成!\");", true);
            }

        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            checkBillBB.Dispose();
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 根据当前人员绑定DataList
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        PEmpPermissionsBB empPermissionsBB = new PEmpPermissionsBB();
        STreeFunctionBB treeFunctionBB = new STreeFunctionBB();
        HEemployeeBB eemployeeBB = new HEemployeeBB();
        SCommBB commBB = new SCommBB();
        DataSet perDs = new DataSet();
        DataSet ds = new DataSet();
        try
        {
            HtmlInputHidden hid = (HtmlInputHidden)e.Item.FindControl("nodeId");
            string nodeId = hid.Value;

            Label label = (Label)e.Item.FindControl("itemNo");
            string itemNo = label.Text;
            if (itemNo.IndexOf('-') >= 0)
            {
                itemNo = itemNo.Substring(itemNo.LastIndexOf('-') + 1);
            }

            //除了超级管理员,其他用户只能在自己的权限列表范围之内进行分配
            if (this.IsHaveRole(1))
            {
                ds = treeFunctionBB.GetList("nodeId=" + nodeId);
            }
            else
            {
                ds = commBB.Query("select distinct permissionsTypeId,permissionsTypeNo as functionNo,permissionsTypeNm as functionNm from vSTree where empId="
                    + this.currentUser.empId.ToString() + " and nodeId=" + nodeId + " order by permissionsTypeId");
            }

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow row = ds.Tables[0].Rows[i];

                //添加文本“<TD></TD>"以控制格式
                HtmlGenericControl td = new HtmlGenericControl();
                td.InnerHtml = "</td><td>";
                e.Item.Controls.Add(td);

                CheckBox checkBox = new CheckBox();
                checkBox.ID = "checkBox" + i.ToString();
                checkBox.Text = row["functionNm"].ToString();
                checkBox.ToolTip = row["functionNo"].ToString();

                //给checkBox赋值
                if (eemployeeBB.HasPermissions(this.EmpId, itemNo, row["functionNo"].ToString()))
                {
                    checkBox.Checked = true;
                }
                e.Item.Controls.Add(checkBox);
            }
        }
        finally
        {
            empPermissionsBB.Dispose();
            treeFunctionBB.Dispose();
            eemployeeBB.Dispose();
            commBB.Dispose();
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow gvrow in this.grid.Rows)
        {
              CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");
              if (chkId.Checked == true)
              {

                  //string str = "update BArriveBill  set instantState='06' where id ='" + this.grid.DataKeys[gvrow.RowIndex]["chkId"].ToString() + "'";

                 // this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + this.grid.DataKeys[gvrow.RowIndex]["id"].ToString() + "\");", true);

                  string str = "update BArriveBill  set instantState='06' where id ='" + this.grid.DataKeys[gvrow.RowIndex]["id"].ToString() + "'";

                  SCommBB commBB = new SCommBB();
                  commBB.ExecuteSql(str);

              }

        }
        this.BindGrid();
    }
    /// <summary>
    /// 取消检测判定
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnUnSubmit_Click(object sender, EventArgs e)
    {
        SCommBB commBB = new SCommBB();
        BCheckBillBB checkBillBB = new BCheckBillBB();

        try
        {
            bool isChecked = false;

            foreach (GridViewRow gvrow in this.grid.Rows)
            {
                CheckBox chkId = (CheckBox)gvrow.FindControl("chkId");

                if (chkId.Checked == true)
                {
                    string strArriveBillNo = "", strFinanceBillNo = "", strMaterialNo = "";

                    strArriveBillNo = this.grid.DataKeys[gvrow.RowIndex]["arriveBillNo"].ToString();
                    strFinanceBillNo = this.grid.DataKeys[gvrow.RowIndex]["financeBillNo"].ToString();
                    strMaterialNo = this.grid.DataKeys[gvrow.RowIndex]["materialNo"].ToString();

                    //更改检测单
                    BCheckBillData checkBillModel = checkBillBB.GetModel(Convert.ToInt32(chkId.ValidationGroup));

                    if (checkBillModel.instantState != "05" && checkBillModel.instantState != "06")
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前检测单未检测判定!\");", true);
                        return;
                    }

                    isChecked = true;

                    commBB.ExecuteSql("update dbo.BCheckBill set checkResult=null,checkEmpId=0,checkDt=null,instantState='04' where id=" + chkId.ValidationGroup);

                    //更改箱检测结果
                    commBB.ExecuteSql("update dbo.BArrangeBillBox set checkResult=0,checkResultDt=null,checkResultEmpId=0 where arriveBillNo='"
                        + strArriveBillNo + "' and financeBillNo='" + strFinanceBillNo + "' and materialNo='" + strMaterialNo + "'");
                }
            }

            if (isChecked)
            {
                this.BindGrid();
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一条记录!\");", true);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            commBB.Dispose();
            checkBillBB.Dispose();
        }
    }
    /// <summary>
    /// 绑定库存明细列表,2014-12-03 王工原有的程序使用的 变为old
    /// </summary>
    protected void BindGridold()
    {
        UStockBB stockBB = new UStockBB();
        SCommBB commBB = new SCommBB();
        try
        {
            DataSet ds = new DataSet();

            ds = stockBB.UStockDeatilReport(this.ddlWare.SelectedValue, this.ddlWareLocater.SelectedValue,
                this.tbFinanceBillNo.Text.Trim().Replace("'", "''").Trim(),
                this.tbMaterial.Text.Trim().Replace("'", "''").Trim(), this.tbBoxNo.Text.Trim().Replace("'", "''").ToUpper(),
                this.tbPalletNo.Text.Trim().Replace("'", "''").ToUpper(), this.ddlIsOutStocking.SelectedValue, this.ddlCheckResult.SelectedValue);

            this.grid.DataSource = ds.Tables[0];
            this.grid.DataBind();

            //赋值记录条数、页面总数
            this.Label3.Text = ds.Tables[0].Rows.Count.ToString();
            this.Label2.Text = this.grid.PageCount.ToString();
            this.currPage.Text = (this.grid.PageIndex + 1).ToString();

        }
        finally
        {
            stockBB.Dispose();
            commBB.Dispose();
        }
    }
    /// <summary>
    /// 手工保存拣货计划
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSaveDetail_Click(object sender, EventArgs e)
    {
        LWareLocatorBB wareLocatorBB = new LWareLocatorBB();
        LMaterialBB materialBB = new LMaterialBB();
        UStockBB stockBB = new UStockBB();
        SCommBB commBB = new SCommBB();
        CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB();
        LMaterialRelationBB materialRelationBB = new LMaterialRelationBB();

        try
        {
            #region 验证数据是否填写完整

            string strErrorInfo = "", strWareNo = "", strWareNm = "", strWareLocatorNm = "", strMaterialDesc = "",
                strWhere = "";
            //strStockUpMaterialNo = "", strPalletIndex = ""
            DataTable dtWareLocator = new DataTable();
            DataTable dtMaterial = new DataTable();
            DataTable dtStock = new DataTable();
            DataTable dtStockUpDetail = new DataTable();
            DataRow[] myDataRowArray = null;
            bool isRightMaterial = false;
            int planNum = 0, factNum = 0;

            #region 校验填写库位

            if (this.txtWareLocarorNo.Value.Trim() == "")
            {
                strErrorInfo = "请首先填写库位!";
                this.txtWareLocarorNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            dtWareLocator = wareLocatorBB.GetVList("wareLocatorNo='" + this.txtWareLocarorNo.Value.Trim() + "'").Tables[0];
            if (dtWareLocator.Rows.Count == 0)
            {
                strErrorInfo = "请首先填写正确库位!";
                this.txtWareLocarorNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            strWareNo = dtWareLocator.Rows[0]["wareNo"].ToString();//库区编码
            strWareNm = dtWareLocator.Rows[0]["wareNm"].ToString();//库区名称
            strWareLocatorNm = dtWareLocator.Rows[0]["wareLocatorNm"].ToString();//库位名称

            if (strWareNo != "GLHJ01" && strWareNo != "GLHJ02" && this.txtPalletNo.Value.Trim() == "")
            {
                strErrorInfo = "请首先填写托盘号!";
                this.txtPalletNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            #endregion 校验填写库位

            #region 校验填写物料

            if (this.txtMaterialNo.Value.Trim() == "")
            {
                strErrorInfo = "请首先填写物料编号!";
                this.txtMaterialNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            dtMaterial = materialBB.GetVList("materialNo='" + this.txtMaterialNo.Value.Trim() + "'").Tables[0];
            if (dtMaterial.Rows.Count == 0)
            {
                strErrorInfo = "请首先填写正确物料!";
                this.txtMaterialNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            strMaterialDesc = dtMaterial.Rows[0]["materialNm_CH"].ToString();//物料描述
            //strStockUpMaterialNo = this.txtMaterialNo.Value.Trim().ToUpper();//计划备货物料

            #endregion 校验填写物料

            #region 校验填写数量

            if (this.tbNum.Text.Trim() == "")
            {
                strErrorInfo = "请首先填写数量!";
                this.tbNum.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            if (!CommFunction.IsInt(this.tbNum.Text.Trim()))
            {
                strErrorInfo = "数量格式错误!";
                this.tbNum.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            if (Convert.ToInt32(this.tbNum.Text.Trim()) <= 0)
            {
                strErrorInfo = "数量必须大于0!";
                this.tbNum.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            //校验拣货数量是否超出计划备货数量
            strWhere = "stockUpBillNo='" + this.stockUpBillNo.Text.Trim() + "' and palletIndex='" + this.PalletIndex
                + "' and materialNo='" + this.StockUpMaterialNo + "'";

            if (this.txtFinanceBillNo.Value.Trim() != "")
            {
                strWhere += " and financeBillNo='" + this.txtFinanceBillNo.Value.Trim() + "'";
            }

            if (this.SaleBillNo != "" && this.SaleBillNo != "0")
            {
                strWhere += " and saleBillNo='" + this.SaleBillNo + "'";
            }

            if (this.LineNum != "" && this.LineNum != "0")
            {
                strWhere += " and lineNum='" + this.LineNum + "'";
            }

            if (this.AbsEntry != "" && this.AbsEntry != "0")
            {
                strWhere += " and absEntry='" + this.AbsEntry + "'";
            }

            dtStockUpDetail = stockUpDetailBB.GetList(strWhere).Tables[0];
            foreach (DataRow row in dtStockUpDetail.Rows)
            {
                planNum += Convert.ToInt32(dtStockUpDetail.Rows[0]["num"]);//计算计划备货数量
            }

            //计算实际备货数量
            strWhere = "isDel=0 and stockUpBillNo='" + this.stockUpBillNo.Text.Trim() + "' and palletIndex='" + this.PalletIndex
                + "' and stockUpMaterialNo='" + this.StockUpMaterialNo + "'";

            if (this.txtFinanceBillNo.Value.Trim() != "")
            {
                strWhere += " and financeBillNo='" + this.txtFinanceBillNo.Value.Trim() + "'";
            }

            if (this.SaleBillNo != "" && this.SaleBillNo != "0")
            {
                strWhere += " and saleBillNo='" + this.SaleBillNo + "'";
            }

            if (this.LineNum != "" && this.LineNum != "0")
            {
                strWhere += " and lineNum='" + this.LineNum + "'";
            }

            if (this.AbsEntry != "" && this.AbsEntry != "0")
            {
                strWhere += " and absEntry='" + this.AbsEntry + "'";
            }

            myDataRowArray = this.DtResult.Select(strWhere);
            foreach (DataRow row in myDataRowArray)
            {
                factNum += Convert.ToInt32(row["num"]);
            }

            if (factNum + Convert.ToInt32(this.tbNum.Text.Trim()) > planNum)
            {
                if (this.SaleBillNo != "" && this.SaleBillNo != "0")
                {
                    strErrorInfo = "托盘【" + this.PalletIndex + "】的提货单【" + this.AbsEntry
                        + "】销售订单【" + this.SaleBillNo + "】行号【" + this.LineNum + "】物料【" + this.StockUpMaterialNo + "】计划备货【"
                        + planNum.ToString() + "】,已经备货【" + factNum + "】,填写数量超出还需要备货数量!";
                }
                else
                {
                    strErrorInfo = "托盘【" + this.PalletIndex + "】的物料【" + this.StockUpMaterialNo + "】计划备货【"
                        + planNum.ToString() + "】,已经备货【" + factNum + "】,填写数量超出还需要备货数量!";
                }

                this.tbNum.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            #endregion 校验填写数量

            #region 判断是否重复拣货

            strWhere = "isDel=0 and palletIndex='" + this.PalletIndex + "' and wareLocatorNo='" + this.txtWareLocarorNo.Value.Trim()
                + "' and materialNo='" + this.txtMaterialNo.Value.Trim() + "'";

            if (this.txtFinanceBillNo.Value.Trim() != "")
            {
                strWhere += " and financeBillNo='" + this.txtFinanceBillNo.Value.Trim() + "'";
            }

            if (this.SaleBillNo != "" && this.SaleBillNo != "0")
            {
                strWhere += " and saleBillNo='" + this.SaleBillNo + "'";
            }

            if (this.LineNum != "" && this.LineNum != "0")
            {
                strWhere += " and lineNum='" + this.LineNum + "'";
            }

            if (this.AbsEntry != "" && this.AbsEntry != "0")
            {
                strWhere += " and absEntry='" + this.AbsEntry + "'";
            }

            myDataRowArray = this.DtResult.Select(strWhere);
            if (myDataRowArray.Length > 0)
            {
                if (this.txtFinanceBillNo.Value.Trim() == "")
                {
                    if (this.SaleBillNo != "" && this.SaleBillNo != "0")
                    {
                        strErrorInfo = "托盘【" + this.PalletIndex + "】的提货单【" + this.AbsEntry
                            + "】销售订单【" + this.SaleBillNo + "】行号【" + this.LineNum + "】已经从库位【" + this.txtWareLocarorNo.Value.Trim() + "】中拣出物料【"
                            + this.txtMaterialNo.Value.Trim() + "】,请首先删除原有记录,再添加新记录!";
                    }
                    else
                    {
                        strErrorInfo = "托盘【" + this.PalletIndex + "】已经从库位【" + this.txtWareLocarorNo.Value.Trim() + "】中拣出物料【"
                            + this.txtMaterialNo.Value.Trim() + "】,请首先删除原有记录,再添加新记录!";
                    }
                }
                else
                {
                    if (this.SaleBillNo != "" && this.SaleBillNo != "0")
                    {
                        strErrorInfo = "托盘【" + this.PalletIndex + "】的提货单【" + this.AbsEntry
                            + "】销售订单【" + this.SaleBillNo + "】行号【" + this.LineNum + "】已经从库位【" + this.txtWareLocarorNo.Value.Trim() + "】中拣出采购合同【"
                            + this.txtFinanceBillNo.Value.Trim() + "】的物料【"
                            + this.txtMaterialNo.Value.Trim() + "】,请首先删除原有记录,再添加新记录!";
                    }
                    else
                    {
                        strErrorInfo = "托盘【" + this.PalletIndex + "】已经从库位【" + this.txtWareLocarorNo.Value.Trim() + "】中拣出采购合同【"
                            + this.txtFinanceBillNo.Value.Trim() + "】的物料【"
                            + this.txtMaterialNo.Value.Trim() + "】,请首先删除原有记录,再添加新记录!";
                    }
                }

                this.txtMaterialNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            #endregion 判断是否重复拣货

            #region 根据库位、物料、采购合同号,判断是否有货

            strWhere = "wareLocatorNo='" + this.txtWareLocarorNo.Value.Trim() + "' and materialNo='" + this.txtMaterialNo.Value.Trim() + "'";

            if (this.txtFinanceBillNo.Value.Trim() != "")
            {
                strWhere += " and financeBillNo='" + this.txtFinanceBillNo.Value.Trim() + "'";
            }

            dtStock = stockBB.GetVList(strWhere).Tables[0];
            if (dtStock.Rows.Count == 0)
            {
                if (this.txtFinanceBillNo.Value.Trim() == "")
                {
                    strErrorInfo = "库位【" + this.txtWareLocarorNo.Value.Trim() + "】中不存在物料【" + this.txtMaterialNo.Value.Trim() + "】!";
                }
                else
                {
                    strErrorInfo = "库位【" + this.txtWareLocarorNo.Value.Trim() + "】中不存在采购合同【"
                        + this.txtFinanceBillNo.Value.Trim() + "】的物料【" + this.txtMaterialNo.Value.Trim() + "】!";
                }

                this.txtMaterialNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            #endregion 根据库位、物料、采购合同号,判断是否有货

            #region 校验物料是否是需要拣出的物料

            if (this.StockUpMaterialNo == this.txtMaterialNo.Value.Trim())
            {
                isRightMaterial = true;
            }
            else
            {
                DataTable dtConvertMaterial = new DataTable();

                dtConvertMaterial = materialRelationBB.GetList("newMaterialNo='" + this.txtMaterialNo.Value.Trim() + "'").Tables[0];
                if (dtConvertMaterial.Rows.Count > 0)
                {
                    foreach (DataRow row in dtConvertMaterial.Rows)
                    {
                        if (this.StockUpMaterialNo == row["oldMaterialNo"].ToString())
                        {
                            isRightMaterial = true;
                            break;
                        }
                    }
                }
            }

            if (isRightMaterial == false)
            {
                strErrorInfo = "当前物料不在备货计划内!";

                this.txtMaterialNo.Focus();
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showFloatDetail();alert('" + strErrorInfo + "');", true);
                return;
            }

            #endregion 校验物料是否是需要拣出的物料

            #endregion 验证数据是否填写完整

            DataRow myDataRow = this.DtResult.NewRow();

            myDataRow["rowId"] = Guid.NewGuid().ToString();
            myDataRow["id"] = 0;
            myDataRow["num"] = this.tbNum.Text.Trim();
            myDataRow["stockUpBillNo"] = "";
            myDataRow["palletIndex"] = this.PalletIndex;//托盘序号
            myDataRow["wareNo"] = strWareNo;
            myDataRow["wareLocatorNo"] = this.txtWareLocarorNo.Value.Trim().ToUpper();
            myDataRow["palletNo"] = this.txtPalletNo.Value.Trim();
            myDataRow["stockUpMaterialNo"] = this.StockUpMaterialNo;//计划备货物料
            myDataRow["materialNo"] = this.txtMaterialNo.Value.Trim();//实际拣货物料
            myDataRow["wareNm"] = strWareNm;
            myDataRow["wareLocatorNm"] = strWareLocatorNm;
            myDataRow["materialDesc"] = strMaterialDesc;
            myDataRow["instantState"] = "01";
            myDataRow["financeBillNo"] = this.txtFinanceBillNo.Value.Trim().ToUpper();//采购合同号
            myDataRow["financeBillSort"] = this.txtFinanceBillNo.Value.Trim() == "" ? "备货" : "按单";//采购合同类型
            myDataRow["saleBillNo"] = this.SaleBillNo;//销售订单号
            myDataRow["docEntry"] = this.DocEntry;//销售订单ID
            myDataRow["lineNum"] = this.LineNum;//销售订单行号
            myDataRow["absEntry"] = this.AbsEntry;//提货单号
            myDataRow["isDel"] = false;

            this.DtResult.Rows.Add(myDataRow);

            this.BindGridPickOutPlan();//绑定拣货明细列表
        }
        finally
        {
            wareLocatorBB.Dispose();
            materialBB.Dispose();
            stockBB.Dispose();
            commBB.Dispose();
            stockUpDetailBB.Dispose();
            materialRelationBB.Dispose();
        }
    }
    private SFileData UpImg(HttpPostedFile postedFile)
    {
        //判断上传控件是否为空
        if (postedFile.FileName == "")
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请首先选择一个图片文件!\");", true);
            return null;
        }
        SFileData model = new SFileData();
        SSpaceBC spaceBC = new SSpaceBC();
        try
        {
            //判断文件格式(0无限制、1图片)
            FileInfo file = new FileInfo(postedFile.FileName);
            string extension = file.Extension;
            SCommBB commBB = new SCommBB();
            try
            {
                //查看文件格式是否存在与系统表“图片文件格式”中
                if (commBB.Query("select 1 from SImageFileType where fileExtension='" + extension + "'").Tables[0].Rows.Count == 0)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"本次附件上传要求为图片格式文件,请重新选择!\");", true);
                    return null;
                }
            }
            finally
            {
                commBB.Dispose();
            }

            int fileId = spaceBC.UploadFile(model, postedFile, "upFile", this.currentUser.empId, false);
            model.fileId = fileId;

            return model;
        }
        finally
        {
            spaceBC.Dispose();
        }
    }