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

📄 removeexec.aspx.cs

📁 c#三层架构项目开发的全过程
💻 CS
字号:
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 Model;
namespace 金利来分销管理系统.Remove
{
    public partial class RemoveExec : System.Web.UI.Page
    {
        BLL.Remove.RemoveBll bllshow;
        BLL.Store.StoreBll storeIDshow;
        BLL.Employee.EmployeeBll employeebllshow;

        List<Model.Remove.RemoveModel> show = new List<Model.Remove.RemoveModel>();
        public RemoveExec()
        {
            bllshow = new BLL.Remove.RemoveBll();
            storeIDshow = new BLL.Store.StoreBll();
            employeebllshow = new BLL.Employee.EmployeeBll();

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                 //用户权限
                if (Session["employee_id"] == null)
                {
                    Response.Write("<script>alert('请您登陆系统');location.href='../Enter.aspx'</script>");
                }
                else 
                {
                    if (employeebllshow.UserRole(Session["role_id"].ToString(), "39") == true)
                    {
                        //获得通过审核的调拨单据放入DropDownList里
                        List<Model.Remove.RemoveModel> removeIDok = bllshow.SelectRemoveIDok();
                        foreach (var item in removeIDok)
                        {
                            this.ddlRemoveID.Items.Add(item.remove_id);
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
            }

        }
        //当单据选择发生改变时
        protected void ddlRemoveID_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.lblshow.Visible = false;
            List<Model.Remove.RemoveModel> show = bllshow.SelectRemove(this.ddlRemoveID.Text);
            foreach (var item in show)
            {
                this.lblgoid.Text = item.remove_go;
                this.lbltoid.Text = item.remove_to;
            }
            this.gvshow.DataSource = bllshow.SelectRemoveList(this.ddlRemoveID.Text);
            this.gvshow.DataBind();
        }
        //执行
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (this.ddlRemoveID.SelectedValue !="请选择单据号")
            {
                //按单据号,找出该单据详细
                List<Model.Remove.RemoveModel> removeshow = bllshow.SelectRemoveList(this.ddlRemoveID.Text);
                //有几行记录,就循环几次,首先比对仓库库存和单据数量
                foreach (Model.Remove.RemoveModel item in removeshow)
                {
                    //通过商品在库存中
                    Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(int.Parse(this.lblgoid.Text), item.Product_id,item.remove_list_color);
                    //判断甲方的库存量是否充足
                    if (storemodel.store_size1 < item.remove_list_size1 || storemodel.store_size2 < item.remove_list_size2 || storemodel.store_size3 < item.remove_list_size3 || storemodel.store_size4 < item.remove_list_size4 || storemodel.store_size5 < item.remove_list_size5 || storemodel.store_size6 < item.remove_list_size6 || storemodel.store_size7 < item.remove_list_size7)
                    {
                        this.lblshow.Visible = true;
                        return;
                    }
                }
                //通过以上验证,有几行记录,就循环几次
                foreach (Model.Remove.RemoveModel item in removeshow)
                {
                    //判断该商品在乙方仓库有无,如果有
                    if (storeIDshow.InsertStoreCheck(item.Product_id, int.Parse(this.lbltoid.Text), item.remove_list_color) == 1)
                    {
                        //甲方仓库修改
                        storeIDshow.OutStoreUp(int.Parse(this.lblgoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
                        //乙方仓库修改
                        storeIDshow.InsertStoreUp(int.Parse(this.lbltoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
                        //修改单据状态
                        //bllshow.UpRemove(this.ddlRemoveID.Text, '员', this.txtadvice.Text, this.rblistState.SelectedValue);
                    }
                    //判断该商品在乙方仓库有无,如果无
                    if (storeIDshow.InsertStoreCheck(item.Product_id, int.Parse(this.lbltoid.Text), item.remove_list_color) == 0)
                    {
                        //甲方仓库修改
                        storeIDshow.OutStoreUp(int.Parse(this.lblgoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
                        //乙方仓库添加
                        storeIDshow.InsertStoreInto(int.Parse(this.lbltoid.Text), item.Product_id, item.remove_list_color, item.remove_list_size1, item.remove_list_size2, item.remove_list_size3, item.remove_list_size4, item.remove_list_size5, item.remove_list_size6, item.remove_list_size7, item.remove_list_sum);
                    }
                }
                this.lblshow.Visible = false;
                storeIDshow.Upstate(ddlRemoveID.Text, "已入库");
                Response.Write("<script>alert('操作成功')</script>");
                this.ddlRemoveID.Items.Remove(this.ddlRemoveID.Text);
                this.ddlRemoveID.SelectedIndex = 0;
            }
            else
            {
                Response.Write("<script>alert('未选择单据号')</script>");
            }
        }
    }
}

⌨️ 快捷键说明

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