/// <summary>
    /// 修改目标的工作台编码
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnChangeGZT_Click(object sender, EventArgs e)
    {
        //修改工作台的操作
        if (string.IsNullOrEmpty(txtPalletNo.Text) || string.IsNullOrEmpty(txtGZT.Text))
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"托盘号或者是工作台必须要填写!\");", true);
            return;
        }
        else
        {
            //首先要提示这个托盘现在所在的工作台是哪一个或者是库区位置
            BArrangeBillBoxBB bb = new BArrangeBillBoxBB();
            DataTable dt = bb.GetList("PalletNo = '" + txtPalletNo.Text.Trim().ToUpper() + "'").Tables[0];
            if(dt.Rows.Count==0)
            {
            this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"系统当中没有此托盘!\");", true);
                return;
            }
            if (txtGZT.Text.Trim().ToUpper() != "X04" && txtGZT.Text.ToUpper() != "X02" && txtGZT.Text.ToUpper() != "X09" && txtGZT.Text.ToUpper() != "X07")
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"只能在X04和X02和X07和X09工作台之间进行修改!\");", true);
                return;
            }
            if (dt.Rows[0]["wareLocatorNo"].ToString() != "X04" && dt.Rows[0]["wareLocatorNo"].ToString() != "X02" && txtGZT.Text.ToUpper() != "X09" && txtGZT.Text.ToUpper() != "X07")
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"托盘只能在X04和X02和X07和X09工作台之间修改!\");", true);
                return;
            }
            if (dt.Rows[0]["wareLocatorNo"].ToString() == txtGZT.Text.Trim().ToUpper())
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"修改后的工作台与原来的工作台是同一个工坐台!\");", true);
                return;
            }
            SCommBB comm = new SCommBB();
            try
            {
                comm.ExecuteSql("Update BarrangeBillBox set wareLocatorNo = '" + txtGZT.Text.Trim().ToUpper() + "' where PalletNo = '" + txtPalletNo.Text.Trim().ToUpper() + "'");

                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"更新工作台成功 托盘 " + txtPalletNo.Text.Trim().ToUpper() + " 更新后的工作台是"+txtGZT.Text.Trim().ToUpper()+"!\");", true);

            }
            catch (Exception ee)
            {

                this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"更新工作台失败 " + ee.Message + "!\");", true);

            }
            finally
            {
                comm.Dispose();
                bb.Dispose();
            }

        }
    }
    public bool JudgeCheckPallet(string strPalletNo, out string strErrorInfo)
    {
        BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB();

        try
        {
            strErrorInfo = "";

            DataTable dt = new DataTable();

            dt = arrangeBillBoxBB.GetList(" isnull(arrangeBillBox.wareNo,'')<>'' and arrangeBillBox.palletNo='"
                + strPalletNo + "'").Tables[0];

            //判断托盘上的所有物料是否已经检测完成
            if (dt.Rows.Count == 0)
            {
                strErrorInfo = "系统中不存在此托盘!";
                return false;
            }

            foreach (DataRow row in dt.Rows)
            {
                //判断当前托盘放置的物料是否全为非标准箱
                if (row["isStandardBox"].ToString() == "1" || row["isStandardBox"].ToString().ToUpper() == "Y")
                {
                    strErrorInfo = "当前托盘放置标准箱物料!";
                    return false;
                }

                //判断是否全部判定合格
                if (Convert.ToBoolean(row["checkResult"]) == false)
                {
                    strErrorInfo = "当前托盘存在未判定或判定不合格产品!";
                    return false;
                }

                //判断当前托盘是否未放到质检区
                if (row["wareType"].ToString() != "01")
                {
                    strErrorInfo = "当前托盘不在质检区!";
                    return false;
                }
            }

            return true;
        }
        finally
        {
            arrangeBillBoxBB.Dispose();
        }
    }
    public bool IsExistsBox(string strBoxNo)
    {
        BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB();

        try
        {
            DataTable dt = new DataTable();

            dt = arrangeBillBoxBB.GetList("boxNo='" + strBoxNo + "'").Tables[0];
            return dt.Rows.Count > 0 ? true : false;
        }
        finally
        {
            arrangeBillBoxBB.Dispose();
        }
    }
    public DataTable GetBoxByWareLocator(string strWareLocatorNo)
    {
        BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB();

        try
        {
            DataTable dt = new DataTable();

            dt = arrangeBillBoxBB.GetList("wareLocatorNo='" + strWareLocatorNo + "'").Tables[0];
            return dt;
        }
        finally
        {
            arrangeBillBoxBB.Dispose();
        }
    }
    public DataTable GetArriveBoxDetail(string strArriveBillNo, string strFinanceBillNo, string strMaterialNo)
    {
        BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB();

        try
        {
            DataTable dt = new DataTable();
            string strWhere = "1=1";

            //到货单号
            if (strArriveBillNo != "")
            {
                strWhere += " and arriveBillNo like '%" + strArriveBillNo + "%'";
            }

            //采购单号
            if (strFinanceBillNo != "")
            {
                strWhere += " and financeBillNo like '%" + strFinanceBillNo + "%'";
            }

            //物料编号
            if (strMaterialNo != "")
            {
                strWhere += " and materialNo like '%" + strMaterialNo + "%'";
            }

            dt = arrangeBillBoxBB.GetList(strWhere).Tables[0];
            return dt;
        }
        finally
        {
            arrangeBillBoxBB.Dispose();
        }
    }