private void button1_Click(object sender, EventArgs e)
        {
            switch (state)
            {
            case 1:
            {
                dataGridView1.DataSource = DAL.Inventory.QuerybyGoodName(textBox1.Text).Tables[0];
                break;
            }

            case 2:
            {
                if (CplHelper.IsGoodsIdRight(textBox1.Text))
                {
                    dataGridView1.DataSource = DAL.Inventory.QuerybyGoodID(textBox1.Text).Tables[0];
                }
                else
                {
                    MessageBox.Show("商品ID不正确");
                    return;
                }
                break;
            }

            case 3:
            {
                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                {
                    MODEL.Inventory inventory = new MODEL.Inventory();
                    inventory.GoodID   = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    inventory.GoodName = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    inventory.Amount   = System.Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value.ToString());
                    DAL.Inventory.PanDian(inventory);
                }
                MessageBox.Show("盘点成功");
                break;
            }
            }
            ChangeName();
            for (int i = 0; i < 3; i++)
            {
                this.dataGridView1.Columns[i].Width = (dataGridView1.Width - 45) / 3;
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //建立主表
            MODEL.QAmain qamain = new MODEL.QAmain();
            qamain.QAID = textBox1.Text;
            if (comboBox1.Text == "")
            {
                MessageBox.Show("请选择供应商!~");
                return;
            }
            qamain.Supplier = comboBox1.Text;
            qamain.Operator = MODEL.class1.staff.ID;
            qamain.Date     = System.DateTime.Now.ToLongDateString();
            DAL.class1.InputQAmain(qamain);
            //建立从表
            for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
            {
                int curNum = i + 1;
                //MessageBox.Show(dataGridView1.Rows[i].Cells[0].Value.ToString());
                for (int t = 0; t < 5; t++)
                {
                    if (dataGridView1.Rows[i].Cells[t].Value == null)
                    {
                        MessageBox.Show("第" + curNum.ToString() + "行数据不完整!");
                        return;
                    }
                }
                if (CplHelper.IsNull(dataGridView1.Rows[i].Cells[0].Value.ToString()) || CplHelper.IsNull(dataGridView1.Rows[i].Cells[1].Value.ToString()) ||
                    CplHelper.IsNull(dataGridView1.Rows[i].Cells[2].Value.ToString()) ||
                    CplHelper.IsNull(dataGridView1.Rows[i].Cells[4].Value.ToString()))
                {
                    MessageBox.Show("第" + curNum.ToString() + "行数据不完整!");
                    return;
                }
                qadetail.QAID     = textBox1.Text;
                qadetail.GoodID   = dataGridView1.Rows[i].Cells[0].Value.ToString();
                qadetail.GoodName = dataGridView1.Rows[i].Cells[1].Value.ToString();
                qadetail.Unit     = dataGridView1.Rows[i].Cells[2].Value.ToString();
                if (!CplHelper.IsInt(dataGridView1.Rows[i].Cells[3].Value.ToString()))
                {
                    MessageBox.Show("第" + curNum.ToString() + "行商品数量不正确!");
                    return;
                }
                qadetail.Amount = System.Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value.ToString());
                qadetail.Check  = dataGridView1.Rows[i].Cells[4].Value.ToString();

                if (!CplHelper.IsGoodsIdRight(qadetail.GoodID))
                {
                    MessageBox.Show("第" + curNum.ToString() + "行商品ID不正确,格式为B+10位数字!");
                    return;
                }
                DAL.class1.InputQAdetail(qadetail);
            }
            if (dataGridView1.Rows.Count - 1 <= 0)
            {
                MessageBox.Show("无商品信息");
                return;
            }
            MessageBox.Show(qamain.QAID + "号质检单已经生成");
            Communal.mapDiag          = new realTimeShow();
            Communal.mapDiag.goodsNum = 1;

            Communal.mapDiag.Show();
            Communal.mapDiag.qualityAnimate();
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            switch (state)
            {
            case 1:
            {
                if (CplHelper.IsQualityIDRight(textBox1.Text.Trim()))
                {
                    dataGridView1.DataSource = DAL.class1.QuerybyQAID(textBox1.Text).Tables[0];
                }
                else
                {
                    MessageBox.Show("质检信息输入错误");
                    return;
                }
                break;
            }

            case 2:
            {
                if (CplHelper.IsGoodsIdRight(textBox1.Text.Trim()))
                {
                    dataGridView1.DataSource = DAL.class1.QuerybyGoodID(textBox1.Text).Tables[0];
                }
                else
                {
                    MessageBox.Show("商品ID错误");
                    return;
                }
                break;
            }

            case 3:
            {
                dataGridView1.DataSource = DAL.class1.QuerybyGoodName(textBox1.Text).Tables[0];
                break;
            }

            case 4:
            {
                dataGridView1.DataSource = DAL.class1.QuerybySupplier(textBox1.Text).Tables[0];
                break;
            }

            case 5:
            {
                dataGridView1.DataSource = DAL.class1.QuerybyDate(dateTimePicker1.Text).Tables[0];
                break;
            }

            case 6:
            {
                dataGridView1.DataSource = DAL.class1.QuerybyOperator(textBox1.Text).Tables[0];
                break;
            }
            }
            ChangeName();
            for (int i = 0; i < 6; i++)
            {
                this.dataGridView1.Columns[i].Width = (dataGridView1.Width - 30) / 7;
            }
        }