public ActionResult RedirectInOutWarehouse() { //Session["Table_Id"] = null; //Table_Id = ""; InOutWarehouseViewModel inOutWarehouseViewModel = new InOutWarehouseViewModel(); inOutWarehouseViewModel.UserName = Session["User"].ToString(); inOutWarehouseViewModel.commodity = new Commodity(); //inOutWarehouseViewModel.mySelect = InOutWarehouseViewModel.MySelect.Co_Id; return(View("inOutWarehouse", inOutWarehouseViewModel)); }
public ActionResult SaveIntoOut() { if (IsIntoOutWaretor) { InOutWarehouseViewModel inOutWarehouseViewModel = new InOutWarehouseViewModel(); inOutWarehouseViewModel.UserName = Session["User"].ToString(); inOutWarehouseViewModel.commodity = (I_commodity == null ? new Commodity() : I_commodity); inOutWarehouseViewModel.manual_type = "手动" + I_type; inOutWarehouseViewModel.ok_type = "完成" + I_type; inOutWarehouseViewModel.cannel_type = "取消" + I_type; return(PartialView("SaveIntoOut", inOutWarehouseViewModel)); } return(new EmptyResult()); }
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); }