public static void raiseAdjustmentFromCollection(string itemNum, string depCode, int qtyDeff) { Unfulfilled uf = new Unfulfilled(); uf.ItemNumber = itemNum; uf.DepartmentCode = depCode; uf.UnfulfilledQuantity = qtyDeff; uf.Status = UnfulfilledDAO.STATUS_PENDING; uf.DateCreated = DateTime.Now; UnfulfilledDAO.CreateUnfulfilled(uf); }
//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 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); }
public static List <Object> GetUnfulfilledInfo(String deptHeadNumber) { return(UnfulfilledDAO.GetUnfulfilledInfo(deptHeadNumber)); }
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(); } }