コード例 #1
0
        public ActionResult SaveExist(Exist exist, string W_name, string U_name)
        {
            //通过key查询到要改变的exit
            //通过W_name和U_name分别获得仓库编号和用户编号
            //整合信息
            UserBusinessLayer userBusinessLayer = new UserBusinessLayer();

            if ((exist.U_id = userBusinessLayer.GetId(U_name)) == -1)
            {
                return(RedirectToAction("RedirectStorage"));
            }
            WarehouseBusinessLayer warehouseBusinessLayer = new WarehouseBusinessLayer();

            if ((exist.W_id = warehouseBusinessLayer.GetId(W_name)) == -1)
            {
                return(RedirectToAction("RedirectStorage"));
            }
            //修改信息
            ExistBusinessLayer existBusinessLayer = new ExistBusinessLayer();

            existBusinessLayer.InputExist(exist.IO_Id, exist);

            //重定向
            return(RedirectToAction("RedirectStorage"));
        }
コード例 #2
0
        public ActionResult LossExist(string Count, string Co_Id, string IO_Id)
        {
            //MyStorageBusinessLayer storageBusinessLayer = new MyStorageBusinessLayer();
            //减去要报损的数据
            //通过IO_Id和Co_Id查询到符合条件的Exist
            ExistBusinessLayer existBusinessLayer = new ExistBusinessLayer();

            if (Convert.ToInt32(Count) > 0)
            {
                existBusinessLayer.InputExist(IO_Id, Co_Id, Convert.ToInt32(Count));
            }

            return(RedirectToAction("RedirectStorage"));
        }
コード例 #3
0
        /// <summary>
        /// 返回在存的全部数据
        /// </summary>
        /// <param name="U_name"></param>
        /// <returns></returns>
        public StorageViewModel GetStorageViewModel(bool Display, string U_name, int pageNumber = 1)
        {
            StorageViewModel storageViewModel = new StorageViewModel();

            storageViewModel.UserName = U_name;
            storageViewModel.existTableListViewModel         = new ExistTableListViewModel();
            storageViewModel.existTableListViewModel.Display = Display ? "" : "none";
            //storageViewModel.existTableListViewModel.existTableViewModels = new List<ExistTableViewModel>();
            List <ExistTableViewModel> existTableViewModels = new List <ExistTableViewModel>();

            ExistBusinessLayer       existBusinessLayer       = new ExistBusinessLayer();
            CommodityBusinessLayer   commodityBusinessLayer   = new CommodityBusinessLayer();
            OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer();
            UserBusinessLayer        userBusinessLayer        = new UserBusinessLayer();
            WarehouseBusinessLayer   warehouseBusinessLayer   = new WarehouseBusinessLayer();

            //得到全部在存表中的数据
            List <Exist> exists = existBusinessLayer.GetExist();
            //Out_Into_ware out_Into_Ware;
            ExistTableViewModel existTableViewModel;

            foreach (Exist item in exists)
            {
                existTableViewModel       = new ExistTableViewModel();
                existTableViewModel.exist = item;
                //out_Into_Ware = outIntoWareBusinessLayer.GetOut_Into_ware(item.IO_Id);
                //得到姓名
                existTableViewModel.U_name = userBusinessLayer.GetUsers("员工编号", item.U_id.ToString()).FirstOrDefault().U_name;
                //得到仓库名
                existTableViewModel.W_name    = warehouseBusinessLayer.GetWarehouse("仓库编号", item.W_id.ToString()).FirstOrDefault().Wa_name;
                existTableViewModel.commodity = commodityBusinessLayer.GetCommodity("商品编号", item.Co_id.ToString()).FirstOrDefault();

                //storageViewModel.existTableListViewModel.existTableViewModels.Add(existTableViewModel);
                existTableViewModels.Add(existTableViewModel);
            }

            //每页显示多少条
            //int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]);
            storageViewModel.existTableListViewModel.existTableViewModels = existTableViewModels;

            return(storageViewModel);
        }
コード例 #4
0
        public ActionResult InOutWarehouse(string BtnSubmit, Commodity commodity, string sid, int Count)
        {
            InOutWarehouseViewModel inOutWarehouseViewModel = new InOutWarehouseViewModel();

            inOutWarehouseViewModel.UserName = Session["User"].ToString();
            if (BtnSubmit == "手动入库" || BtnSubmit == "手动出库")
            {
                if (!SelectIntoOut)
                {
                    //显示物品的数据
                    CommodityBusinessLayer commodityBusinessLayer = new CommodityBusinessLayer();
                    inOutWarehouseViewModel.commodity = commodityBusinessLayer.GetCommodity(sid, commodity);
                    if (!inOutWarehouseViewModel.commodity.Equals(commodity))
                    {
                        SelectIntoOut = true;
                    }
                }
                else
                {
                    //存储数据到Storage表(出入库单号、物品号、物品数量)
                    StorageBusinessLayer storageBusinessLayer = new StorageBusinessLayer();
                    Storage storage = new Storage();
                    storage.Co_id = commodity.Co_Id;
                    //storage.IO_Id = Session["Table_Id"].ToString();
                    storage.IO_Id    = Table_Id;
                    storage.Count    = Count;
                    storage.IntoDate = DateTime.Now;
                    storageBusinessLayer.InsertStorage(storage);

                    SelectIntoOut = false;
                    inOutWarehouseViewModel.commodity = new Commodity();
                }
            }
            else
            {
                StorageBusinessLayer storageBusinessLayer = new StorageBusinessLayer();
                if (BtnSubmit == "完成入库")
                {
                    //将入库的数据存储到Exist表中
                    ExistBusinessLayer          existBusinessLayer          = new ExistBusinessLayer();
                    InOutWarehouseBusinessLayer inOutWarehouseBusinessLayer = new InOutWarehouseBusinessLayer();
                    Exist          exist;
                    List <Storage> storages = storageBusinessLayer.GetStorage("IO_Id", Table_Id);
                    foreach (Storage storage in storages)
                    {
                        exist = inOutWarehouseBusinessLayer.GetExist(storage);
                        existBusinessLayer.InsertExist(exist);
                    }
                }
                else if (BtnSubmit == "完成出库")
                {
                    //将入库的数据在exit表中删除
                    //将入库的数据存储到Exist表中
                    ExistBusinessLayer          existBusinessLayer          = new ExistBusinessLayer();
                    InOutWarehouseBusinessLayer inOutWarehouseBusinessLayer = new InOutWarehouseBusinessLayer();
                    //Exist exist;
                    List <Storage> storages = storageBusinessLayer.GetStorage("IO_Id", Table_Id);
                    foreach (Storage storage in storages)
                    {
                        existBusinessLayer.Delete(storage);
                    }
                }
                else if (BtnSubmit == "取消入库" || BtnSubmit == "取消出库")
                {
                    //将入库的数据删除
                    storageBusinessLayer.Delete(Table_Id);
                    OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer();
                    outIntoWareBusinessLayer.Delete(Table_Id);
                }
                IsIntoOutWaretor = false; //设置为不是出入库状态IsIntoOutWaretor = false;
                SelectIntoOut    = false; //设置状态为取消SelectIntoOut = false;
                Table_Id         = "";    //表数据清除
            }

            I_commodity = inOutWarehouseViewModel.commodity;

            return(RedirectToAction("RedirectInOutWarehouse"));
            //return View("inOutWarehouse", inOutWarehouseViewModel);
        }
コード例 #5
0
        /// <summary>
        /// 得到符合条件的在存数据
        /// </summary>
        /// <param name="U_name">登陆人</param>
        /// <param name="Select">属性</param>
        /// <param name="name">属性值</param>
        /// <returns></returns>
        public StorageViewModel GetStorageViewModel(bool Display, string U_name, string Select, string name, int pageNumber = 1)
        {
            StorageViewModel storageViewModel = new StorageViewModel();

            storageViewModel.UserName = U_name;
            storageViewModel.existTableListViewModel         = new ExistTableListViewModel();
            storageViewModel.existTableListViewModel.Display = Display ? "" : "none";
            //storageViewModel.existTableListViewModel.existTableViewModels = new List<ExistTableViewModel>();
            List <ExistTableViewModel> existTableViewModels = new List <ExistTableViewModel>();

            ExistBusinessLayer       existBusinessLayer       = new ExistBusinessLayer();
            CommodityBusinessLayer   commodityBusinessLayer   = new CommodityBusinessLayer();
            OutIntoWareBusinessLayer outIntoWareBusinessLayer = new OutIntoWareBusinessLayer();
            UserBusinessLayer        userBusinessLayer        = new UserBusinessLayer();
            WarehouseBusinessLayer   warehouseBusinessLayer   = new WarehouseBusinessLayer();

            //得到全部在存表中的数据
            List <Exist> exists;

            if (Select == "入库单号" || Select == "商品编号")
            {
                exists = existBusinessLayer.GetExist(Select, name);
            }
            else
            {
                exists = existBusinessLayer.GetExist();
            }
            //Out_Into_ware out_Into_Ware;
            ExistTableViewModel existTableViewModel;

            foreach (Exist item in exists)
            {
                existTableViewModel       = new ExistTableViewModel();
                existTableViewModel.exist = item;
                //out_Into_Ware = outIntoWareBusinessLayer.GetOut_Into_ware(item.IO_Id);
                //得到姓名
                existTableViewModel.U_name = userBusinessLayer.GetUsers("员工编号", item.U_id.ToString()).FirstOrDefault().U_name;
                if (Select == "入库员工" && existTableViewModel.U_name != name)
                {
                    continue;
                }
                //得到仓库名
                existTableViewModel.W_name = warehouseBusinessLayer.GetWarehouse("仓库编号", item.W_id.ToString()).FirstOrDefault().Wa_name;
                if (Select == "存储仓库" && existTableViewModel.W_name != name)
                {
                    continue;
                }
                //existTableViewModel.commodity = commodityBusinessLayer.GetCommodity("商品编号", item.Co_id.ToString()).FirstOrDefault();
                CommodityMember commodityMember = new CommodityMember();
                switch (Select)
                {
                case "商品编号":
                    commodityMember.Co_Id = name;
                    break;

                case "商品名称":
                    commodityMember.Co_name = name;
                    break;

                case "条码编号":
                    commodityMember.Co_bar_code = name;
                    break;

                case "商品分类":
                    commodityMember.Co_type = name;
                    break;
                }
                existTableViewModel.commodity = commodityBusinessLayer.GetCommodities(commodityMember).FirstOrDefault();


                //storageViewModel.existTableListViewModel.existTableViewModels.Add(existTableViewModel);
                existTableViewModels.Add(existTableViewModel);
            }

            //每页显示多少条
            //int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"]);
            storageViewModel.existTableListViewModel.existTableViewModels = existTableViewModels;

            return(storageViewModel);
        }