diff --git a/src/main/java/org/chainoptim/desktop/features/client/controller/ClientOrdersController.java b/src/main/java/org/chainoptim/desktop/features/client/controller/ClientOrdersController.java index ff65955..8650274 100644 --- a/src/main/java/org/chainoptim/desktop/features/client/controller/ClientOrdersController.java +++ b/src/main/java/org/chainoptim/desktop/features/client/controller/ClientOrdersController.java @@ -312,7 +312,7 @@ private void setUpTableToolbarListeners() { } }); tableToolbarController.getDeleteSelectedRowsButton().setOnAction(e -> openConfirmDeleteDialog(selectedRowsIndices)); - tableToolbarController.getCreateNewOrderButton().setOnAction(e -> addNewOrder()); + tableToolbarController.getCreateNewShipmentButton().setOnAction(e -> addNewOrder()); } private void setUpConfirmDialogListeners() { diff --git a/src/main/java/org/chainoptim/desktop/features/factory/controller/FactoryInventoryController.java b/src/main/java/org/chainoptim/desktop/features/factory/controller/FactoryInventoryController.java index c7da460..16f7a2c 100644 --- a/src/main/java/org/chainoptim/desktop/features/factory/controller/FactoryInventoryController.java +++ b/src/main/java/org/chainoptim/desktop/features/factory/controller/FactoryInventoryController.java @@ -295,7 +295,7 @@ private void setUpTableToolbarListeners() { } }); tableToolbarController.getDeleteSelectedRowsButton().setOnAction(e -> openConfirmDeleteDialog(selectedRowsIndices));; - tableToolbarController.getCreateNewOrderButton().setOnAction(e -> addNewOrder()); + tableToolbarController.getCreateNewShipmentButton().setOnAction(e -> addNewOrder()); } private void setUpConfirmDialogListeners() { @@ -569,6 +569,7 @@ private void handleUpdateOrders(List FactoryInventoryItems private UpdateFactoryInventoryItemDTO getUpdateFactoryInventoryItemDTO(FactoryInventoryItem item) { UpdateFactoryInventoryItemDTO updateFactoryInventoryItemDTO = new UpdateFactoryInventoryItemDTO(); + updateFactoryInventoryItemDTO.setOrganizationId(factory.getOrganizationId()); updateFactoryInventoryItemDTO.setId(item.getId()); updateFactoryInventoryItemDTO.setComponentId(item.getComponent().getId()); updateFactoryInventoryItemDTO.setProductId(item.getProduct().getId()); diff --git a/src/main/java/org/chainoptim/desktop/features/factory/dto/UpdateFactoryInventoryItemDTO.java b/src/main/java/org/chainoptim/desktop/features/factory/dto/UpdateFactoryInventoryItemDTO.java index d161d1e..3a31dfa 100644 --- a/src/main/java/org/chainoptim/desktop/features/factory/dto/UpdateFactoryInventoryItemDTO.java +++ b/src/main/java/org/chainoptim/desktop/features/factory/dto/UpdateFactoryInventoryItemDTO.java @@ -6,6 +6,7 @@ public class UpdateFactoryInventoryItemDTO { private Integer id; + private Integer organizationId; private Integer factoryId; private Integer productId; private Integer componentId; diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierOrdersController.java b/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierOrdersController.java index ac200f3..eef4d5c 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierOrdersController.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierOrdersController.java @@ -309,7 +309,7 @@ private void setUpTableToolbarListeners() { } }); tableToolbarController.getDeleteSelectedRowsButton().setOnAction(e -> openConfirmDeleteDialog(selectedRowsIndices)); - tableToolbarController.getCreateNewOrderButton().setOnAction(e -> addNewOrder()); + tableToolbarController.getCreateNewShipmentButton().setOnAction(e -> addNewOrder()); } private void setUpConfirmDialogListeners() { diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierShipmentsController.java b/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierShipmentsController.java index 13c3176..6d7ee02 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierShipmentsController.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/controller/SupplierShipmentsController.java @@ -2,6 +2,10 @@ import org.chainoptim.desktop.core.context.TenantContext; import org.chainoptim.desktop.core.user.model.User; +<<<<<<< HEAD +import org.chainoptim.desktop.features.productpipeline.model.Component; +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af import org.chainoptim.desktop.features.supplier.dto.CreateSupplierShipmentDTO; import org.chainoptim.desktop.features.supplier.dto.UpdateSupplierShipmentDTO; import org.chainoptim.desktop.features.supplier.model.Supplier; @@ -16,7 +20,10 @@ import org.chainoptim.desktop.shared.enums.ShipmentStatus; import org.chainoptim.desktop.shared.enums.SearchMode; import org.chainoptim.desktop.shared.fallback.FallbackManager; +<<<<<<< HEAD +======= import org.chainoptim.desktop.shared.features.location.model.Location; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af import org.chainoptim.desktop.shared.httphandling.Result; import org.chainoptim.desktop.shared.search.controller.PageSelectorController; import org.chainoptim.desktop.shared.search.model.*; @@ -25,8 +32,13 @@ import org.chainoptim.desktop.shared.table.edit.cell.DateTimePickerCell; import org.chainoptim.desktop.shared.table.edit.cell.EditableCell; import org.chainoptim.desktop.shared.table.model.TableData; +<<<<<<< HEAD +import org.chainoptim.desktop.shared.table.util.SelectComponentLoader; +import org.chainoptim.desktop.shared.table.util.TableConfigurer; +======= import org.chainoptim.desktop.shared.table.util.TableConfigurer; import org.chainoptim.desktop.shared.table.util.SelectComponentLoader; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af import org.chainoptim.desktop.shared.toast.controller.ToastManager; import org.chainoptim.desktop.shared.toast.model.ToastInfo; import org.chainoptim.desktop.shared.util.DataReceiver; @@ -40,11 +52,23 @@ import javafx.beans.property.SimpleObjectProperty; import javafx.collections.MapChangeListener; import javafx.fxml.FXML; +<<<<<<< HEAD +import javafx.scene.control.ScrollPane; +import javafx.scene.control.TableColumn; +import javafx.scene.control.TableView; +import javafx.scene.layout.StackPane; + +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +======= import javafx.scene.control.*; import javafx.scene.layout.StackPane; import java.time.LocalDateTime; import java.util.*; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af import java.util.function.Consumer; public class SupplierShipmentsController implements DataReceiver> { @@ -94,16 +118,33 @@ public class SupplierShipmentsController implements DataReceiver, Integer> shipmentIdColumn; @FXML +<<<<<<< HEAD + private TableColumn, String> companyIdColumn; + @FXML + private TableColumn, String> supplierNameColumn; + @FXML + private TableColumn, String> componentNameColumn; + @FXML + private TableColumn, Float> quantityColumn; + @FXML + private TableColumn, Float> deliveredQuantityColumn; + @FXML + private TableColumn, ShipmentStatus> statusColumn; + @FXML +======= private TableColumn, Integer> supplierOrderIdColumn; @FXML private TableColumn, Float> quantityColumn; @FXML +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af private TableColumn, LocalDateTime> shipmentStartingDateColumn; @FXML private TableColumn, LocalDateTime> estimatedArrivalDateColumn; @FXML private TableColumn, LocalDateTime> arrivalDateColumn; @FXML +<<<<<<< HEAD +======= private TableColumn, String> transporterTypeColumn; @FXML private TableColumn, ShipmentStatus> statusColumn; @@ -116,6 +157,7 @@ public class SupplierShipmentsController implements DataReceiver, Float> currentLocationLongitudeColumn; @FXML +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af private StackPane pageSelectorContainer; @FXML private StackPane confirmUpdateDialogContainer; @@ -129,12 +171,21 @@ public class SupplierShipmentsController implements DataReceiver>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af this.supplierShipmentsService = supplierShipmentsService; this.supplierShipmentsWriteService = supplierShipmentsWriteService; this.commonViewsLoader = commonViewsLoader; @@ -150,15 +201,25 @@ public void setData(SearchData searchData) { this.searchMode = searchData.getSearchMode(); searchParams.setItemsPerPage(20); +<<<<<<< HEAD + SearchOptions searchOptions = SearchOptionsConfiguration.getSearchOptions(Feature.SUPPLIER_ORDER); +======= SearchOptions searchOptions = SearchOptionsConfiguration.getSearchOptions(Feature.SUPPLIER_SHIPMENT); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af commonViewsLoader.loadFallbackManager(fallbackContainer); tableToolbarController = commonViewsLoader.initializeTableToolbar(tableToolbarContainer); tableToolbarController.initialize(new ListHeaderParams (searchMode, searchParams, +<<<<<<< HEAD + "Supplier Shipments", "/img/box-solid.png", Feature.SUPPLIER_ORDER, + searchOptions.getSortOptions(), searchOptions.getFilterOptions(), + () -> loadSupplierShipments(searchMode == SearchMode.SECONDARY ? supplier.getId() : null), null, null)); +======= "Supplier Shipments", "/img/box-solid.png", Feature.SUPPLIER_SHIPMENT, searchOptions.getSortOptions(), searchOptions.getFilterOptions(), () -> loadSupplierShipments(searchMode == SearchMode.SECONDARY ? supplier.getId() : null), null, null)); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af pageSelectorController = commonViewsLoader.loadPageSelector(pageSelectorContainer); selectComponentLoader.initialize(); @@ -191,6 +252,20 @@ private void configureTableColumns() { // Bind columns to data selectRowColumn.setCellValueFactory(data -> data.getValue().isSelectedProperty()); shipmentIdColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getId())); +<<<<<<< HEAD + companyIdColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getCompanyId() != null ? data.getValue().getData().getCompanyId() : "N/A")); + supplierNameColumn.setCellValueFactory(data -> new SimpleObjectProperty<>("this.supplier.getName()")); + componentNameColumn.setCellValueFactory(data -> { + String componentName = data.getValue().getData().getComponentName(); + return new SimpleObjectProperty<>(componentName); + }); + quantityColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getQuantity())); + deliveredQuantityColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getDeliveredQuantity())); + statusColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getStatus())); + shipmentStartingDateColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getShipmentStartingDate())); + estimatedArrivalDateColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getEstimatedArrivalDate())); + arrivalDateColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getArrivalDate())); +======= supplierOrderIdColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getSupplierOrderId())); quantityColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getQuantity())); shipmentStartingDateColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getShipmentStartingDate())); @@ -202,11 +277,22 @@ private void configureTableColumns() { destinationLocationColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getDestinationLocation())); currentLocationLatitudeColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getCurrentLocationLatitude())); currentLocationLongitudeColumn.setCellValueFactory(data -> new SimpleObjectProperty<>(data.getValue().getData().getCurrentLocationLongitude())); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af configureColumnCellFactories(); } private void configureColumnCellFactories() { +<<<<<<< HEAD + companyIdColumn.setCellFactory(column -> new EditableCell, String>( + isEditMode, selectedRowsIndices, String::toString) { + @Override + protected void commitChange(TableData item, String newValue) { + item.getData().setCompanyId(newValue); + } + }); +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af quantityColumn.setCellFactory(column -> new EditableCell, Float>( isEditMode, selectedRowsIndices, Float::parseFloat) { @Override @@ -214,11 +300,19 @@ protected void commitChange(TableData item, Float newValue) { item.getData().setQuantity(newValue); } }); +<<<<<<< HEAD + deliveredQuantityColumn.setCellFactory(column -> new EditableCell, Float>( + isEditMode, selectedRowsIndices, Float::parseFloat) { + @Override + protected void commitChange(TableData item, Float newValue) { + item.getData().setDeliveredQuantity(newValue); +======= shipmentStartingDateColumn.setCellFactory(column -> new DateTimePickerCell, LocalDateTime>( isEditMode, selectedRowsIndices, true) { @Override protected void commitChange(TableData item, LocalDateTime newValue) { item.getData().setShipmentStartingDate(newValue); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af } }); estimatedArrivalDateColumn.setCellFactory(column -> new DateTimePickerCell, LocalDateTime>( @@ -228,6 +322,10 @@ protected void commitChange(TableData item, LocalDateTime newV item.getData().setEstimatedArrivalDate(newValue); } }); +<<<<<<< HEAD + +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af arrivalDateColumn.setCellFactory(column -> new DateTimePickerCell, LocalDateTime>( isEditMode, selectedRowsIndices, true) { @Override @@ -235,6 +333,12 @@ protected void commitChange(TableData item, LocalDateTime newV item.getData().setArrivalDate(newValue); } }); +<<<<<<< HEAD + shipmentStartingDateColumn.setCellFactory(column -> new DateTimePickerCell, LocalDateTime>( + isEditMode, selectedRowsIndices, false){}); + +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af statusColumn.setCellFactory(column -> new ComboBoxEditableCell, ShipmentStatus>( isEditMode, selectedRowsIndices, null, statusOptions) { @Override @@ -242,6 +346,19 @@ protected void commitChange(TableData item, ShipmentStatus new item.getData().setStatus(newValue); } }); +<<<<<<< HEAD + componentNameColumn.setCellFactory(column -> new ComboBoxEditableCell, String>( + isEditMode, selectedRowsIndices, null, selectComponentLoader.getComponentsName()) { + @Override + protected void commitChange(TableData item, String newValue) { + Component component = new Component(); + component.setId(selectComponentLoader.getComponentIdByName(newValue)); + component.setName(newValue); + item.getData().setComponentName(component.getName()); + } + }); +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af } // - Listeners @@ -290,7 +407,11 @@ private void setUpTableToolbarListeners() { } }); tableToolbarController.getDeleteSelectedRowsButton().setOnAction(e -> openConfirmDeleteDialog(selectedRowsIndices)); +<<<<<<< HEAD + tableToolbarController.getCreateNewShipmentButton().setOnAction(e -> addNewShipment()); +======= tableToolbarController.getCreateNewOrderButton().setOnAction(e -> addNewShipment()); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af } private void setUpConfirmDialogListeners() { @@ -332,7 +453,11 @@ private void loadSupplierShipments(Integer supplierId) { if (searchMode == SearchMode.SECONDARY) { if (supplierId == null) return; +<<<<<<< HEAD + supplierShipmentsService.getSupplierShipmentsAdvanced(supplierId, searchMode, searchParams) +======= supplierShipmentsService.getSupplierShipmentsAdvanced(32, searchMode, searchParams) +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af .thenApply(this::handleShipmentsResponse) .exceptionally(this::handleShipmentsException); } else { @@ -362,7 +487,11 @@ private Result> handleShipmentsResponse(Resul } for (SupplierShipment supplierShipment : paginatedResults.results) { +<<<<<<< HEAD + SupplierShipment oldData = supplierShipment.deepCopy(); +======= SupplierShipment oldData = new SupplierShipment(supplierShipment); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af TableData tableRow = new TableData<>(supplierShipment, oldData, new SimpleBooleanProperty(false)); setUpRowListeners(tableRow); tableView.getItems().add(tableRow); @@ -402,7 +531,12 @@ private void editSelectedRows() { isEditMode.set(true); for (Integer index : selectedRowsIndices) { TableData tableRow = tableView.getItems().get(index); +<<<<<<< HEAD + SupplierShipment oldShipment = tableRow.getData().deepCopy(); + oldShipment.setComponentName(tableRow.getData().getComponentName()); +======= SupplierShipment oldShipment = new SupplierShipment(tableRow.getData()); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af tableRow.setOldData(oldShipment); } selectRowColumn.setEditable(false); @@ -517,6 +651,19 @@ private CreateSupplierShipmentDTO getCreateSupplierShipmentDTO(SupplierShipment throw new IllegalArgumentException("Supplier Organization ID is missing"); } createSupplierShipmentDTO.setOrganizationId(supplier.getOrganizationId()); +<<<<<<< HEAD + createSupplierShipmentDTO.setSupplierId(supplier.getId()); + createSupplierShipmentDTO.setSupplierOrderId(shipment.getSupplierOrderId()); + createSupplierShipmentDTO.setComponentId(shipment.getComponentId()); + createSupplierShipmentDTO.setQuantity(shipment.getQuantity()); + createSupplierShipmentDTO.setDeliveredQuantity(shipment.getDeliveredQuantity()); + createSupplierShipmentDTO.setArrivalDate(shipment.getArrivalDate()); + createSupplierShipmentDTO.setEstimatedArrivalDate(shipment.getEstimatedArrivalDate()); + createSupplierShipmentDTO.setShipmentStartingDate(shipment.getShipmentStartingDate()); + createSupplierShipmentDTO.setStatus(shipment.getStatus()); + + createSupplierShipmentDTO.setCompanyId(shipment.getCompanyId()); +======= createSupplierShipmentDTO.setSupplierOrderId(32); createSupplierShipmentDTO.setQuantity(shipment.getQuantity()); createSupplierShipmentDTO.setShipmentStartingDate(shipment.getShipmentStartingDate()); @@ -527,6 +674,7 @@ private CreateSupplierShipmentDTO getCreateSupplierShipmentDTO(SupplierShipment createSupplierShipmentDTO.setDestinationLocation(shipment.getDestinationLocation()); createSupplierShipmentDTO.setCurrentLocationLatitude(shipment.getCurrentLocationLatitude()); createSupplierShipmentDTO.setCurrentLocationLongitude(shipment.getCurrentLocationLongitude()); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af return createSupplierShipmentDTO; } @@ -577,6 +725,17 @@ private void handleUpdateShipments(List supplierShipments) { private UpdateSupplierShipmentDTO getUpdateSupplierShipmentDTO(SupplierShipment shipment) { UpdateSupplierShipmentDTO updateSupplierShipmentDTO = new UpdateSupplierShipmentDTO(); updateSupplierShipmentDTO.setId(shipment.getId()); +<<<<<<< HEAD + updateSupplierShipmentDTO.setOrganizationId(shipment.getOrganizationId()); +// updateSupplierShipmentDTO.setComponentId(shipment.getComponent().getId()); + updateSupplierShipmentDTO.setQuantity(shipment.getQuantity()); +// updateSupplierShipmentDTO.setDeliveredQuantity(shipment.getDeliveredQuantity()); +// updateSupplierShipmentDTO.setShipmentDate(shipment.getShipmentDate()); +// updateSupplierShipmentDTO.setEstimatedDeliveryDate(shipment.getEstimatedDeliveryDate()); +// updateSupplierShipmentDTO.setDeliveryDate(shipment.getDeliveryDate()); +// updateSupplierShipmentDTO.setStatus(shipment.getStatus()); +// updateSupplierShipmentDTO.setCompanyId(shipment.getCompanyId()); +======= updateSupplierShipmentDTO.setOrganizationId(supplier.getOrganizationId()); updateSupplierShipmentDTO.setSupplierOrderId(shipment.getSupplierOrderId()); updateSupplierShipmentDTO.setQuantity(shipment.getQuantity()); @@ -588,6 +747,7 @@ private UpdateSupplierShipmentDTO getUpdateSupplierShipmentDTO(SupplierShipment updateSupplierShipmentDTO.setDestinationLocation(shipment.getDestinationLocation()); updateSupplierShipmentDTO.setCurrentLocationLatitude(shipment.getCurrentLocationLatitude()); updateSupplierShipmentDTO.setCurrentLocationLongitude(shipment.getCurrentLocationLongitude()); +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af return updateSupplierShipmentDTO; } diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/dto/CreateSupplierShipmentDTO.java b/src/main/java/org/chainoptim/desktop/features/supplier/dto/CreateSupplierShipmentDTO.java index a4a8a8e..cc488c1 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/dto/CreateSupplierShipmentDTO.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/dto/CreateSupplierShipmentDTO.java @@ -1,23 +1,31 @@ package org.chainoptim.desktop.features.supplier.dto; import org.chainoptim.desktop.shared.enums.ShipmentStatus; -import org.chainoptim.desktop.shared.features.location.model.Location; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.chainoptim.desktop.shared.features.location.model.Location; import java.time.LocalDateTime; @Data @AllArgsConstructor @NoArgsConstructor public class CreateSupplierShipmentDTO { + private Integer organizationId; + private Integer supplierId; private Integer supplierOrderId; + private String companyId; + private Integer componentId; + private String componentName; private Float quantity; + private Float deliveredQuantity; private LocalDateTime shipmentStartingDate; private LocalDateTime estimatedArrivalDate; private LocalDateTime arrivalDate; private ShipmentStatus status; + private Integer sourceLocationId; + private Integer destinationLocationId; private Location sourceLocation; private Location destinationLocation; private Float currentLocationLatitude; diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/dto/UpdateSupplierShipmentDTO.java b/src/main/java/org/chainoptim/desktop/features/supplier/dto/UpdateSupplierShipmentDTO.java index 1594b79..c875887 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/dto/UpdateSupplierShipmentDTO.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/dto/UpdateSupplierShipmentDTO.java @@ -1,16 +1,27 @@ package org.chainoptim.desktop.features.supplier.dto; +<<<<<<< HEAD +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +======= import org.chainoptim.desktop.shared.enums.ShipmentStatus; import org.chainoptim.desktop.shared.features.location.model.Location; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af import java.time.LocalDateTime; @Data @AllArgsConstructor @NoArgsConstructor public class UpdateSupplierShipmentDTO { +<<<<<<< HEAD + +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af private Integer id; private Integer organizationId; private Integer supplierOrderId; @@ -18,9 +29,15 @@ public class UpdateSupplierShipmentDTO { private LocalDateTime shipmentStartingDate; private LocalDateTime estimatedArrivalDate; private LocalDateTime arrivalDate; +<<<<<<< HEAD + private String status; + private Integer sourceLocationId; + private Integer destinationLocationId; +======= private ShipmentStatus status; private Location sourceLocation; private Location destinationLocation; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af private Float currentLocationLatitude; private Float currentLocationLongitude; } diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/model/SupplierShipment.java b/src/main/java/org/chainoptim/desktop/features/supplier/model/SupplierShipment.java index 28f11fc..fd67af8 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/model/SupplierShipment.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/model/SupplierShipment.java @@ -2,6 +2,26 @@ import org.chainoptim.desktop.shared.enums.ShipmentStatus; import org.chainoptim.desktop.shared.features.location.model.Location; +<<<<<<< HEAD +import lombok.*; + +import java.time.LocalDateTime; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class SupplierShipment { + + private Integer id; + private Integer supplierOrderId; + private String companyId; + private Integer componentId; + private String componentName; + private Float quantity; + private Float deliveredQuantity; +======= import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -30,6 +50,7 @@ public SupplierShipment(SupplierShipment data) { private Integer id; private Integer supplierOrderId; private Float quantity; +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af private LocalDateTime shipmentStartingDate; private LocalDateTime estimatedArrivalDate; private LocalDateTime arrivalDate; @@ -39,4 +60,33 @@ public SupplierShipment(SupplierShipment data) { private Location destinationLocation; private Float currentLocationLatitude; private Float currentLocationLongitude; -} \ No newline at end of file +<<<<<<< HEAD + private Integer organizationId; + private Integer supplierId; + private LocalDateTime createdAt; + private LocalDateTime updatedAt; + + public SupplierShipment deepCopy() { + return SupplierShipment.builder() +// .id(this.id) + .createdAt(this.createdAt) + .updatedAt(this.updatedAt) + .supplierOrderId(this.supplierOrderId) + .quantity(this.quantity) + .shipmentStartingDate(this.shipmentStartingDate) + .estimatedArrivalDate(this.estimatedArrivalDate) + .arrivalDate(this.arrivalDate) + .transporterType(this.transporterType) + .status(this.status) + .sourceLocation(this.sourceLocation) + .destinationLocation(this.destinationLocation) + .currentLocationLatitude(this.currentLocationLatitude) + .currentLocationLongitude(this.currentLocationLongitude) + .organizationId(this.organizationId) + .supplierId(this.supplierId) + .build(); + } +} +======= +} +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsServiceImpl.java b/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsServiceImpl.java index 3ff3a91..63990ad 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsServiceImpl.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsServiceImpl.java @@ -52,7 +52,7 @@ public CompletableFuture>> getSupplier String rootAddress = "http://localhost:8080/api/v1/"; String cacheKey = CacheKeyBuilder.buildAdvancedSearchKey( "supplier-shipments", - searchMode == SearchMode.ORGANIZATION ? "organization" : "order", entityId.toString(), + searchMode == SearchMode.ORGANIZATION ? "organization" : "supplier", entityId.toString(), searchParams); String routeAddress = rootAddress + cacheKey; diff --git a/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsWriteServiceImpl.java b/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsWriteServiceImpl.java index 03235b4..30478a2 100644 --- a/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsWriteServiceImpl.java +++ b/src/main/java/org/chainoptim/desktop/features/supplier/service/SupplierShipmentsWriteServiceImpl.java @@ -12,6 +12,8 @@ import org.chainoptim.desktop.shared.search.model.PaginatedResults; import com.fasterxml.jackson.core.type.TypeReference; import com.google.inject.Inject; + +import java.net.HttpURLConnection; import java.net.http.HttpRequest; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -71,10 +73,13 @@ public CompletableFuture>> deleteSupplierShipmentInBulk(Lis String routeAddress = "http://localhost:8080/api/v1/supplier-shipments/delete/bulk"; HttpRequest request = requestBuilder.buildWriteRequest( - HttpMethod.DELETE, routeAddress, tokenManager.getToken(), shipmentIds); + HttpMethod.PUT, routeAddress, tokenManager.getToken(), shipmentIds); + + requestHandler.sendRequest(request, new TypeReference<>() {}, ids -> + cachingService.clear() // Invalidate cache + ); + + return CompletableFuture.completedFuture(new Result<>(shipmentIds, null, HttpURLConnection.HTTP_OK)); - return requestHandler.sendRequest(request, new TypeReference>() {}, ids -> { - cachingService.clear(); // Invalidate cache - }); } } diff --git a/src/main/java/org/chainoptim/desktop/features/warehouse/controller/WarehouseInventoryController.java b/src/main/java/org/chainoptim/desktop/features/warehouse/controller/WarehouseInventoryController.java index 68dfd99..c0e5c4e 100644 --- a/src/main/java/org/chainoptim/desktop/features/warehouse/controller/WarehouseInventoryController.java +++ b/src/main/java/org/chainoptim/desktop/features/warehouse/controller/WarehouseInventoryController.java @@ -296,7 +296,7 @@ private void setUpTableToolbarListeners() { } }); tableToolbarController.getDeleteSelectedRowsButton().setOnAction(e -> openConfirmDeleteDialog(selectedRowsIndices));; - tableToolbarController.getCreateNewOrderButton().setOnAction(e -> addNewOrder()); + tableToolbarController.getCreateNewShipmentButton().setOnAction(e -> addNewOrder()); } private void setUpConfirmDialogListeners() { diff --git a/src/main/java/org/chainoptim/desktop/shared/enums/ShipmentStatus.java b/src/main/java/org/chainoptim/desktop/shared/enums/ShipmentStatus.java index 9ee55e9..8f6d6e1 100644 --- a/src/main/java/org/chainoptim/desktop/shared/enums/ShipmentStatus.java +++ b/src/main/java/org/chainoptim/desktop/shared/enums/ShipmentStatus.java @@ -1,5 +1,12 @@ package org.chainoptim.desktop.shared.enums; +<<<<<<< HEAD +import org.chainoptim.desktop.shared.util.ShipmentStatusDeserializer; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +@JsonDeserialize(using = ShipmentStatusDeserializer.class) +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af public enum ShipmentStatus { INITIATED, NEGOTIATED, @@ -12,6 +19,10 @@ public String toString() { return this.name().charAt(0) + this.name().substring(1).toLowerCase(); } +<<<<<<< HEAD + +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af public static ShipmentStatus fromString(String statusStr) { for (ShipmentStatus status : values()) { if (status.name().equalsIgnoreCase(statusStr)) { diff --git a/src/main/java/org/chainoptim/desktop/shared/table/TableToolbarController.java b/src/main/java/org/chainoptim/desktop/shared/table/TableToolbarController.java index 4c7ff47..a3237a8 100644 --- a/src/main/java/org/chainoptim/desktop/shared/table/TableToolbarController.java +++ b/src/main/java/org/chainoptim/desktop/shared/table/TableToolbarController.java @@ -5,7 +5,6 @@ import org.chainoptim.desktop.shared.enums.Feature; import org.chainoptim.desktop.shared.enums.SearchMode; import org.chainoptim.desktop.shared.search.filters.FilterBar; -import org.chainoptim.desktop.shared.search.filters.FilterOption; import org.chainoptim.desktop.shared.search.model.ListHeaderParams; import org.chainoptim.desktop.shared.search.model.SearchParams; @@ -17,7 +16,6 @@ import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; -import javafx.scene.layout.VBox; import javafx.util.Duration; import lombok.Getter; @@ -62,7 +60,7 @@ public class TableToolbarController { @FXML @Getter private Button saveChangesButton; @FXML @Getter - private Button createNewOrderButton; + private Button createNewShipmentButton; // Icons private Image sortUpIcon; @@ -94,7 +92,7 @@ public void initialize(ListHeaderParams headerParams) { setDeleteSelectedRowsButton(); setEditSelectedRowsButton(); setSaveChangesButton(); - setCreateNewOrderButton(); + setCreateNewShipmentButton(); toggleButtonVisibilityOnCancel(); } @@ -190,13 +188,13 @@ private void setSaveChangesButton() { toggleButtonVisibility(saveChangesButton, false); } - private void setCreateNewOrderButton() { + private void setCreateNewShipmentButton() { ImageView plusImageView = createImageView(plusIcon, 14, 14); ColorAdjust colorAdjust = new ColorAdjust(); colorAdjust.setBrightness(1); plusImageView.setEffect(colorAdjust); - createNewOrderButton.setGraphic(plusImageView); - createNewOrderButton.setContentDisplay(ContentDisplay.LEFT); + createNewShipmentButton.setGraphic(plusImageView); + createNewShipmentButton.setContentDisplay(ContentDisplay.LEFT); } public void toggleButtonVisibilityOnSelection(boolean isSelection) { @@ -212,7 +210,7 @@ public void toggleButtonVisibilityOnEdit(boolean isEditing) { } public void toggleButtonVisibilityOnCreate(boolean isNewOrderMode) { - toggleButtonVisibility(createNewOrderButton, isNewOrderMode); + toggleButtonVisibility(createNewShipmentButton, isNewOrderMode); toggleButtonVisibility(saveChangesButton, isNewOrderMode); toggleButtonVisibility(cancelRowSelectionButton, isNewOrderMode); toggleButtonVisibility(deleteSelectedRowsButton, !isNewOrderMode); diff --git a/src/main/java/org/chainoptim/desktop/shared/util/ShipmentStatusDeserializer.java b/src/main/java/org/chainoptim/desktop/shared/util/ShipmentStatusDeserializer.java new file mode 100644 index 0000000..c9a7be2 --- /dev/null +++ b/src/main/java/org/chainoptim/desktop/shared/util/ShipmentStatusDeserializer.java @@ -0,0 +1,16 @@ +package org.chainoptim.desktop.shared.util; + +import org.chainoptim.desktop.shared.enums.ShipmentStatus; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; + +import java.io.IOException; + +public class ShipmentStatusDeserializer extends JsonDeserializer { + @Override + public ShipmentStatus deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { + String statusStr = p.getText(); + return ShipmentStatus.fromString(statusStr); + } +} \ No newline at end of file diff --git a/src/main/resources/org/chainoptim/desktop/features/supplier/SupplierShipmentsView.fxml b/src/main/resources/org/chainoptim/desktop/features/supplier/SupplierShipmentsView.fxml index fc36d05..dd29cbf 100644 --- a/src/main/resources/org/chainoptim/desktop/features/supplier/SupplierShipmentsView.fxml +++ b/src/main/resources/org/chainoptim/desktop/features/supplier/SupplierShipmentsView.fxml @@ -1,14 +1,15 @@ - - - +======= fx:controller="org.chainoptim.desktop.features.supplier.controller.SupplierShipmentsController"> +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af @@ -21,6 +22,17 @@ +<<<<<<< HEAD + + + + + + + + + +======= @@ -32,6 +44,7 @@ +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af @@ -45,5 +58,9 @@ +<<<<<<< HEAD + +======= +>>>>>>> 7134550b09d6001d5ce347aaf8ec256d3aec77af diff --git a/src/main/resources/org/chainoptim/desktop/shared/table/TableToolbarView.fxml b/src/main/resources/org/chainoptim/desktop/shared/table/TableToolbarView.fxml index f56f87d..f5dab41 100644 --- a/src/main/resources/org/chainoptim/desktop/shared/table/TableToolbarView.fxml +++ b/src/main/resources/org/chainoptim/desktop/shared/table/TableToolbarView.fxml @@ -37,7 +37,7 @@