⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 产品出库.cs

📁 湖南岳阳电力部门 电力管理系统 .net C#开发的
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 计量
{
    public partial class 产品出库 : Form
    {
        public 产品出库()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                this.textBox7.Text = (float.Parse(this.textBox5.Text.Trim()) * float.Parse(this.textBox6.Text.Trim())) + "";
            }
            catch (Exception exc)
            {
                MessageBox.Show("输入有误" + exc.Message);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox5.Text == "0")
            {
                MessageBox.Show("请输入产品数量");
                return;
            }
            string a = "", b = "", c = "", d = "", ee = "", f = "", g = "", h = "", i = "", j = "", k = "", l = "", n = "", m = "", o = "出库";
            a = this.textBox1.Text.Trim();
            b = this.comboBox1.Text.Trim();
            c = this.dateTimePicker1.Value.Date.ToString();
            d = this.textBox2.Text.Trim();
            ee = this.textBox3.Text.Trim();
            f = this.textBox4.Text.Trim();
            g = this.textBox5.Text.Trim();
            h = this.textBox6.Text.Trim();
            i = this.textBox7.Text.Trim();
            j = this.textBox8.Text.Trim();
            k = this.textBox9.Text.Trim();
            l = this.textBox10.Text.Trim();
            n = this.textBox11.Text.Trim();
            m = this.comboBox2.Text.Trim();

            try
            {
                this.textBox7.Text = (float.Parse(this.textBox5.Text.Trim()) * float.Parse(this.textBox6.Text.Trim())) + "";
                i = this.textBox7.Text.Trim();
                int ii = this.出入库明细表TableAdapter.Insert(a, b, c, d, ee, f, int.Parse(g), float.Parse(h), float.Parse(i), j, k, l, n, m, o);
                if (ii == 0) MessageBox.Show("出库失败");
                else MessageBox.Show("出库成功");
            }
            catch (Exception exc)
            {
                MessageBox.Show("出库失败" +"-请查看是否没有产品:"+ exc.Message);
            }
            this.Close();
        }

        private void 产品出库_Load(object sender, EventArgs e)
        { 
            // TODO: 这行代码将数据加载到表“sqldatabase_DataDataSet.出入库明细表”中。您可以根据需要移动或移除它。
            this.出入库明细表TableAdapter.Fill(this.sqldatabase_DataDataSet.出入库明细表);
            // TODO: 这行代码将数据加载到表“sqldatabase_DataDataSet.库存类型”中。您可以根据需要移动或移除它。
            this.库存类型TableAdapter.Fill(this.sqldatabase_DataDataSet.库存类型);
            this.comboBox2.SelectedIndex = 1;
            this.textBox1.ReadOnly = true;
            this.textBox4.ReadOnly = true;
            this.textBox7.ReadOnly = true;
            this.textBox8.ReadOnly = true;
            this.textBox9.ReadOnly = true;
            this.textBox10.ReadOnly = true;

            this.textBox1.Text = getid();
        }
        private string getid()
        {
            int idtype = 1;

            try
            {
                DataTable dt = this.出入库明细表TableAdapter.GetData();
                DataRow dr = dt.Rows[0];
                int temp = 0;
                if (dt.Rows.Count != 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dr = dt.Rows[i];
                        temp = int.Parse(dr.ItemArray[0].ToString());
                        if (idtype < temp) idtype = temp;
                    }

                    return "" + (idtype + 1);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
            return "" + idtype;
        } 
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -