diff --git a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java index af3f39c6..01485f0c 100644 --- a/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java +++ b/backend/src/main/java/org/eclipse/tractusx/puris/backend/stock/logic/service/ProductStockResponseApiServiceImpl.java @@ -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; @@ -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 @@ -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); - - } - } diff --git a/frontend/src/views/StockView.vue b/frontend/src/views/StockView.vue index 360c8c6e..a79cbe49 100644 --- a/frontend/src/views/StockView.vue +++ b/frontend/src/views/StockView.vue @@ -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);