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

📄 sms_upgoods.cs

📁 库存管理系统,对企业仓库的产品进行管理,使用C#语句 .net 平台开发
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace FORU_SMS_
{
    public partial class SMS_UpGoods : Form
    {
        public string ID;
        BaseClass.DataConn Dconn = new FORU_SMS_.BaseClass.DataConn();
        BaseClass.DataClass Dclass = new FORU_SMS_.BaseClass.DataClass();
        BaseClass.AddGoods AGoods = new FORU_SMS_.BaseClass.AddGoods();
        BaseClass.UpData Udata = new FORU_SMS_.BaseClass.UpData();
        public SMS_UpGoods(string a)
        {
            InitializeComponent();
            ID = a;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void SMS_UpGoods_Load(object sender, EventArgs e)
        {
            this.txtISGID.Text = ID;
            Dclass.BindComboBox("select StoreName from SMS_Store", "SMS_Store", "StoreName", cboxSName);
            Dclass.BindComboBox("select SupName from SMS_Sup", "SMS_Sup", "SupName", cboxPName);
            SqlCommand sqlcom = new SqlCommand("select * from v_Goods where 货物编号='" + this.txtISGID.Text + "'", Dconn.OpenConn());
            SqlDataAdapter adpter = new SqlDataAdapter();
            DataSet ds = new DataSet();
            adpter.SelectCommand = sqlcom;
            adpter.Fill(ds);
            this.txtISGName.Text = ds.Tables[0].Rows[0][1].ToString();
            this.txtGSpec.Text = ds.Tables[0].Rows[0][4].ToString();
            this.txtISGNum.Text = ds.Tables[0].Rows[0][6].ToString();
            this.txtGIPrice.Text = ds.Tables[0].Rows[0][7].ToString();
            this.txtGSPrice.Text = ds.Tables[0].Rows[0][8].ToString();
            this.txtHPeople.Text = ds.Tables[0].Rows[0][10].ToString();
            this.txtISRemark.Text = ds.Tables[0].Rows[0][11].ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.txtISGName.Text == "")
            {
                MessageBox.Show("货物名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtISGName.Focus();
            }
            else if (this.cboxSName.Text == "")
            {
                MessageBox.Show("仓库名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.cboxPName.Text == "")
            {
                MessageBox.Show("供应商名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.txtGSpec.Text == "")
            {
                MessageBox.Show("货物规格不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.cboxGUnit.Text == "")
            {
                MessageBox.Show("计量单位不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.txtISGNum.Text == "")
            {
                MessageBox.Show("入库数量不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.txtGIPrice.Text == "")
            {
                MessageBox.Show("货物单价不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (this.txtHPeople.Text == "")
            {
                MessageBox.Show("经手人不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                AGoods._GoodsID = this.txtISGID.Text.ToString();
                AGoods._GoodsName = this.txtISGName.Text.ToString();
                AGoods._SupName = this.cboxSName.Text.ToString();
                AGoods._SpecName = this.txtGSpec.Text.ToString();
                AGoods._UnitName = this.cboxGUnit.Text.ToString();
                AGoods._StoreName = this.cboxPName.Text.ToString();
                AGoods._GoodsNum = int.Parse(this.txtISGNum.Text.Trim());
                AGoods._GoodsPrice = double.Parse(this.txtGIPrice.Text);
                AGoods._GoodsAPrice = double.Parse(this.txtGSPrice.Text);
                AGoods._GoodsPeople = this.txtHPeople.Text.ToString();
                AGoods._GoodsRemarks = this.txtISRemark.Text.ToString();
                Udata.updata(AGoods);
                MessageBox.Show("保存成功");
            }
        }

        private void txtISGNum_TextChanged(object sender, EventArgs e)
        {
            if (txtGIPrice.Text != "" && txtISGNum.Text != "")
            {
                this.txtGSPrice.Text = Convert.ToString(Convert.ToUInt64(this.txtGIPrice.Text) * Convert.ToUInt64(this.txtISGNum.Text));
            }
        }

        private void txtGIPrice_TextChanged(object sender, EventArgs e)
        {
            if (txtISGNum.Text != "")
            {
                this.txtGSPrice.Text = Convert.ToString(Convert.ToUInt64(this.txtGIPrice.Text) * Convert.ToUInt64(this.txtISGNum.Text));
            }
            else
            {
                this.txtGSPrice.Text = this.txtGIPrice.Text;
            }
        }
    }
}

⌨️ 快捷键说明

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