Scan Order from the Crossdesk360
Step:1 Login to crossdesk360 and move to the Crossdesk Side menu and then go to the Packaging Sub menu and click on the Pre-Packing menu.
Step:2 Select the Option
Step:3 Scan the Barcode of the product and you will see the interface like this with order details as below image.
Backend Service Overview:
The backend service is responsible for handling the logic related to retrieving parceling and order information based on the barcode scan input. The service takes in two parameters from the frontend: a string identifier (barcode) and an integer warehouseId, and returns data about the order details, parceling information, carrier list, and associated customers.
Backend Process
- Parameter Reception:
- The service receives two parameters:
- identifier (string): A unique identifier that could either be a box number or product code.
- warehouseId (int): The ID of the warehouse associated with the order.
- The service receives two parameters:
- Identifier Check:
- The identifier parameter is checked to determine if it represents a box number or a product code:
- If the identifier starts with “BAC_”, it is treated as a box number.
- Otherwise, it is considered a product code.
- The identifier parameter is checked to determine if it represents a box number or a product code:
- Order Retrieval:
- Based on whether the identifier is a box number or product code, the backend retrieves the associated order details:
- Box Number (BAC_ identifier): The backend calls GetOrderDetailByBoxNumberAsync to fetch the order detail for the given box number.
- Product Code: A query is made using the GetOrderDetailByProductCodeAsync method to retrieve a list of order details for the product code and warehouse ID.
- If no order details are found for either case, the service responds with an error message indicating that the product is not being packed or the tray is not being packed yet.
- Based on whether the identifier is a box number or product code, the backend retrieves the associated order details:
- Order Locking Mechanism:
- For products, the service checks if the order is locked by calling GetOrderDetailWithLockAsync. This ensures that the order is not being processed by another user simultaneously. It also checks for critical locks and avoids concurrent processing of the same product.
- Parceling Data Retrieval:
- Once valid order details are fetched, the service calls GetParcelingAsync to retrieve parceling data associated with the order.
- The parceling data includes information such as product variants, packaging details, and quantities.
- Customer and Carrier Information:
- The service retrieves associated customer data using GetParcelingCustomerAsync, which returns customer details linked to the order.
- Additionally, it fetches the carrier list using GetCarrierAsync, providing information about available carriers for the order.
- Data Grouping and Structuring:
- The backend groups the data into structured entities:
- Grouped Customers: The GetGroupedCustomers method groups customer information based on customer ID, code, and name, along with their packaging types.
- Grouped Order Lines: The GetGroupedOrderLines method groups order lines based on product details (e.g., product code, ID, name, barcode, etc.) and associates product variants and picking lot information.
- The backend groups the data into structured entities:
- Response Construction:
- The final result is an instance of GetParcelingOrderInformationResult, which includes:
- Order details such as the order number, carrier name, and order nature.
- Grouped customer information, parceling details, and carrier list.
- This result is returned as a successful response.
- The final result is an instance of GetParcelingOrderInformationResult, which includes:
- Error Handling:
- Throughout the process, errors are handled gracefully:
- Failure to fetch order details or lock the order returns descriptive error messages.
- Internal errors during database operations are caught and reported with a failure result.
Method Breakdown
- GetParcelingOrderInformationAsync(string identifier, int warehouseId): The main method that orchestrates the process, retrieving and returning the parceling information.
- GetParcelingAsync(string orderNumber, int customerId): Fetches the parceling data for a given order.
- GetCarrierAsync(int customerId): Retrieves the carrier list for the customer.
- GetParcelingCustomerAsync(int customerId): Fetches customer-related parceling data.
- GetOrderDetailWithLockAsync(List<OrderDetail> orderDetails): Handles the locking mechanism to ensure exclusive access to an order during processing.
- GetOrderDetailByBoxNumberAsync(string boxNumber): Retrieves the order details based on the box number.
- GetOrderDetailByProductCodeAsync(string productCode, int warehouseId): Fetches order details for the given product code and warehouse.
- LockRecordAsync(LockRecord lockRecord): Inserts a lock record into the database to ensure exclusive access to the order.
- IsIdentifiantBac(string identifiant): Checks if the identifier corresponds to a box number.
- GetGroupedCustomers(List<ParcelingCustomer> parcelingCustomers): Groups customer information by customer ID, code, and name.
- GetGroupedOrderLines(List<Parceling> parceling): Groups the order lines based on product details and aggregates related information.
Estimated Time Taken by Service Breakout:
Time taken by the GetOrderDetailByProductCodeAsync Method 16
Time taken by the GetOrderDetailWithLockAsync Method 144
Time taken by the GetParcelingAsync Method 4
Time taken by the GetParcelingCustomerAsync Method 4
Time taken by the GetCarrierAsync Method 9.