private void button1_Click(object sender, EventArgs e)
        {
            if (KindView == 1)
            {
                if (stockOrOrder.Text != "" && KindView == 1) //写入配货员编码
                {
                    dataBase sqlConn = new dataBase();

                    if (selfMotion.Checked == true)   //自动?
                    {
                        #region
                        if (sqlConn.checkId(stockOrOrder.Text.ToString())) //检查是否有配货员id
                        {
                            //变更状态
                            if (sqlConn.WriteOrderState(AlterOrderID, 1) && sqlConn.WriteShoppingId(AlterOrderID, stockOrOrder.Text.ToString()) == 1)
                            {
                                //写入日志
                                Log_Order_info newLog = new Log_Order_info();
                                newLog          = sqlConn.Log_Getinfo(AlterOrderID);
                                newLog.Remark   = "订单管理工具";
                                newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount");
                                newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount"));
                                newLog.Pubtime  = DateTime.Now.ToString();

                                sqlConn.Write_Log(newLog);



                                MessageBox.Show("变更成功");


                                this.DialogResult = DialogResult.OK;
                            }
                            else
                            {
                                MessageBox.Show("变更失败");
                            }
                        }
                        else
                        {
                            MessageBox.Show("没有该配货员");
                        }
                        #endregion
                    }

                    else if (selfMotion.Checked == false)
                    {
                        DialogResult dr = MessageBox.Show("确认您输入的配货员账号?", "提示", MessageBoxButtons.OKCancel);
                        if (dr == DialogResult.OK)
                        {
                            #region
                            if (sqlConn.checkId(stockOrOrder.Text.ToString())) //检查是否有配货员id
                            {
                                //变更状态
                                if (sqlConn.WriteOrderState(AlterOrderID, 1) && sqlConn.WriteShoppingId(AlterOrderID, stockOrOrder.Text.ToString()) == 1)
                                {
                                    //写入日志
                                    Log_Order_info newLog = new Log_Order_info();
                                    newLog          = sqlConn.Log_Getinfo(AlterOrderID);
                                    newLog.Remark   = "订单管理工具";
                                    newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount");
                                    newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount"));
                                    newLog.Pubtime  = DateTime.Now.ToString();

                                    sqlConn.Write_Log(newLog);



                                    MessageBox.Show("变更成功");


                                    this.DialogResult = DialogResult.OK;
                                }
                                else
                                {
                                    MessageBox.Show("变更失败");
                                }
                            }
                            else
                            {
                                MessageBox.Show("没有该配货员");
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    stockOrOrder.Text = "请输入配货员编码";
                }
            }


            if (KindView == 2)
            {
                if (stockOrOrder.Text != "" && KindView == 2) //写入配货员编码
                {
                    dataBase sqlConn = new dataBase();

                    if (selfMotion.Checked == true)   //自动?
                    {
                        #region
                        if (sqlConn.checkOrder(stockOrOrder.Text.ToString())) //检查是否有此订单
                        {
                            //变更状态
                            if (sqlConn.WriteOrderState(stockOrOrder.Text.ToString(), 2) && sqlConn.WriteCheckerCodeId(stockOrOrder.Text.ToString(), adminId) == 1)
                            {
                                printShow(stockOrOrder.Text.ToString());//打印
                                //写入日志
                                Log_Order_info newLog = new Log_Order_info();
                                newLog          = sqlConn.Log_Getinfo(stockOrOrder.Text.ToString());
                                newLog.Remark   = "订单管理工具";
                                newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", adminId, "yl_ManageAccount");
                                newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", adminId, "yl_ManageAccount"));
                                newLog.Pubtime  = DateTime.Now.ToString();

                                sqlConn.Write_Log(newLog);



                                MessageBox.Show("检验成功");


                                this.DialogResult = DialogResult.OK;
                            }
                            else
                            {
                                MessageBox.Show("检验失败");
                            }
                        }
                        else
                        {
                            MessageBox.Show("没有该订单");
                        }
                        #endregion
                    }

                    else if (selfMotion.Checked == false)
                    {
                        DialogResult dr = MessageBox.Show("确认您输入的订单账号?", "提示", MessageBoxButtons.OKCancel);
                        if (dr == DialogResult.OK)
                        {
                            #region
                            if (sqlConn.checkOrder(stockOrOrder.Text.ToString())) //检查是否有此订单
                            {
                                //变更状态
                                if (sqlConn.WriteOrderState(stockOrOrder.Text.ToString(), 2) && sqlConn.WriteCheckerCodeId(stockOrOrder.Text.ToString(), adminId) == 1)
                                {
                                    printShow(stockOrOrder.Text.ToString());//打印
                                    //写入日志
                                    Log_Order_info newLog = new Log_Order_info();
                                    newLog          = sqlConn.Log_Getinfo(stockOrOrder.Text.ToString());
                                    newLog.Remark   = "订单管理工具";
                                    newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", adminId, "yl_ManageAccount");
                                    newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", adminId, "yl_ManageAccount"));
                                    newLog.Pubtime  = DateTime.Now.ToString();

                                    sqlConn.Write_Log(newLog);



                                    MessageBox.Show("检验成功");


                                    this.DialogResult = DialogResult.OK;
                                }
                                else
                                {
                                    MessageBox.Show("检验失败");
                                }
                            }
                            else
                            {
                                MessageBox.Show("没有该订单");
                            }
                            #endregion
                        }
                    }
                }
                else
                {
                    stockOrOrder.Text = "请输入订单编号";
                }
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            if (KindView == 1)
            {
                if (KindView == 1)  //写入配货员编码
                {
                    dataBase sqlConn = new dataBase();



                    #region
                    if (sqlConn.checkId(stockOrOrder.Text.ToString()))     //检查是否有配货员id
                    {
                        if (sqlConn.checkedStokUperCodeOrder(stockOrOrder.Text.ToString()))
                        {
                            MessageBox.Show("此售货员正在备货");
                            return;
                        }
                        //变更状态
                        if (sqlConn.WriteOrderState(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), 1) && sqlConn.WriteShoppingId(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), stockOrOrder.Text.ToString()) == 1)
                        {
                            moban newmoban = new moban();
                            printShow(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString(), 0, newmoban);   //打印

                            //写入日志
                            Log_Order_info newLog = new Log_Order_info();
                            newLog          = sqlConn.Log_Getinfo(dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString());
                            newLog.Remark   = "订单管理工具";
                            newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount");
                            newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", stockOrOrder.Text.ToString(), "yl_ManageAccount"));
                            newLog.Pubtime  = DateTime.Now.ToString();

                            sqlConn.Write_Log(newLog);


                            stockOrOrder.Text = "订单" + dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString() + "已由备货员" + stockOrOrder.Text.ToString() + "开始备货";

                            weifahuoShow();
                        }
                        else
                        {
                            stockOrOrder.Text = "订单" + dataGridView1.Rows[0].Cells["OrderNo"].Value.ToString() + "备货失败";
                        }
                    }
                    else
                    {
                        stockOrOrder.Text = "没有该配货员";
                    }


                    #endregion

                    return;
                }
            }



            if (KindView == 2)
            {
                if (KindView == 2)  //写入配货员编码
                {
                    dataBase sqlConn = new dataBase();



                    #region
                    if (sqlConn.checkOrder(stockOrOrder.Text.ToString()))     //检查是否有此订单
                    {
                        //变更状态
                        if (sqlConn.WriteOrderState(stockOrOrder.Text.ToString(), 2) && sqlConn.WriteCheckerCodeId(stockOrOrder.Text.ToString(), adminId) == 1)
                        {
                            //printShow(stockOrOrder.Text.ToString());//打印
                            //写入日志
                            Log_Order_info newLog = new Log_Order_info();
                            newLog          = sqlConn.Log_Getinfo(stockOrOrder.Text.ToString());
                            newLog.Remark   = "订单管理工具";
                            newLog.Creater  = sqlConn.searchContent("ManageName", "ManageTel", adminId, "yl_ManageAccount");
                            newLog.UserCode = Convert.ToInt32(sqlConn.searchContent("UserCode", "ManageTel", adminId, "yl_ManageAccount"));
                            newLog.Pubtime  = DateTime.Now.ToString();

                            sqlConn.Write_Log(newLog);



                            stockOrOrder.Text = "订单" + stockOrOrder.Text.ToString() + "检验成功";
                            beihuozhongShow();
                        }
                        else
                        {
                            stockOrOrder.Text = "检验失败";
                        }
                    }
                    else
                    {
                        stockOrOrder.Text = "没有该订单";
                    }
                    #endregion
                    return;
                }
            }

            if (KindView == 0)
            {
                searchOrder(stockOrOrder.Text.ToString());
                stockOrOrder.Focus();
                return;
            }
        }