Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/fix/apply-catenax-standards' int…
Browse files Browse the repository at this point in the history
…o refactor/marshalling-unmarshalling

# Conflicts:
#	backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/PartnerProductStockService.java
#	backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/PartnerProductStockServiceImpl.java
#	backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java
  • Loading branch information
eschrewe committed Aug 4, 2023
2 parents 539a189 + 13151e9 commit 92bbcc2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
import lombok.extern.slf4j.Slf4j;
import org.eclipse.tractusx.puris.backend.stock.domain.model.ProductStockRequest;
import org.eclipse.tractusx.puris.backend.common.api.domain.model.datatype.DT_RequestStateEnum;
import org.eclipse.tractusx.puris.backend.common.api.logic.dto.MessageContentDto;
import org.eclipse.tractusx.puris.backend.common.api.logic.dto.MessageContentErrorDto;
import org.eclipse.tractusx.puris.backend.common.api.logic.dto.ResponseDto;
import org.eclipse.tractusx.puris.backend.common.api.logic.service.ResponseApiService;
import org.eclipse.tractusx.puris.backend.masterdata.domain.model.Partner;
import org.eclipse.tractusx.puris.backend.masterdata.logic.service.PartnerService;
import org.eclipse.tractusx.puris.backend.stock.domain.model.PartnerProductStock;
Expand All @@ -40,7 +36,6 @@
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.UUID;

/**
* Service implements the handling of a response for Product Stock
Expand Down Expand Up @@ -108,20 +103,19 @@ public void consumeResponse(ProductStockResponse response) {
log.info(String.format("Created Partner ProductStock from SAMM: %s",
createdPartnerProductStock));
} else {
// update quantity only
PartnerProductStock existingPartnerProductStock = existingPartnerProductStocks.get(0);
existingPartnerProductStock.setQuantity(partnerProductStockDto.getQuantity());

PartnerProductStock updatedPartnerProductStock =
partnerProductStockService.update(existingPartnerProductStocks.get(0));
partnerProductStockService.update(existingPartnerProductStock);
log.info(String.format("Updated Partner ProductStock from SAMM: %s",
updatedPartnerProductStock));
}
}

// Update status - also only MessageContentErrorDtos would be completed
productStockRequestService.updateState(correspondingProductStockRequest, DT_RequestStateEnum.COMPLETED);
}

private ProductStockRequest findCorrespondingRequest(ResponseDto responseDto) {
UUID requestId = responseDto.getHeader().getRequestId();
return productStockRequestService.findRequestByHeaderUuid(requestId);

}

}
6 changes: 3 additions & 3 deletions frontend/src/views/StockView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ export default {
methods: {
addOrUpdateStock(changedStock) {
if (changedStock.type === "Material") {
var existingMaterialStock = this.bdMaterialStocks.filter(
var existingMaterialStocks = this.bdMaterialStocks.filter(
(stock) => (stock.material.uuid === changedStock.materialId)
);
if (existingMaterialStock.length === 1) { // Update existing material stock
var existingMaterialStock = existingMaterialStock[0];
if (existingMaterialStocks.length === 1) { // Update existing material stock
var existingMaterialStock = existingMaterialStocks[0];
existingMaterialStock.quantity = changedStock.quantity;
this.putData(this.backendURL + this.endpointMaterialStocks, existingMaterialStock);
Expand Down

0 comments on commit 92bbcc2

Please sign in to comment.