Skip to content

Commit

Permalink
fix: List locators with asterisc warehouse. (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt authored Dec 10, 2024
1 parent ac854f5 commit 404b7f3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 39 deletions.
Binary file modified resources/adempiere-grpc-server.pb
Binary file not shown.
80 changes: 48 additions & 32 deletions src/main/java/org/spin/grpc/service/MaterialManagement.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import org.spin.service.grpc.util.db.CountUtil;
import org.spin.service.grpc.util.db.LimitUtil;
import org.spin.service.grpc.util.value.NumberManager;
import org.spin.service.grpc.util.value.StringManager;
import org.spin.service.grpc.util.value.ValueManager;

import io.grpc.Status;
Expand Down Expand Up @@ -165,7 +166,7 @@ private ListEntitiesResponse.Builder listProductStorage(ListProductStorageReques
nexPageToken = LimitUtil.getPagePrefix(SessionManager.getSessionUuid()) + (pageNumber + 1);
}
builder.setNextPageToken(
ValueManager.validateNull(nexPageToken)
StringManager.getValidString(nexPageToken)
);

return builder;
Expand Down Expand Up @@ -458,7 +459,7 @@ private ListProductAttributeSetInstancesResponse.Builder listProductAttributeSet
nexPageToken = LimitUtil.getPagePrefix(SessionManager.getSessionUuid()) + (pageNumber + 1);
}
builderList.setNextPageToken(
ValueManager.validateNull(nexPageToken)
StringManager.getValidString(nexPageToken)
);

return builderList;
Expand All @@ -476,18 +477,18 @@ private ProductAttributeSetInstance.Builder convertProductAttributeSetInstance(M
}
builder.setId(attributeSetInstance.getM_AttributeSetInstance_ID())
.setDescription(
ValueManager.validateNull(
StringManager.getValidString(
attributeSetInstance.getDescription()
)
)
.setLot(
ValueManager.validateNull(
StringManager.getValidString(
attributeSetInstance.getLot()
)
)
.setLotId(attributeSetInstance.getM_Lot_ID())
.setSerial(
ValueManager.validateNull(
StringManager.getValidString(
attributeSetInstance.getSerNo())
)
.setProductAttributeSet(
Expand Down Expand Up @@ -537,7 +538,7 @@ private ProductAttributeInstance.Builder convertProductAttributeInstance(MAttrib

builder.setId(0)
.setValue(
ValueManager.validateNull(
StringManager.getValidString(
attributeInstance.getValue()
)
)
Expand All @@ -564,12 +565,12 @@ private ProductAttributeSet.Builder convertProductAttributeSet(MAttributeSet att
}
builder.setId(attributeSet.getM_AttributeSet_ID())
.setName(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getName()
)
)
.setDescription(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getDescription()
)
)
Expand All @@ -578,33 +579,33 @@ private ProductAttributeSet.Builder convertProductAttributeSet(MAttributeSet att
.setIsLotMandatory(attributeSet.isLotMandatory())
.setLotControlId(attributeSet.getM_LotCtl_ID())
.setLotCharStartOverwrite(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getLotCharSOverwrite()
)
)
.setLotCharEndOverwrite(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getLotCharEOverwrite()
)
)
.setIsSerial(attributeSet.isSerNo())
.setIsSerialMandatory(attributeSet.isSerNoMandatory())
.setSerialControlId(attributeSet.getM_SerNoCtl_ID())
.setSerialCharStartOverwrite(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getSerNoCharSOverwrite()
)
)
.setSerialCharEndOverwrite(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getSerNoCharEOverwrite()
)
)
.setIsGuaranteeDate(attributeSet.isGuaranteeDate())
.setIsGuaranteeDateMandatory(attributeSet.isGuaranteeDateMandatory())
.setGuaranteeDays(attributeSet.getGuaranteeDays())
.setMandatoryType(
ValueManager.validateNull(
StringManager.getValidString(
attributeSet.getMandatoryType()
)
)
Expand Down Expand Up @@ -641,17 +642,17 @@ private ProductAttribute.Builder convertProductAttribute(MAttribute attribute) {
}
builder.setId(attribute.getM_Attribute_ID())
.setName(
ValueManager.validateNull(
StringManager.getValidString(
attribute.getName()
)
)
.setDescription(
ValueManager.validateNull(
StringManager.getValidString(
attribute.getDescription()
)
)
.setValueType(
ValueManager.validateNull(
StringManager.getValidString(
attribute.getAttributeValueType()
)
)
Expand Down Expand Up @@ -690,17 +691,17 @@ private ProductAttributeValue.Builder convertProductAttributeValue(MAttributeVal
}
builder.setId(productAttributeValue.getM_AttributeValue_ID())
.setName(
ValueManager.validateNull(
StringManager.getValidString(
productAttributeValue.getName()
)
)
.setDescription(
ValueManager.validateNull(
StringManager.getValidString(
productAttributeValue.getDescription()
)
)
.setValue(
ValueManager.validateNull(
StringManager.getValidString(
productAttributeValue.getValue()
)
)
Expand Down Expand Up @@ -891,7 +892,7 @@ private ListAvailableWarehousesResponse.Builder listAvailableWarehouses(ListAvai
nexPageToken = LimitUtil.getPagePrefix(SessionManager.getSessionUuid()) + (pageNumber + 1);
}
builderList.setNextPageToken(
ValueManager.validateNull(nexPageToken)
StringManager.getValidString(nexPageToken)
);

return builderList;
Expand All @@ -909,23 +910,27 @@ private Warehouse.Builder convertAvailableWarehouse(MWarehouse warehouse) {
return builder;
}

builder.setId(warehouse.getM_Warehouse_ID())
builder.setId(
warehouse.getM_Warehouse_ID()
)
.setValue(
ValueManager.validateNull(
StringManager.getValidString(
warehouse.getValue()
)
)
.setName(
ValueManager.validateNull(
StringManager.getValidString(
warehouse.getName()
)
)
.setDescription(
ValueManager.validateNull(
StringManager.getValidString(
warehouse.getDescription()
)
)
.setIsInTransit(warehouse.isInTransit())
.setIsInTransit(
warehouse.isInTransit()
)
;
if (warehouse.getM_WarehouseSource_ID() > 0) {
Warehouse.Builder builderSource = convertAvailableWarehouse(
Expand All @@ -952,7 +957,8 @@ public void listLocators(ListLocatorsRequest request, StreamObserver<ListLocator
responseObserver.onError(Status.INTERNAL
.withDescription(e.getLocalizedMessage())
.withCause(e)
.asRuntimeException());
.asRuntimeException()
);
}
}

Expand Down Expand Up @@ -1045,7 +1051,7 @@ private ListLocatorsResponse.Builder listLocators(ListLocatorsRequest request) {
nexPageToken = LimitUtil.getPagePrefix(SessionManager.getSessionUuid()) + (pageNumber + 1);
}
builderList.setNextPageToken(
ValueManager.validateNull(nexPageToken)
StringManager.getValidString(nexPageToken)
);

return builderList;
Expand All @@ -1058,29 +1064,39 @@ private Locator.Builder convertLocator(MLocator locator) {
}

builder.setId(locator.getM_Locator_ID())
.setUuid(
StringManager.getValidString(
locator.getUUID()
)
)
.setValue(
ValueManager.validateNull(
StringManager.getValidString(
locator.getValue()
)
)
.setDisplayValue(
StringManager.getValidString(
locator.getDisplayValue()
)
)
.setIsDefault(locator.isDefault())
.setAisle(
ValueManager.validateNull(
StringManager.getValidString(
locator.getX()
)
)
.setBin(
ValueManager.validateNull(
StringManager.getValidString(
locator.getX()
)
)
.setLevel(
ValueManager.validateNull(
StringManager.getValidString(
locator.getZ()
)
)
;
if (locator.getM_Warehouse_ID() > 0) {
if (locator.getM_Warehouse_ID() >= 0) {
Warehouse.Builder builderWarehouse = convertAvailableWarehouse(
locator.getM_Warehouse_ID()
);
Expand Down
16 changes: 9 additions & 7 deletions src/main/proto/material_management.proto
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ service MaterialManagement {
option (google.api.http) = { get: "/material-management/warehouses" };
}
rpc ListLocators(ListLocatorsRequest) returns (ListLocatorsResponse) {
option (google.api.http) = { get: "/material-management/locatos" };
option (google.api.http) = { get: "/material-management/locators" };
}
}

Expand Down Expand Up @@ -240,12 +240,14 @@ message ListAvailableWarehousesResponse {
// Locator
message Locator {
int32 id = 1;
string value = 2;
bool is_default = 3;
string aisle = 4; // (X)
string bin = 5; // (Y)
string level = 6; // (Z)
Warehouse warehouse = 7;
string uuid = 2;
string value = 3;
string display_value = 4;
bool is_default = 5;
string aisle = 6; // (X)
string bin = 7; // (Y)
string level = 8; // (Z)
Warehouse warehouse = 9;
}

message ListLocatorsRequest {
Expand Down

0 comments on commit 404b7f3

Please sign in to comment.