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));
        }
예제 #2
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));
        }
예제 #3
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));
        }
예제 #4
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));
        }