public bool calculateLists(IDataCollectorServiceRejections dataCollector, IDataCalculatorServiceRejections dataCalculator) { if (isReleaseRejections) { dataCollector.populateReleaseRejectionList(salesOrg); rejectionsList = dataCalculator.getRejectionsList(dataCollector); if (rejectionsList is null || rejectionsList.Count == 0) { return(false); } rejectionsList = dataCollector.getFinalListWithStockDetails(rejectionsList, salesOrg); releaseRejectionList = rejectionsList.Where(x => x.confirmedQty > 0).ToList(); afterReleaseRejectionList = rejectionsList.Where(x => x.confirmedQty == 0).ToList(); } else { afterReleaseRejectionList = dataCollector.getReleaseRejectionsListFromLog(salesOrg); if (afterReleaseRejectionList.Count == 0) { return(false); } } return(true); }
public List <RejectionsProperty> getRejectionsList(IDataCollectorServiceRejections dcsr) { if (dcsr.zvList is null || dcsr.zvList.Count == 0) { return(null); } List <RejectionsProperty> allCustomerRejectionList = getInitialRejPropertyList(id, dcsr, customerCondition: CustomerCondition.All); List <RejectionsProperty> soldToOnlyCustomerRejectionList = getInitialRejPropertyList(id, dcsr, customerCondition: CustomerCondition.SoldTo); List <RejectionsProperty> shiToOnlyCustomerRejectionList = getInitialRejPropertyList(id, dcsr, customerCondition: CustomerCondition.ShipTo); List <RejectionsProperty> finalList = new List <RejectionsProperty>(); if (shiToOnlyCustomerRejectionList.Count > 0) { allCustomerRejectionList = allCustomerRejectionList.Where(x => shiToOnlyCustomerRejectionList.Any(y => y.shipTo != x.shipTo && y.soldTo != x.soldTo)).ToList(); } if (soldToOnlyCustomerRejectionList.Count > 0) { allCustomerRejectionList = allCustomerRejectionList.Where(x => soldToOnlyCustomerRejectionList.Any(y => y.soldTo != x.soldTo)).ToList(); } if (shiToOnlyCustomerRejectionList.Count > 0) { soldToOnlyCustomerRejectionList = soldToOnlyCustomerRejectionList.Where(x => shiToOnlyCustomerRejectionList.Any(y => y.shipTo != x.shipTo)).ToList(); } finalList.AddRange(shiToOnlyCustomerRejectionList); finalList.AddRange(soldToOnlyCustomerRejectionList); finalList.AddRange(allCustomerRejectionList); finalList = finalList.OrderBy(x => x.soldTo).ThenBy(x => x.shipTo).ThenBy(x => x.orderNumber).ThenBy(x => x.item).ToList(); return(finalList); }
private List <RejectionsProperty> getInitialRejPropertyList(string id, IDataCollectorServiceRejections dcsr, CustomerCondition customerCondition) { return(( from zv in dcsr.zvList join cd in dcsr.cdList on new { key0 = zv.soldTo, key1 = zv.shipTo } equals new { key0 = cd.soldTo, key1 = cd.shipTo } join rd in dcsr.rdjList on new { key0 = zv.material, key1 = cd.country.ToLower() } equals new { key0 = rd.sku, key1 = rd.country.ToLower() } where getStockConditon(rd: rd, zv: zv) && getCustomerCondition(rejCondition: customerCondition, zv: zv, rd: rd) select getRejectionsPropertyObjs(zv: zv, rd: rd, cd: cd, id: id) ).ToList()); }