Identifies, classifies, and resolves problematic shipment receipts through barcode validation, quantity variance analysis, location verification, and damage assessment.
Execute the barcode validation protocol by calling validateBarcode with the po_number, confirmed_product_id, and received_product_bar_code (file path to the barcode image). If barcode_match is False, the product is a "Wrong Item" — set resolution_status to "Returned to Vendor" and skip directly to Step 7 (Problem Classification Report) with problem_type set to ["Wrong Item"]. If the barcode matches, proceed to Step 2.
Call calculateQuantityVariance with po_number, ordered_quantity, confirmed_quantity, received_quantity, and QVT (Quantity Variance Threshold, default 5.0 if not provided). Record the returned quantity_variance, problem_type list, and chargeable status. The tool classifies quantity discrepancies: "Cancelled Quantity" (confirmed_quantity=0), "Overage Quantity" (received > ordered), "Underage Quantity" (received < ordered), and "Severe Unmatched Quantity" (variance exceeds QVT).
Call verifyWarehouseLocation with po_number, intended_warehouse_id, and actual_warehouse_id. If location_match is False, add "Wrong Warehouse" to the accumulated problem_type list.
Call assessPackageCondition with po_number and package_image_path. If package_condition is "damaged", add "Vendor Damaged" to the accumulated problem_type list.
Call calculateChargeback with po_number, the accumulated problem_type list, ordered_quantity, received_quantity, and unit_cost. Record the chargeable status and charge_amount.
First check the accumulated problem_type list. If no problems were found (the list is empty), set resolution_status to "Resolved" and skip calling the tool. Otherwise, call updateResolutionStatus with po_number, the accumulated problem_type list, and current_status set to "Pending", and use the returned resolution_status.
Call generateProblemReport with po_number, vendor_id, vendor_name, the accumulated problem_type list, charge_amount (from Step 5, or 0.0 if skipped due to Wrong Item), and resolution_status. Output the final resolution_status value.