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

📄 branchreturnexec.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 Model;
using BLL;

namespace 金利来分销管理系统.Branch
{
    public partial class BranchReturnExec : System.Web.UI.Page
    {
        BLL.Employee.EmployeeBll employeebllshow;
        BLL.Branch.VenditionBll venditionbllshow;
        BLL.Store.StoreBll storeIDshow;

        public BranchReturnExec()
        {
            employeebllshow = new BLL.Employee.EmployeeBll();
            venditionbllshow = new BLL.Branch.VenditionBll();
            storeIDshow = new BLL.Store.StoreBll();
        }
        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(), "67") == true )
                    {
                        List<Model.Branch.VenditionModel> vendition = venditionbllshow.vendition_id_Select();
                        foreach (Model.Branch.VenditionModel item in vendition)
                        {
                            this.ddlReturn.Items.Add(item.vendition_id);
                        }
                    }
                    else
                    {
                        Response.Write("<script>alert('你无权查看此功能,请与管理员联系');location.href='../Aboutus.aspx'</script>");
                    }
                }
            }
        }
        //根据退货单号显示信息
        protected void ddlReturn_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.lblshow.Visible = false;
            this.gvShow.DataSource = venditionbllshow.venditionByIDSelect(this.ddlReturn.Text);
            this.gvShow.DataBind();
        }
        //执行
        protected void btnExec_Click(object sender, EventArgs e)
        {
            if (this.ddlReturn.SelectedValue != "请选择退货单号")
            {
                //通过退货单号查询信息
                List<Model.Branch.VenditionModel> list = venditionbllshow.venditionByIDSelect(this.ddlReturn.Text);
                foreach (Model.Branch.VenditionModel item in list)
                {
                    //通过商品在库存中
                    Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(item.Shop_id, item.info_productID, item.info_color);
                    //判断甲方的库存量是否充足
                    if (storemodel.store_size1 < item.info_size1 || storemodel.store_size2 < item.info_size2 || storemodel.store_size3 < item.info_size3 || storemodel.store_size4 < item.info_size4 || storemodel.store_size5 < item.info_size5 || storemodel.store_size6 < item.info_size6 || storemodel.store_size7 < item.info_size7)
                    {
                        this.lblshow.Visible = true;
                        return;
                    }
                }
                //该单据有N条信息,执行N次
                foreach (Model.Branch.VenditionModel item in list)
                {
                    //检查乙方仓库,有则修改
                    if (storeIDshow.InsertStoreCheck(item.info_productID, 100, item.info_color) == 1)
                    {
                        //通过商品在库存中
                        Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(item.Shop_id, item.info_productID, item.info_color);
                        //当库存中的数量小于0时
                        if (storemodel.store_size1 < 0 || storemodel.store_size2 < 0 || storemodel.store_size3 < 0 || storemodel.store_size4 < 0 || storemodel.store_size5 < 0 || storemodel.store_size6 < 0 || storemodel.store_size7 < 0)
                        {
                            this.lblshow.Visible = true;
                            return;
                        }
                        else
                        {
                            //甲方仓库修改
                            storeIDshow.OutStoreUp(item.Shop_id, item.info_productID, item.info_color, item.info_size1, item.info_size2, item.info_size3, item.info_size4, item.info_size5, item.info_size6, item.info_size7, item.info_sum);
                            //乙方仓库修改
                            storeIDshow.InsertStoreUp(100, item.info_productID, item.info_color, item.info_size1, item.info_size2, item.info_size3, item.info_size4, item.info_size5, item.info_size6, item.info_size7, item.info_sum);
                        }
                    }
                    //检查乙方仓库,无则添加
                    if (storeIDshow.InsertStoreCheck(item.info_productID, 100, item.info_color) == 0)
                    {
                        //通过商品在库存中
                        Model.Store.StoreModel storemodel = storeIDshow.SelectStoreByProduct(item.Shop_id, item.info_productID, item.info_color);
                        //当库存中的数量小于0时
                        if (storemodel.store_size1 < 0 || storemodel.store_size2 < 0 || storemodel.store_size3 < 0 || storemodel.store_size4 < 0 || storemodel.store_size5 < 0 || storemodel.store_size6 < 0 || storemodel.store_size7 < 0)
                        {
                            this.lblshow.Visible = true;
                            return;
                        }
                        else
                        {
                            //甲方仓库修改
                            storeIDshow.OutStoreUp(100, item.info_productID, item.info_color, item.info_size1, item.info_size2, item.info_size3, item.info_size4, item.info_size5, item.info_size6, item.info_size7, item.info_sum);
                            //乙方仓库修改
                            storeIDshow.InsertStoreInto(100, item.info_productID, item.info_color, item.info_size1, item.info_size2, item.info_size3, item.info_size4, item.info_size5, item.info_size6, item.info_size7, item.info_sum);
                        }
                    }
                }
                Response.Write("<script>alert('执行成功')</script>");
                this.lblshow.Visible = false;
            }
            else
            {
                Response.Write("<script>alert('未选择单据号')</script>");
            }
        }
    }
}

⌨️ 快捷键说明

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