Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ import PutawayList from './screens/PutawayList';
import Scan from './screens/Scan';
import Settings from './screens/Settings';
import ShipItemDetails from './screens/ShipItemDetails';
import SortationEntryScreen from './screens/Sortation/SortationEntryScreen';
import SortationQuantityScreen from './screens/Sortation/SortationQuantityScreen';
import Transfer from './screens/Transfer';
import Transfers from './screens/Transfers';
import TransferDetails from './screens/TransfersDetails';
import ViewAvailableItem from './screens/ViewAvailableItem';
import ApiClient from './utils/ApiClient';
import Theme from './utils/Theme';
import SortationContainerScreen from './screens/Sortation/SortationContainerScreen';
import SortationTaskSelectionListScreen from './screens/Sortation/SortationTaskSelectionListScreen';

const Stack = createStackNavigator();
export interface OwnProps {
Expand Down Expand Up @@ -249,6 +253,26 @@ class Main extends Component<Props, State> {
options={{ title: 'Packing Location' }}
/>
<Stack.Screen name="AppInfo" component={AppInfoScreen} options={{ title: 'App Info' }} />
<Stack.Screen
name="Sortation"
component={SortationEntryScreen}
options={{ title: 'Inbound Sortation' }}
/>
<Stack.Screen
name="SortationQuantity"
component={SortationQuantityScreen}
options={{ title: 'Inbound Sortation' }}
/>
<Stack.Screen
name="SortationContainer"
component={SortationContainerScreen}
options={{ title: 'Inbound Sortation' }}
/>
<Stack.Screen
name="SortationTaskList"
component={SortationTaskSelectionListScreen}
options={{ title: 'Inbound Sortation' }}
/>
</Stack.Navigator>
</NavigationContainer>
</SafeAreaView>
Expand Down
4 changes: 4 additions & 0 deletions src/apis/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,7 @@ export function stockAdjustments(requestBody: any) {
export function searchBarcode(id: string) {
return apiClient.get(`/globalSearch/${id}`, {});
}

export function getProductByBarcode(barcode: string) {
return apiClient.get(`/barcodes?id=${encodeURIComponent(barcode)}`)
}
8 changes: 8 additions & 0 deletions src/apis/putaway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ export function getCandidates(locationId: string) {
export function createPutawayOder(data: any) {
return apiClient.post('/putaways', data);
}

export function getPutawayTasks(facilityId: string, productId: string) {
return apiClient.get(`/facilities/${facilityId}/putaway-tasks?statusCategory=OPEN&product.id=${productId}`);
}

export function patchPutawayTask(facilityId: string, putawayItemId: string, payload: any) {
return apiClient.patch(`/facilities/${facilityId}/putaway-tasks/${putawayItemId}`, payload);
}
1 change: 1 addition & 0 deletions src/assets/images/icon_sortation.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const DEFAULT_DATE_FORMAT_OPTIONS: Intl.DateTimeFormatOptions = {
};

export const appConfig = {
DEFAULT_DEBOUNCE_TIME: 500,
DEFAULT_DEBOUNCE_TIME: 2000,
APP_HEADER_HEIGHT: 56,
LOCALE: 'en-US'
};
11 changes: 11 additions & 0 deletions src/redux/actions/products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ export const STOCK_ADJUSTMENT_REQUEST_SUCCESS = 'STOCK_ADJUSTMENT_REQUEST_SUCCES

export const SEARCH_BARCODE = 'SEARCH_BARCODE';
export const SEARCH_BARCODE_SUCCESS = 'SEARCH_BARCODE_SUCCESS';

export const GET_SORTATION_DETAILS_BY_BARCODE = 'GET_SORTATION_DETAILS_BY_BARCODE';

export function getProductsAction(callback?: (products: any) => void) {
return {
type: GET_PRODUCTS_REQUEST,
Expand Down Expand Up @@ -100,3 +103,11 @@ export function searchBarcode(id: any, callback?: (data: any) => void) {
callback
};
}

export function getSortationDetailsByBarcode(barcode: string, callback: (data: any) => void) {
return {
type: GET_SORTATION_DETAILS_BY_BARCODE,
payload: { barcode },
callback
};
}
15 changes: 15 additions & 0 deletions src/redux/actions/putaways.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export const CREATE_PUTAWAY_ORDER_REQUEST = 'CREATE_PUTAWAY_ORDER_REQUEST';
export const CREATE_PUTAWAY_ORDER_REQUEST_SUCCESS = 'CREATE_PUTAWAY_ORDER_REQUEST_SUCCESS';
export const SUBMIT_PUTAWAY_ITEM_BIN_LOCATION = 'SUBMIT_PUTAWAY_ITEM_BIN_LOCATION';
export const SUBMIT_PUTAWAY_ITEM_BIN_LOCATION_SUCCESS = 'SUBMIT_PUTAWAY_ITEM_BIN_LOCATION_SUCCESS';
export const PATCH_PUTAWAY_TASK_REQUEST = 'PATCH_PUTAWAY_TASK_REQUEST';
export const PATCH_PUTAWAY_TASK_REQUEST_SUCCESS = 'PATCH_PUTAWAY_TASK_REQUEST_SUCCESS';

export function fetchPutAwayFromOrderAction(q: string | null, callback: (data: any) => void) {
return {
Expand Down Expand Up @@ -37,3 +39,16 @@ export function createPutawayOderAction(data: any, callback?: (data: any) => voi
callback
};
}

export function patchPutawayTaskAction(
facilityId: string,
putawayItemId: string,
payload: any,
callback?: (data: any) => void
) {
return {
type: PATCH_PUTAWAY_TASK_REQUEST,
payload: { facilityId, putawayItemId, payload },
callback
};
}
56 changes: 43 additions & 13 deletions src/redux/sagas/products.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { call, put, takeLatest } from 'redux-saga/effects';
import { call, put, select, takeLatest } from 'redux-saga/effects';
import {
GET_PRODUCT_BY_ID_REQUEST,
GET_PRODUCT_BY_ID_REQUEST_SUCCESS,
GET_PRODUCTS_REQUEST,
GET_PRODUCTS_REQUEST_SUCCESS,
GET_SORTATION_DETAILS_BY_BARCODE,
PRINT_LABEL_REQUEST,
PRINT_LABEL_REQUEST_SUCCESS,
SEARCH_BARCODE,
Expand All @@ -22,6 +23,7 @@ import {

import * as api from '../../apis';
import { hideScreenLoading, showScreenLoading } from '../actions/main';
import { userLocation } from '../selectors/auth';

function* getProducts(action: any) {
try {
Expand Down Expand Up @@ -67,10 +69,7 @@ function* searchProductsByName(action: any) {
function* searchProductByCode(action: any) {
try {
yield showScreenLoading('Please wait...');
const data = yield call(
api.searchProductByCode,
action.payload.productCode
);
const data = yield call(api.searchProductByCode, action.payload.productCode);
yield put({
type: SEARCH_PRODUCT_BY_CODE_REQUEST_SUCCESS,
payload: data
Expand Down Expand Up @@ -110,10 +109,7 @@ function* searchProductGlobally(action: any) {
function* searchProductsByCategory(action: any) {
try {
yield showScreenLoading('Searching..');
const data = yield call(
api.searchProductsByCategory,
action.payload.category
);
const data = yield call(api.searchProductsByCategory, action.payload.category);
yield put({
type: SEARCH_PRODUCTS_BY_CATEGORY_REQUEST_SUCCESS,
payload: data
Expand Down Expand Up @@ -213,17 +209,51 @@ function* stockAdjustments(action: any) {
}
}

function* getSortationDetailsSaga(action: any) {
try {
const productResponse: any = yield call(api.getProductByBarcode, action.payload.barcode);
const product = productResponse.data;

if (!product) {
throw new Error('Product not found.');
}

const location = yield select(userLocation);
if (!location || !location.id) {
return;
}

const tasksResponse: any = yield call(api.getPutawayTasks, location.id, product.id);
const tasks = tasksResponse?.data ?? [];

if (!tasks || tasks.length === 0) {
yield action.callback({
error: true,
errorMessage: 'Product found but there is not putaway task for it'
});
return;
}

yield action.callback({ product, tasks });
} catch (error: any) {
if (error.code != 401) {
yield action.callback({
error: true,
errorMessage: error.message
});
}
}
}

export default function* watcher() {
yield takeLatest(GET_PRODUCTS_REQUEST, getProducts);
yield takeLatest(SEARCH_PRODUCTS_BY_NAME_REQUEST, searchProductsByName);
yield takeLatest(SEARCH_PRODUCT_BY_CODE_REQUEST, searchProductByCode);
yield takeLatest(SEARCH_PRODUCT_GLOBALY_REQUEST, searchProductGlobally);
yield takeLatest(
SEARCH_PRODUCTS_BY_CATEGORY_REQUEST,
searchProductsByCategory
);
yield takeLatest(SEARCH_PRODUCTS_BY_CATEGORY_REQUEST, searchProductsByCategory);
yield takeLatest(GET_PRODUCT_BY_ID_REQUEST, getProductById);
yield takeLatest(PRINT_LABEL_REQUEST, printLabel);
yield takeLatest(STOCK_ADJUSTMENT_REQUEST, stockAdjustments);
yield takeLatest(SEARCH_BARCODE, searchBarcode);
yield takeLatest(GET_SORTATION_DETAILS_BY_BARCODE, getSortationDetailsSaga);
}
37 changes: 27 additions & 10 deletions src/redux/sagas/putaway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ import {
FETCH_PUTAWAY_FROM_ORDER_REQUEST_SUCCESS,
GET_PUTAWAY_CANDIDATES_REQUEST,
GET_PUTAWAY_CANDIDATES_REQUEST_SUCCESS,
PATCH_PUTAWAY_TASK_REQUEST,
PATCH_PUTAWAY_TASK_REQUEST_SUCCESS,
SUBMIT_PUTAWAY_ITEM_BIN_LOCATION,
SUBMIT_PUTAWAY_ITEM_BIN_LOCATION_SUCCESS
} from '../actions/putaways';
import { hideScreenLoading, showScreenLoading } from '../actions/main';
import * as api from '../../apis';
import {
GetPutAwaysApiResponse,
PostPutAwayItemApiResponse
} from '../../data/putaway/PutAway';
import { GetPutAwaysApiResponse, PostPutAwayItemApiResponse } from '../../data/putaway/PutAway';
import * as Sentry from '@sentry/react-native';

function* fetchPutAwayFromOrder(action: any) {
try {
yield put(showScreenLoading('Loading..'));
const response: GetPutAwaysApiResponse = yield call(
api.fetchPutAwayFromOrder,
action.payload.q
);
const response: GetPutAwaysApiResponse = yield call(api.fetchPutAwayFromOrder, action.payload.q);
yield put({
type: FETCH_PUTAWAY_FROM_ORDER_REQUEST_SUCCESS,
payload: response.data
Expand Down Expand Up @@ -94,8 +90,28 @@ function* createPutawayOder(action: any) {
} catch (error) {
yield put(hideScreenLoading());
yield action.callback({
errorMessage: error.message,
error: true
error: true,
errorMessage: error.message
});
}
}

function* patchPutawayTask(action: any) {
try {
yield put(showScreenLoading('Submitting...'));
const { facilityId, putawayItemId, payload } = action.payload;
const response = yield call(api.patchPutawayTask, facilityId, putawayItemId, payload);
yield put({
type: PATCH_PUTAWAY_TASK_REQUEST_SUCCESS,
payload: response.data
});
yield put(hideScreenLoading());
yield action.callback({ success: true, data: response.data });
} catch (error) {
yield put(hideScreenLoading());
yield action.callback({
error: true,
errorMessage: error.message
});
}
}
Expand All @@ -105,4 +121,5 @@ export default function* watcher() {
yield takeLatest(GET_PUTAWAY_CANDIDATES_REQUEST, getCandidates);
yield takeLatest(CREATE_PUTAWAY_ORDER_REQUEST, createPutawayOder);
yield takeLatest(SUBMIT_PUTAWAY_ITEM_BIN_LOCATION, submitPutawayItem);
yield takeLatest(PATCH_PUTAWAY_TASK_REQUEST, patchPutawayTask);
}
1 change: 1 addition & 0 deletions src/redux/selectors/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const userLocation = (state: any) => state.mainReducer.currentLocation
8 changes: 8 additions & 0 deletions src/screens/Dashboard/dashboardData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import IconProducts from '../../assets/images/icon_products.svg';
import IconPutawayCandidates from '../../assets/images/icon_putaway_candidates.svg';
import IconReceiving from '../../assets/images/icon_receiving.svg';
import IconScan from '../../assets/images/icon_scan.svg';
import IconSortation from '../../assets/images/icon_sortation.svg';

export type DashboardEntry = {
key: string;
Expand All @@ -20,6 +21,13 @@ export type DashboardEntry = {
};

const dashboardEntries: DashboardEntry[] = [
{
key: 'sortation',
screenName: 'Sortation',
entryDescription: 'Manage sortation tasks and workflows',
icon: IconSortation,
navigationScreenName: 'Sortation'
},
{
key: 'picking',
screenName: 'Picking',
Expand Down
Loading