ck/add_ck.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
namespace 仓库管理系统.ck
{
    public partial class add_ck : System.Web.UI.Page
    {
        SQLHelper db = new SQLHelper();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                bind();
                this.txt_rq.Attributes["onClick"] = "WdatePicker()";
            }
        }
        //
        public void bind()
        {
            string sql = "select * from product order by pro_id desc";//构造选出行业所有字段的SQL语句
            DataTable dt = db.ExecuteQuery(sql, CommandType.Text);
            this.ddl_product.DataSource = dt;
            this.ddl_product.DataTextField = "product";
            this.ddl_product.DataValueField = "pro_id";
            this.ddl_product.DataBind();

            //
        }
        //
        protected void Button1_Click(object sender, EventArgs e)
        {
            int depot_id = int.Parse(Session["depot_id"].ToString());
            DateTime rq = Convert.ToDateTime(this.txt_rq.Text.ToString());
            string dh = this.txt_dh.Text.ToString();
            int sl = int.Parse(this.txt_sl.Text.ToString());
            int pro_id = int.Parse(this.ddl_product.SelectedValue.ToString());
            //计算本仓库该商品的库存量
            pub p = new pub();
            int total = p.pro_total(pro_id, depot_id);
            //
            if (total >= sl)//如果库存总量大于出库数量
            {
                DataTable dt = p.turn_pro(pro_id);
                int c_id = int.Parse(dt.Rows[0]["c_id"].ToString());
            string sql = "insert into ck(rq,dh,pro_id,sl,depot_id,c_id) values('" + rq + "','" + dh + "','" + pro_id + "','" + sl + "','"+depot_id+"','"+c_id+"')";
            int s = db.ExecuteNonQuery(sql, CommandType.Text);
            Response.Write("<script>alert('成功!');location='add_ck.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('该商品库存量小于出库数量,不能出库!');location='add_ck.aspx'</script>");
            }
            //
        }
    }
后面还有 1 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。