예제 #1
0
        public JsonResult Save(RefundArgs model)
        {
            long hotelId   = UserContext.CurrentUser.HotelId;
            var  apiResult = new APIResult();

            try
            {
                StockOrder stock = model.Item1;
                stock.DType = Model.Enum.DocumentTypeEnum.退货;
                stock.StockOrderDetailsList = model.Item2;

                StockOrderBll.AddOrUpdate(stock, UserContext.CurrentUser.Name, hotelId);

                ViewData["supplier"]   = SupplierBll.GetAllList(hotelId);
                ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
        // GET: InventoryRecord
        public ActionResult Index()
        {
            long hotelId = UserContext.CurrentUser.HotelId;

            ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            return(View());
        }
        public ActionResult Edit(long id = 0)
        {
            if (id == 0)
            {
                return(View(new Hotel.Model.Inventory.Warehouse()));
            }
            var info = WarehouseBll.GetById(id);

            return(View(info));
        }
        public string getById(long id)
        {
            InventoryRecord model = InventoryRecordBll.GetById(id);

            if (model != null)
            {
                var warehourse = WarehouseBll.GetById(model.WarehourseId);

                model.WarehourseName = warehourse == null ? "" : warehourse.Name;
            }

            return(JsonConvert.SerializeObject(model));
        }
        public string getById(long id)
        {
            StockOrder model = StockOrderBll.GetById(id);

            if (model != null)
            {
                var recallWarehourse   = WarehouseBll.GetById(model.FromWarehourseId);
                var transferWarehourse = WarehouseBll.GetById(model.ToWarehourseId);

                model.FromWarehourseName = recallWarehourse == null ? "" : recallWarehourse.Name;
                model.ToWarehourseName   = transferWarehourse == null ? "" : transferWarehourse.Name;
            }

            return(JsonConvert.SerializeObject(model));
        }
예제 #6
0
        // GET: Stock
        public ActionResult Index()
        {
            long hotelId = UserContext.CurrentUser.HotelId;
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(hotelId);
            List <SelectListItem> typeItems   = new List <SelectListItem>();

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            ViewData["commodityTypeList"] = typeItems;
            ViewData["warehouse"]         = WarehouseBll.GetAllList(hotelId);
            return(View());
        }
        public ActionResult Delete(long id)
        {
            var apiResult = new APIResult();

            try
            {
                WarehouseBll.Delete(id);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
        public JsonResult Edit(Hotel.Model.Inventory.Warehouse model)
        {
            var apiResult = new APIResult();

            try
            {
                WarehouseBll.AddOrUpdate(model, UserContext.CurrentUser.UserName, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
예제 #9
0
        /// <summary>
        /// 出库单商品列表页面
        /// </summary>
        /// <returns></returns>
        public ActionResult _OutStockSearch(long warehourseid)
        {
            List <SelectListItem> typeItems   = new List <SelectListItem>();
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(UserContext.CurrentUser.HotelId);

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            Warehouse house = WarehouseBll.GetById(warehourseid);

            if (house == null)
            {
                warehourseid = 0;
            }
            ViewData["commodityTypeList"] = typeItems;
            ViewData["warehourseid"]      = warehourseid;
            return(View());
        }
예제 #10
0
        public string GetById(long id)
        {
            StockOrder model = StockOrderBll.GetById(id);

            if (model != null)
            {
                var supply     = SupplierBll.GetById(model.SupplierId);
                var warehourse = WarehouseBll.GetById(model.FromWarehourseId);

                if (supply != null)
                {
                    model.SupplierName = supply.Name;
                }
                if (warehourse != null)
                {
                    model.FromWarehourseName = warehourse.Name;
                }
            }

            return(JsonConvert.SerializeObject(model));
        }
예제 #11
0
        public ActionResult Preview(long id = 0)
        {
            long hotelId = UserContext.CurrentUser.HotelId;

            ViewData["supplier"]   = SupplierBll.GetAllList(hotelId);
            ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            if (id == 0)
            {
                return(View(new OutStockArgs()
                {
                    Item1 = new StockOrder(), Item2 = new List <StockOrderDetails>()
                }));
            }

            StockOrder model = StockOrderBll.GetById(id);

            Warehouse house         = WarehouseBll.GetById(model.FromWarehourseId);
            string    WarehouseName = house?.Name;

            //给详情附上仓库名字
            List <StockOrderDetails> list = model.StockOrderDetailsList;

            if (list != null && list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    list[i].WarehouseName = WarehouseName;
                }
            }

            var info = new OutStockArgs
            {
                Item1 = model,
                Item2 = list,
            };

            return(View(info));
        }
        public ActionResult Preview(long id = 0)
        {
            long hotelId = UserContext.CurrentUser.HotelId;

            ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            if (id == 0)
            {
                return(View(new InventoryRecordArgs()
                {
                    Item1 = new InventoryRecord(), Item2 = new List <InventoryRecordDetails>()
                }));
            }


            InventoryRecord model = InventoryRecordBll.GetById(id);
            var             info  = new InventoryRecordArgs
            {
                Item1 = model,
                Item2 = model.InventoryRecordDetailsList
            };

            return(View(info));
        }
예제 #13
0
        public ActionResult Preview(long id = 0)
        {
            long hotelId = UserContext.CurrentUser.HotelId;

            ViewData["supplier"]   = SupplierBll.GetAllList(hotelId);
            ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            if (id == 0)
            {
                return(View(new RefundArgs()
                {
                    Item1 = new StockOrder(), Item2 = new List <StockOrderDetails>()
                }));
            }

            StockOrder model = StockOrderBll.GetById(id);
            var        info  = new RefundArgs
            {
                Item1 = model,
                Item2 = model.StockOrderDetailsList,
            };

            return(View(info));
        }
        public ActionResult Preview(long id = 0)
        {
            long hotelId = UserContext.CurrentUser.HotelId;

            ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId);
            if (id == 0)
            {
                return(View(new TransferStockArgs()
                {
                    Item1 = new StockOrder(), Item2 = new List <StockOrderDetails>()
                }));
            }


            StockOrder model = StockOrderBll.GetById(id);
            var        info  = new TransferStockArgs
            {
                Item1 = model,
                Item2 = model.StockOrderDetailsList.FindAll(it => it.DType == DocumentTypeEnum.调拨入库),
            };

            return(View(info));
        }
        public string GetPager(int page, int rows, string warehouseName, string warehouseStatus)
        {
            var pager = WarehouseBll.GetPager(page, rows, UserContext.CurrentUser.HotelId, warehouseName, warehouseStatus);

            return(JsonConvert.SerializeObject(pager));
        }