コード例 #1
0
        public ActionResult DeleteRecord(string BtnSubmit, string Date, string Co_id)
        {
            StorageBusinessLayer storageBusinessLayer = new StorageBusinessLayer();

            storageBusinessLayer.Delete(Date, Co_id, Table_Id);
            return(RedirectToAction("RedirectInOutWarehouse"));
        }
コード例 #2
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);
        }