From a7a5e8926f9e5eb1fd7de4d6242e3ea7df858741 Mon Sep 17 00:00:00 2001 From: adambalcerzak Date: Thu, 3 Sep 2026 11:09:35 +0200 Subject: [PATCH 1/2] OBLS-507 Do not display move to staging when track internal transactions disabled for location --- src/data/location/Location.ts | 1 + src/screens/Picking/PickingContext.tsx | 24 +++++++++++- src/screens/Picking/PickingMoveToStaging.tsx | 12 +++++- .../PickingPickOutboundContainerScreen.tsx | 18 +++++++-- .../Picking/PickingPickQuantityScreen.tsx | 17 +++++++-- src/screens/Picking/lib.ts | 37 +++++++++++++++++-- 6 files changed, 98 insertions(+), 11 deletions(-) diff --git a/src/data/location/Location.ts b/src/data/location/Location.ts index be8607df..3c04070c 100644 --- a/src/data/location/Location.ts +++ b/src/data/location/Location.ts @@ -16,6 +16,7 @@ interface Location { hasBinLocationSupport: boolean; hasPackingSupport: boolean; hasPartialReceivingSupport: boolean; + hasInternalTransactionSupport: boolean; locationType: LocationType; locationNumber: string; isDisplay: boolean; diff --git a/src/screens/Picking/PickingContext.tsx b/src/screens/Picking/PickingContext.tsx index 83dafdce..f973d002 100644 --- a/src/screens/Picking/PickingContext.tsx +++ b/src/screens/Picking/PickingContext.tsx @@ -70,6 +70,8 @@ type PickingContextType = { revalidateCurrentTask: (callback?: (task: PickTask | undefined) => void) => void; /** Advances to the next task in the list */ goToNextTask: () => void; + /** Whether the move-to-staging step should be skipped because the pick task's facility does not track internal transactions */ + skipStagingStep: boolean; }; const PickingContext = React.createContext(undefined); @@ -82,6 +84,8 @@ export function PickingProvider({ children }: { children: React.ReactNode }) { const homeRoute = HOME_ROUTE_BY_ENTRY_POINT[entryPoint]; const allTasksCount = tasks.length; const currentTask = allTasksCount > 0 && currentTaskIndex < allTasksCount ? tasks[currentTaskIndex] : undefined; + // Move to staging only applies to facilities that track internal transactions. + const skipStagingStep = currentTask?.facility?.hasInternalTransactionSupport === false; const startSession = async (deliveryType: DeliveryType, ordersCount: number): Promise => { setEntryPoint('BATCH'); @@ -220,6 +224,23 @@ export function PickingProvider({ children }: { children: React.ReactNode }) { return; } + if (skipStagingStep) { + Alert.alert( + 'No Additional Tasks', + 'No new pick tasks were created. This location does not track internal transactions, so staging is not required.', + [ + { + text: 'OK', + onPress: () => { + resetSession(); + resetToRoutes([{ name: 'Drawer', params: { screen: 'Dashboard' } }, { name: homeRoute }]); + } + } + ] + ); + return; + } + Alert.alert('No Additional Tasks', 'No new pick tasks were created. Proceeding to staging location drop.', [ { text: 'OK', @@ -317,7 +338,8 @@ export function PickingProvider({ children }: { children: React.ReactNode }) { dropCurrentTask, dropCurrentTaskAtStagingLocation, revalidateCurrentTask, - goToNextTask + goToNextTask, + skipStagingStep }} > {children} diff --git a/src/screens/Picking/PickingMoveToStaging.tsx b/src/screens/Picking/PickingMoveToStaging.tsx index 84820361..83465475 100644 --- a/src/screens/Picking/PickingMoveToStaging.tsx +++ b/src/screens/Picking/PickingMoveToStaging.tsx @@ -31,8 +31,18 @@ export default function PickingMoveToStagingScreen() { return; } + // Tasks whose facility does not track internal transactions don't need to be staged. + const stagingEligibleTasks = response.data.filter( + (task) => task.facility?.hasInternalTransactionSupport !== false + ); + + if (stagingEligibleTasks.length === 0) { + Alert.alert('Staging Not Required', 'The picked items for this container do not require a move to staging.'); + return; + } + // Navigate to the staging screen with the fetched tasks - navigate('PickingStagingDrop', { tasks: response.data }); + navigate('PickingStagingDrop', { tasks: stagingEligibleTasks }); }) ); diff --git a/src/screens/Picking/PickingPickOutboundContainerScreen.tsx b/src/screens/Picking/PickingPickOutboundContainerScreen.tsx index 27dbc6ad..2706fef3 100644 --- a/src/screens/Picking/PickingPickOutboundContainerScreen.tsx +++ b/src/screens/Picking/PickingPickOutboundContainerScreen.tsx @@ -31,7 +31,9 @@ export default function PickingPickOutboundContainerScreen() { revalidateCurrentTask, goToNextTask, revalidateTasksForRequisition, - homeRoute + homeRoute, + skipStagingStep, + resetSession } = usePickingContext(); const { params } = useRoute(); const parsedQuantityPicked = params?.quantityPicked ? Number(params.quantityPicked) : undefined; @@ -79,7 +81,9 @@ export default function PickingPickOutboundContainerScreen() { allTasksCount, goToNextTask, homeRoute, - omitStagingLocationStep + omitStagingLocationStep, + skipStagingStep, + resetSession }); } }, @@ -95,7 +99,15 @@ export default function PickingPickOutboundContainerScreen() { return; } - revalidateTaskAndProceed({ revalidateCurrentTask, currentTaskIndex, allTasksCount, goToNextTask, homeRoute }); + revalidateTaskAndProceed({ + revalidateCurrentTask, + currentTaskIndex, + allTasksCount, + goToNextTask, + homeRoute, + skipStagingStep, + resetSession + }); }); setOutboundContainerId(EMPTY_STRING); diff --git a/src/screens/Picking/PickingPickQuantityScreen.tsx b/src/screens/Picking/PickingPickQuantityScreen.tsx index 723ba768..ea161d41 100644 --- a/src/screens/Picking/PickingPickQuantityScreen.tsx +++ b/src/screens/Picking/PickingPickQuantityScreen.tsx @@ -19,8 +19,17 @@ import { usePickingContext } from './PickingContext'; import styles from './styles'; export default function PickingPickQuantityScreen() { - const { tasks, currentTask, currentTaskIndex, allTasksCount, shortPickTask, goToNextTask, homeRoute } = - usePickingContext(); + const { + tasks, + currentTask, + currentTaskIndex, + allTasksCount, + shortPickTask, + goToNextTask, + homeRoute, + skipStagingStep, + resetSession + } = usePickingContext(); const dispatch = useDispatch(); const isFocused = useIsFocused(); @@ -111,7 +120,9 @@ export default function PickingPickQuantityScreen() { allTasksCount, goToNextTask, homeRoute, - omitStagingLocationStep + omitStagingLocationStep, + skipStagingStep, + resetSession }); }, reasonCode?.name diff --git a/src/screens/Picking/lib.ts b/src/screens/Picking/lib.ts index 1892a6d5..01c6d57a 100644 --- a/src/screens/Picking/lib.ts +++ b/src/screens/Picking/lib.ts @@ -9,6 +9,9 @@ type PickingFlowNavigation = { /** Screen the session started from, reset to when it ends so finished screens are unreachable */ homeRoute: string; omitStagingLocationStep?: boolean; + /** Whether the move-to-staging step should be skipped because the facility does not track internal transactions */ + skipStagingStep?: boolean; + resetSession?: () => void; }; function returnHome(homeRoute: string) { @@ -33,7 +36,9 @@ export function proceedToNextOrComplete({ allTasksCount, goToNextTask, homeRoute, - omitStagingLocationStep + omitStagingLocationStep, + skipStagingStep, + resetSession }: PickingFlowNavigation) { if (currentTaskIndex + 1 < allTasksCount) { goToNextTask(); @@ -46,6 +51,23 @@ export function proceedToNextOrComplete({ return; } + if (skipStagingStep) { + Alert.alert( + 'All Picks Complete', + 'You have completed all picks. This location does not track internal transactions, so staging is not required.', + [ + { + text: 'OK', + onPress: () => { + resetSession?.(); + returnHome(homeRoute); + } + } + ] + ); + return; + } + Alert.alert('All Picks Complete', 'You have completed all picks. Proceeding to staging location drop.', [ { text: 'OK', @@ -65,7 +87,9 @@ export function revalidateTaskAndProceed({ allTasksCount, goToNextTask, homeRoute, - omitStagingLocationStep + omitStagingLocationStep, + skipStagingStep, + resetSession }: PickingFlowNavigation & { revalidateCurrentTask: (callback: (revalidatedTask: PickTask | undefined) => void) => void; }) { @@ -82,6 +106,13 @@ export function revalidateTaskAndProceed({ return; } - proceedToNextOrComplete({ currentTaskIndex, allTasksCount, goToNextTask, homeRoute }); + proceedToNextOrComplete({ + currentTaskIndex, + allTasksCount, + goToNextTask, + homeRoute, + skipStagingStep, + resetSession + }); }); } From f57eebe37f403df26d96e650fa55356504a9e4ca Mon Sep 17 00:00:00 2001 From: adambalcerzak Date: Thu, 3 Sep 2026 16:09:25 +0200 Subject: [PATCH 2/2] OBLS-507 Do not display move to staging when track internal transactions disabled for location --- src/data/location/Location.ts | 1 - src/screens/Picking/PickingContext.tsx | 2 +- src/screens/Picking/PickingMoveToStaging.tsx | 4 +--- src/types/picking.ts | 2 ++ 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/data/location/Location.ts b/src/data/location/Location.ts index 3c04070c..be8607df 100644 --- a/src/data/location/Location.ts +++ b/src/data/location/Location.ts @@ -16,7 +16,6 @@ interface Location { hasBinLocationSupport: boolean; hasPackingSupport: boolean; hasPartialReceivingSupport: boolean; - hasInternalTransactionSupport: boolean; locationType: LocationType; locationNumber: string; isDisplay: boolean; diff --git a/src/screens/Picking/PickingContext.tsx b/src/screens/Picking/PickingContext.tsx index f973d002..029a9339 100644 --- a/src/screens/Picking/PickingContext.tsx +++ b/src/screens/Picking/PickingContext.tsx @@ -85,7 +85,7 @@ export function PickingProvider({ children }: { children: React.ReactNode }) { const allTasksCount = tasks.length; const currentTask = allTasksCount > 0 && currentTaskIndex < allTasksCount ? tasks[currentTaskIndex] : undefined; // Move to staging only applies to facilities that track internal transactions. - const skipStagingStep = currentTask?.facility?.hasInternalTransactionSupport === false; + const skipStagingStep = currentTask?.internalTransactionsEnabled === false; const startSession = async (deliveryType: DeliveryType, ordersCount: number): Promise => { setEntryPoint('BATCH'); diff --git a/src/screens/Picking/PickingMoveToStaging.tsx b/src/screens/Picking/PickingMoveToStaging.tsx index 83465475..9dc20b88 100644 --- a/src/screens/Picking/PickingMoveToStaging.tsx +++ b/src/screens/Picking/PickingMoveToStaging.tsx @@ -32,9 +32,7 @@ export default function PickingMoveToStagingScreen() { } // Tasks whose facility does not track internal transactions don't need to be staged. - const stagingEligibleTasks = response.data.filter( - (task) => task.facility?.hasInternalTransactionSupport !== false - ); + const stagingEligibleTasks = response.data.filter((task) => task.internalTransactionsEnabled !== false); if (stagingEligibleTasks.length === 0) { Alert.alert('Staging Not Required', 'The picked items for this container do not require a move to staging.'); diff --git a/src/types/picking.ts b/src/types/picking.ts index 269cbb70..ec27553c 100644 --- a/src/types/picking.ts +++ b/src/types/picking.ts @@ -58,6 +58,8 @@ export type PickTask = { deliveryTypeCode?: DeliveryTypeCode; facility?: Location; + /** Whether the task's facility tracks internal transactions (mirrors facility.supports(TRACK_INTERNAL_TRANSACTIONS)) */ + internalTransactionsEnabled?: boolean; location?: Location; outboundContainer?: Container | null; stagingLocation?: Location | null;