Beispiel #1
0
        public AuthResult[] acknowledgecollectitems(ProductWCF[] itemsList)
        {
            List <ConsolidatedRequisitionListDetail> detailList = new List <ConsolidatedRequisitionListDetail>();

            foreach (ProductWCF p in itemsList)
            {
                ConsolidatedRequisitionListDetail detail = new ConsolidatedRequisitionListDetail();
                detail.ConsolidatedListID = p.ConsolidatedListID;
                detail.ItemNumber         = p.ItemNumber;
                detail.QuantityRequested  = p.QuantityRequested;
                detail.ActualQuantity     = p.ActualQuantityAccepted;
                detail.DateRequest        = DateTime.Now;

                detailList.Add(detail);
            }

            bool result = DeliverRequestController.acknowledgeCollectItems(detailList);
            List <AuthResult> resultList = new List <AuthResult>();
            AuthResult        bo         = new AuthResult();

            bo.SuccessResult = result;
            resultList.Add(bo);

            return(resultList.ToArray <AuthResult>());
        }
        public static void setActualQuantityForItem(int consolidatedListId, string itemCode, int quantity)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionListDetails
                        where x.ConsolidatedListID == consolidatedListId && x.ItemNumber == itemCode
                        select x;
            ConsolidatedRequisitionListDetail detailItem = query.First();

            detailItem.ActualQuantity = quantity;
            context.SaveChanges();
        }
        public static void updateStationaryCollection(int conListID, string itemNum, int actualQty)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var q = from x in context.ConsolidatedRequisitionListDetails
                    where x.ConsolidatedListID == conListID && x.ItemNumber == itemNum
                    select x;
            ConsolidatedRequisitionListDetail c = q.First <ConsolidatedRequisitionListDetail>();

            c.ActualQuantity = actualQty;
            context.SaveChanges();
        }
Beispiel #4
0
        //public static void acknowledgeCollectItems1(List<ConsolidatedRequisitionListDetail> detailsList)
        //{
        //    foreach (ConsolidatedRequisitionListDetail detailItem in detailsList)
        //    {
        //        ConsolidatedRequisitionListDetail item = ConsolidatedRequisitionListEFFacade.getItemWithMatchingListIDAndItemCode(detailItem.ConsolidatedListID, detailItem.ItemNumber);


        //        if (detailItem.ActualQuantity < item.ActualQuantity)
        //        {
        //            int difference = (int)item.ActualQuantity - (int)detailItem.ActualQuantity;
        //            ConsolidatedRequisitionListEFFacade.setActualQuantityForItem(detailItem.ConsolidatedListID, detailItem.ItemNumber, (int)detailItem.ActualQuantity);

        //            //raise voucher and update unfulfilled here

        //            //1. update unfulfilled items table
        //            updateUnfulfilledList(detailItem, difference);

        //            //2. raise adjustment voucher
        //            raiseNewAdjustmentVoucher(detailItem, difference);

        //            //3. update stock
        //            ProductDAO.UpdateStock(detailItem.ItemNumber, difference);

        //        }
        //    }
        //}

        private static void updateUnfulfilledList(ConsolidatedRequisitionListDetail detailItem, int quantity)
        {
            Department  dept = ConsolidatedRequisitionListEFFacade.getListForConsolidatedItem(detailItem);
            Unfulfilled uf   = new Unfulfilled();

            uf.ItemNumber          = detailItem.ItemNumber;
            uf.DepartmentCode      = dept.DepartmentCode;
            uf.UnfulfilledQuantity = quantity;
            uf.Status      = UnfulfilledDAO.STATUS_PENDING;
            uf.DateCreated = DateTime.Now;
            UnfulfilledDAO.CreateUnfulfilled(uf);
        }
        public static void addRequestedQtyForItem(int consolidatedListId, string itemCode, int qty)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionListDetails
                        where x.ConsolidatedListID == consolidatedListId && x.ItemNumber == itemCode
                        select x;
            ConsolidatedRequisitionListDetail detailItem = query.First();
            int k = Convert.ToInt32(detailItem.QuantityRequested);

            detailItem.QuantityRequested = qty + k;
            context.SaveChanges();
        }
        public static Department getListForConsolidatedItem(ConsolidatedRequisitionListDetail item)
        {
            UniversityStoreEntities context = new UniversityStoreEntities();
            var query = from x in context.ConsolidatedRequisitionLists
                        from y in context.ConsolidatedRequisitionListDetails
                        where x.ConsolidatedListID == y.ConsolidatedListID
                        select x;

            ConsolidatedRequisitionList list = query.First();
            Department dept = list.Department;

            return(dept);
        }
        public static void addDetailToList(int listID, string itemCode, int qtyReq, DateTime dateCreated, int actualQty)
        {
            UniversityStoreEntities           context = new UniversityStoreEntities();
            ConsolidatedRequisitionListDetail c2      = new ConsolidatedRequisitionListDetail();

            c2.ConsolidatedListID = listID;
            c2.ItemNumber         = itemCode;
            c2.QuantityRequested  = qtyReq;
            c2.DateRequest        = dateCreated;
            c2.ActualQuantity     = 0;

            context.AddToConsolidatedRequisitionListDetails(c2);
            context.SaveChanges();
        }
Beispiel #8
0
        private static void raiseNewAdjustmentVoucher(ConsolidatedRequisitionListDetail item, int quantity)
        {
            MakeAdjustmentItem adjustmentItem = new MakeAdjustmentItem();

            adjustmentItem.Comment    = "Damaged";
            adjustmentItem.ItemNumber = item.ItemNumber;
            adjustmentItem.Quantity   = quantity;
            adjustmentItem.Status     = AdjustmentVoucherEFFacade.STATUS_DECREASE;

            List <MakeAdjustmentItem> list = new List <MakeAdjustmentItem>();

            list.Add(adjustmentItem);

            MakeAdjustmentVoucherController.makeNewAdjustmentVoucher(list);
        }
Beispiel #9
0
        /** end by ashwin
         * */



        /** added by lee
         * */

        public static bool acknowledgeCollectItems(List <ConsolidatedRequisitionListDetail> detailsList)
        {
            List <int> listIDs = new List <int>();

            foreach (ConsolidatedRequisitionListDetail detailItem in detailsList)
            {
                ConsolidatedRequisitionListDetail item = ConsolidatedRequisitionListEFFacade.getItemWithMatchingListIDAndItemCode(detailItem.ConsolidatedListID, detailItem.ItemNumber);

                if (detailItem.ActualQuantity < item.ActualQuantity)
                {
                    int difference = (int)item.ActualQuantity - (int)detailItem.ActualQuantity;
                    ConsolidatedRequisitionListEFFacade.setActualQuantityForItem(detailItem.ConsolidatedListID, detailItem.ItemNumber, (int)detailItem.ActualQuantity);

                    //raise voucher and update unfulfilled here

                    //1. update unfulfilled items table
                    updateUnfulfilledList(detailItem, difference);

                    //2. raise adjustment voucher
                    raiseNewAdjustmentVoucher(detailItem, difference);

                    //3. update stock
                    ProductDAO.UpdateStock(detailItem.ItemNumber, difference);
                }

                if (!listIDs.Contains(detailItem.ConsolidatedListID))
                {
                    listIDs.Add(detailItem.ConsolidatedListID);
                }
            }

            foreach (int id in listIDs)
            {
                ConsolidatedRequisitionListEFFacade.setListStatusToClosed(id);
            }

            return(true);
        }
Beispiel #10
0
        public static void generateConsolidatedListFromUnfullfilled()
        {
            List <string> dlist = new List <string>();
            List <ConsolidatedRequisitionList> el;

            el = ConsolidatedRequisitionListEFFacade.getAllDepInvolved();
            foreach (ConsolidatedRequisitionList e in el)
            {
                dlist.Add(e.DepartmentCode);
            }


            List <string> deplist = UnfulfilledDAO.getAllUnfullfilledDepartments();
            Dictionary <string, List <ConsolidatedRequisitionListDetail> > consolidatedDictionary = new Dictionary <string, List <ConsolidatedRequisitionListDetail> >();

            if (deplist.Count() != 0)
            {
                for (int p = 0; p < deplist.Count(); p++)
                {
                    if (dlist.Contains(deplist[p]))
                    {
                        ConsolidatedRequisitionList cl = ConsolidatedRequisitionListEFFacade.getOpenListForDept(deplist[p]);
                        int           listid           = cl.ConsolidatedListID;
                        List <string> itemlist         = ConsolidatedRequisitionListEFFacade.getAllItemsOfList(listid);
                        List <Object> olist1           = UnfulfilledDAO.getAllUnfuffilledOfDep(deplist[p]);

                        for (int i = 0; i < olist1.Count(); i++)
                        {
                            string itmeNum;
                            itmeNum = olist1[i].ToString().Substring(15, 4);
                            if (itemlist.Contains(itmeNum))
                            {
                                ConsolidatedRequisitionListEFFacade.addRequestedQtyForItem(listid, itmeNum, Convert.ToInt32(olist1[i].ToString().Substring(32, ((olist1[i].ToString().Length) - 34))));
                            }

                            else
                            {
                                ConsolidatedRequisitionListEFFacade.addDetailToList(listid, itmeNum, Convert.ToInt32(olist1[i].ToString().Substring(32, ((olist1[i].ToString().Length) - 34))), (UnfulfilledDAO.getTheFirstDatetDate(deplist[p])), 0);
                            }
                        }
                    }

                    if (dlist.Contains(deplist[p]) == false)
                    {
                        List <Object> olist2 = UnfulfilledDAO.getAllUnfuffilledOfDep(deplist[p]);

                        List <ConsolidatedRequisitionListDetail> crl = new List <ConsolidatedRequisitionListDetail>();
                        for (int i = 0; i < olist2.Count(); i++)
                        {
                            ConsolidatedRequisitionListDetail c = new ConsolidatedRequisitionListDetail();
                            c.ItemNumber        = olist2[i].ToString().Substring(15, 4);
                            c.QuantityRequested = Convert.ToInt32(olist2[i].ToString().Substring(32, ((olist2[i].ToString().Length) - 34)));
                            c.DateRequest       = UnfulfilledDAO.getTheFirstDatetDate(deplist[p]);
                            c.ActualQuantity    = 0;
                            crl.Add(c);
                        }

                        consolidatedDictionary.Add(deplist[p], crl);
                        ConsolidatedRequisitionListEFFacade.createNewConsolidatedRequisitionList(consolidatedDictionary);
                    }
                }

                UnfulfilledDAO.changeOpenToClosed();
            }
        }