public JsonResult Save(OutStockArgs model) { long hotelId = UserContext.CurrentUser.HotelId; var apiResult = new APIResult(); try { StockOrder stock = model.Item1; stock.DType = Model.Enum.DocumentTypeEnum.销售出库; stock.StockOrderDetailsList = model.Item2; //stock.FromWarehourseId = OutStockWarehouseID;//这边系统会给定 StockOrderBll.AddOrUpdateOutStack(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)); }
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 Edit(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); var info = new OutStockArgs { Item1 = model, Item2 = model.StockOrderDetailsList, }; return(View(info)); }