/** added by lee * */ public static List <ConsolidatedRequisitionListDetail> getConsolidatedItemsForOpenNoDuplicates() { List <ConsolidatedRequisitionList> consoList = ConsolidatedRequisitionListEFFacade.getAllOpenList(); List <ConsolidatedRequisitionListDetail> detailList = new List <ConsolidatedRequisitionListDetail>(); foreach (ConsolidatedRequisitionList consoReqList in consoList) { foreach (ConsolidatedRequisitionListDetail detail in consoReqList.ConsolidatedRequisitionListDetails) { bool isduplicate = false; foreach (ConsolidatedRequisitionListDetail finalDetail in detailList) { if (finalDetail.ItemNumber.Equals(detail.ItemNumber)) { isduplicate = true; } } if (!isduplicate) { detailList.Add(detail); } } } return(detailList); }
public static RetrievalForm getRetrivalData(string productNum) { RetrievalForm rf = new RetrievalForm(); Product p = ProductDAO.getSearchProductbyid(productNum); rf.productDescription = p.Description.ToString(); rf.availableQty = Convert.ToInt32(p.Stock.TotalInventoryBalance); rf.needeQty = ConsolidatedRequisitionListEFFacade.getNeededQty(productNum); List <string> depList = ConsolidatedRequisitionListEFFacade.getAllDepInvolved(productNum); List <int> qtyList = ConsolidatedRequisitionListEFFacade.getQtyNeedeOfDep(depList, productNum); rf.departments = depList; rf.depNeededQty = qtyList; List <int> tempDistList = new List <int>(); int tempStock = rf.availableQty; for (int i = 0; i < depList.Count(); i++) { if (tempStock < rf.depNeededQty[i]) { tempDistList.Add(tempStock); tempStock = 0; } if (tempStock > rf.depNeededQty[i]) { tempDistList.Add(rf.depNeededQty[i]); tempStock = tempStock - rf.depNeededQty[i]; } } rf.depAvailQty = tempDistList; return(rf); }
//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 List <ConsolidatedRequisitionListDetail> getAllAwaitingItemsForDept(string deptCode) { List <ConsolidatedRequisitionList> list = ConsolidatedRequisitionListEFFacade.getAllAwaitingForDept(deptCode); List <ConsolidatedRequisitionListDetail> detailsList = new List <ConsolidatedRequisitionListDetail>(); foreach (ConsolidatedRequisitionList conlist in list) { foreach (ConsolidatedRequisitionListDetail detail in conlist.ConsolidatedRequisitionListDetails) { detailsList.Add(detail); } } return(detailsList); }
public static List <Department> getAllDeptForCollectionPointID(string collectionPointId) { //get all dept for collection point who have pending consolidated list(awaiting) //1) get all depts for that collection point id List <Department> deptForCollectionPtIDList = DepartmentDAO.getDepartmentsForCollectionPointId(collectionPointId); //2) get all depts with consolidated list in awaiting List <ConsolidatedRequisitionList> awaiting_Consol_List = ConsolidatedRequisitionListEFFacade.getAllAwaitingStatus(); // 3) create new list for depts for that collection point with awaiting consolidated list List <Department> finalDeptList = new List <Department>(); foreach (ConsolidatedRequisitionList consol_List in awaiting_Consol_List) { foreach (Department dept in deptForCollectionPtIDList) { if (dept.DepartmentCode.Equals(consol_List.DepartmentCode)) { //check if theres duplicate in finallist if not add to list bool isduplicate = false; foreach (Department dep in finalDeptList) { if (dept.DepartmentCode.Equals(dep.DepartmentCode)) { isduplicate = true; } } if (!isduplicate) { finalDeptList.Add(dept); } } } } return(finalDeptList); }
/** 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); }
public static void updateStationaryCollection(string itemNum, int[] actualQty, string[] depCode) { List <string> itemList = new List <string>(); List <Product> plist = ConsolidatedRequisitionListEFFacade.getAllProductsToCollect(); foreach (Product p in plist) { itemList.Add(p.ItemNumber); } List <string> depCodeList = depCode.ToList <string>(); List <int> qtyList = ConsolidatedRequisitionListEFFacade.getQtyNeedeOfDep(depCodeList, itemNum); if (itemList.Contains(itemNum)) { for (int j = 0; j < actualQty.Length; j++) { int i = ConsolidatedRequisitionListEFFacade.getDepOpenConsolidatedIDfromProd(itemNum, depCode[j]); ConsolidatedRequisitionListEFFacade.updateStationaryCollection(i, itemNum, actualQty[j]); int deff = qtyList[j] - actualQty[j]; if (deff > 0) { UnfulfilledDAO.raiseAdjustmentFromCollection(itemNum, depCode[j], deff); } } } int stockRed = 0; for (int i = 0; i < actualQty.Length; i++) { stockRed = actualQty[i] + stockRed; } ProductDAO.UpdateStockReduce(itemNum, stockRed); }
//--sreeja--// public static List <ConsolidatedRequisitionList> getPendingReqAllDepts() { return(ConsolidatedRequisitionListEFFacade.getPendingReqAllDepts()); }
public static List <ConsolidatedRequisitionListDetail> getAllImpendingList(string dep) { return(ConsolidatedRequisitionListEFFacade.getAllImpendingList(dep)); }
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(); } }
public static void finishCollection() { ConsolidatedRequisitionListEFFacade.finisheCollection(); }