コード例 #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));
        }
コード例 #2
0
        public JsonResult Save(TransferStockArgs model)
        {
            long hotelId   = UserContext.CurrentUser.HotelId;
            var  apiResult = new APIResult();

            try
            {
                if (model.Item1.FromWarehourseId == model.Item1.ToWarehourseId)
                {
                    apiResult.Ret = -1;
                    apiResult.Msg = "调出仓库和调入仓库不能是同一仓库!";
                    return(Json(apiResult));
                }

                StockOrder stock = model.Item1;
                stock.DType = DocumentTypeEnum.调拨;
                stock.StockOrderDetailsList = model.Item2;
                StockOrderBll.AddOrUpdateTransferStock(stock, UserContext.CurrentUser.Name, hotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        public ActionResult Aduit(AuditArgs args)
        {
            var apiResult = new APIResult();

            try
            {
                StockOrderBll.UpdateAduitById(args.id, args.status);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
コード例 #5
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));
        }
コード例 #6
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));
        }
コード例 #7
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));
        }
コード例 #8
0
        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));
        }
コード例 #9
0
        public string GetPager(int page, int rows, long supplierId = 0, long warehourseId = 0, string reciveSDate = "", string reciveEDate = "", int AuditStatus = -1, long HotelId = 0)
        {
            var pager = StockOrderBll.GetPager(page, rows, HotelId, supplierId, warehourseId, reciveSDate, reciveEDate, DocumentTypeEnum.退货, AuditStatus);//

            return(JsonConvert.SerializeObject(pager));
        }
コード例 #10
0
        public string GetPager(int page, int rows, long fromWarehourseId = 0, long toWarehourseId = 0, string reciveSDate = "", string reciveEDate = "", int IsAduit = -1)
        {
            var pager = StockOrderBll.GetPagerByTrabsfer(page, rows, UserContext.CurrentUser.HotelId, fromWarehourseId, toWarehourseId, reciveSDate, reciveEDate, DocumentTypeEnum.调拨, IsAduit);

            return(JsonConvert.SerializeObject(pager));
        }