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));
        }
        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));
        }