Exemple #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if ("" != txtGoodId.Text)
     {
         bll.TStock bll = new Warehousing.bll.TStock();
         gcStock.DataSource = bll.GetStock(txtGoodId.Text).Tables[0];
     }
 }
Exemple #2
0
 private void txtGoodId_EditValueChanged(object sender, EventArgs e)
 {
     bll.TStock   bll = new bll.TStock();
     model.TStock mod = bll.GetModel(txtGoodId.Text);
     if (null != mod)
     {
         txtCode.Text  = mod.code;
         txtName.Text  = mod.name;
         txtPrice.Text = mod.price + "";
         txtSpec.Text  = mod.spec;
         txtUnit.Text  = mod.unit;
     }
     else
     {
         reset();
     }
 }
Exemple #3
0
 public void searchAll()
 {
     bll.TStock bll = new Warehousing.bll.TStock();
     gcStock.DataSource = bll.GetAllList().Tables[0];
 }
Exemple #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if ("" == txtGoodId.Text)
            {
                MessageBox.Show("请填写一料一号");
                return;
            }
            if ("" == txtCode.Text)
            {
                MessageBox.Show("请填写商品编码");
                return;
            }
            if ("" == txtName.Text)
            {
                MessageBox.Show("请填写商品名称");
                return;
            }
            if ("" == txtNumber.Text || 0 == int.Parse(txtNumber.Text))
            {
                MessageBox.Show("请填写入库数量,不能为零");
                return;
            }
            if ("" == txtPrice.Text)
            {
                MessageBox.Show("请填写商品商品价格");
                return;
            }
            if ("" == txtSpec.Text)
            {
                MessageBox.Show("请填写规格型号");
                return;
            }
            if ("" == txtUnit.Text)
            {
                MessageBox.Show("请填写计量单位");
                return;
            }
            model.TStock mod = new model.TStock();
            bll.TStock   bll = new bll.TStock();
            mod.id     = txtGoodId.Text;
            mod.code   = txtCode.Text;
            mod.name   = txtName.Text;
            mod.number = int.Parse(txtNumber.Text);
            mod.price  = decimal.Parse(txtPrice.Text);
            mod.spec   = txtSpec.Text;
            mod.unit   = txtUnit.Text;
            DialogResult dr = MessageBox.Show("确认入库 " + mod.number + mod.unit + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (dr == DialogResult.OK)
            {
                bool isExists = bll.Exists(mod.id);
                bool isSuccess;
                if (isExists)
                {
                    model.TStock dataRow = bll.GetModel(mod.id);
                    mod.number = mod.number + dataRow.number;
                    isSuccess  = bll.Update(mod);
                }
                else
                {
                    isSuccess = bll.Add(mod);
                }
                if (isSuccess)
                {
                    MessageBox.Show("入库成功");
                }
                else
                {
                    MessageBox.Show("入库失败");
                }
                reset();
                txtGoodId.Text = "";
            }
        }
Exemple #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if ("" == txtGoodId.Text)
            {
                MessageBox.Show("请填写一料一号");
                return;
            }
            //if ("" == txtCode.Text)
            //{
            //    MessageBox.Show("请填写商品编码");
            //    return;
            //}
            //if ("" == txtName.Text)
            //{
            //    MessageBox.Show("请填写商品名称");
            //    return;
            //}
            //if ("" == txtNumber.Text)
            //{
            //    MessageBox.Show("请填写出库数量");
            //    return;
            //}
            //if ("" == txtPrice.Text)
            //{
            //    MessageBox.Show("请填写商品商品价格");
            //    return;
            //}
            //if ("" == txtSpec.Text)
            //{
            //    MessageBox.Show("请填写规格型号");
            //    return;
            //}
            //if ("" == txtUnit.Text)
            //{
            //    MessageBox.Show("请填写计量单位");
            //    return;
            //}

            //model.TStock mod = new model.TStock();
            bll.TStock bll = new bll.TStock();
            //mod.id = txtGoodId.Text;
            //mod.code = txtCode.Text;
            //mod.name = txtName.Text;
            //mod.number = int.Parse(txtNumber.Text);
            //mod.price = decimal.Parse(txtPrice.Text);
            //mod.spec = txtSpec.Text;
            //mod.unit = txtUnit.Text;
            bool isExists = bll.Exists(txtGoodId.Text);

            if (isExists)
            {
                if ("" == txtNumber.Text)
                {
                    MessageBox.Show("请填写出库数量");
                    return;
                }
                model.TStock mod = new model.TStock();
                mod.number = int.Parse(txtNumber.Text);
                model.TStock dataRow = bll.GetModel(txtGoodId.Text);
                if (0 < dataRow.number)
                {
                    if (mod.number > dataRow.number)
                    {
                        MessageBox.Show("该商品库存为" + dataRow.number + dataRow.unit + ",无法出库" + mod.number + mod.unit);
                    }
                    else
                    {
                        mod.id    = dataRow.id;
                        mod.code  = dataRow.code;
                        mod.name  = dataRow.name;
                        mod.spec  = dataRow.spec;
                        mod.unit  = dataRow.unit;
                        mod.price = dataRow.price;
                        DialogResult dr = MessageBox.Show("确认出库 " + mod.number + mod.unit + "?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                        if (dr == DialogResult.OK)
                        {
                            mod.number = dataRow.number - mod.number;
                            if (bll.Update(mod))
                            {
                                txtGoodId.Text = "";
                                reset();
                                MessageBox.Show("出库成功");
                            }
                            else
                            {
                                MessageBox.Show("未知原因,出库失败");
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("该商品库存为零,无法完成出库操作");
                }
            }


            else
            {
                MessageBox.Show("未在仓库中查找到该商品,无法完成出库操作");
            }
        }