示例#1
0
        // GET: View retrieval list
        public ActionResult ViewRetrievalList()
        {
            int        retrievalListId    = reqService.FindCurrentRetrievalList().RetrievalListID;
            List <int> requisitionIDs     = db.RequisitionRetrievals.Where(r => r.RetrievalListID == retrievalListId).Select(r => r.RequisitionID).ToList();
            var        requisitionDetails = db.RequisitionDetails.Where(r => requisitionIDs.Contains(r.RequisitionID)).ToList();

            ViewData["requisitionDetails"] = requisitionDetails;
            Dictionary <Item, int> itemQuantity = reqService.GetItemAndQuantity(requisitionDetails);

            ViewData["itemquantity"] = itemQuantity;
            List <Item> items = itemQuantity.Keys.ToList();

            ViewData["items"]       = items;
            ViewBag.retrievalListId = retrievalListId;
            Dictionary <Item, Dictionary <Requisition, int> > itemRquisitionList = new Dictionary <Item, Dictionary <Requisition, int> >();

            foreach (var item in items)
            {
                if (!itemRquisitionList.ContainsKey(item))
                {
                    itemRquisitionList.Add(item, reqService.GetRequisitionByItem(item, requisitionDetails));
                }
            }
            ViewData["itemRequisitionList"] = itemRquisitionList;
            return(View("~/Views/Store/Clerk/ViewRetrievalList.cshtml", items));
        }