/** Sendet den Supply an den Server, Supplydaten werden aus der Klasse prodAndDistr gezogen */ private static void SendSupply() { Period period = PeriodInfo.getActualPeriod(); ProductionAndDistribution pad = Company.getInstance().getProdAndDistr(); period.setProductPrice(pad.getSellingPrice()); Supply s = new Supply(pad.getUnitsToSell(), pad.getSellingPrice()); // s.quantity = 20000; Client client = Client.getInstance(); client.SendMessage(new SendSupplyMessage(s)); }
public static void RecieveAssignedDisposal( SendAssignedDisposalMessage sendAssignedDemandMessage) { int quantity = sendAssignedDemandMessage.getQuantity(); Period actPeriod = PeriodInfo.getActualPeriod(); double price = actPeriod.getProductPrice(); double revenue = quantity * price; CompanyController.receiveSalesRevenue(revenue, quantity); try { // double wages = CompanyController.payEmployeesSallery(); // double deprecation = CompanyController.depcrecateMachines(); CompanyController.paySallery(); CompanyController.depcrecateMachines(); CompanyController.payInterestAndRepayment(); // CompanyController.payEmployersSalery(); //integrated in paySallery. CompanyController.payRent(); // Company comp = Company.getInstance(); // double produceCostPerProdukt = wages / // Math.min(comp.getEmployeeCapacity(EmployeeType.Produktion), // comp.getEmployeeCapacity(EmployeeType.Verwaltung)) // + deprecation / Math.min(comp.getMachineCapacity(MachineType.Filitiermaschine), // comp.getMachineCapacity(MachineType.Verpackungsmaschine)) // + Ressource.getNeed(RessourceType.Rohfisch) * // Ressource.getFixedCosts(RessourceType.Rohfisch) // + Ressource.getNeed(RessourceType.Verpackungsmaterial) * // Ressource.getFixedCosts(RessourceType.Verpackungsmaterial); // PeriodInfo.getActualPeriod().setFinishedProductsValue(produceCostForLeftFinishedProducts); // comp.setWarehouseCostPerProduct(produceCostPerProdukt); CompanyController.payWarehouseCosts(); ProfitAndLoss guv = actPeriod.makeGuV(); SendCompanyResultMessage message = new SendCompanyResultMessage(guv.profit); Client.getInstance().SendMessage(message); } catch (UserCanNotPayException e) { NetMessage insolvencyMessage = new NetMessage(MessageType.SEND_INSOLVENCY, new byte[0]); Client.getInstance().SendMessage(insolvencyMessage); MainWindow.getInstance().showInsolvency(); } }