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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from public_api.public_api_item import get_item
|
| 2 |
+
from public_api.utils import humanize_value, translate_velocity, format_hold_type, format_reason_code, format_backend_date, translate_loc_sts
|
| 3 |
+
from public_api.public_api_inventory import get_inventory_holds
|
| 4 |
+
from public_api.public_api_location import get_location_status
|
| 5 |
+
# field_mapping.py
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
##################################################################
|
| 9 |
+
# --- A. Define your translations ---
|
| 10 |
+
|
| 11 |
+
# Helper for simple flags
|
| 12 |
+
#def boolean_to_yesno(val):
|
| 13 |
+
# return "Yes" if val is True else "No"
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
# --- B. Your Configuration Maps ---
|
| 18 |
+
|
| 19 |
+
# 1. Which fields do you want? (Display Name -> JSON Path)
|
| 20 |
+
ITEM_MAPPING = {
|
| 21 |
+
"Item": "itemNumber",
|
| 22 |
+
|
| 23 |
+
"Ignore Pick Consolidation Flag":"itemPickingConfiguration.ignorePickConsolidationFlag",
|
| 24 |
+
"Threshold Pick Variance":"itemPickingConfiguration.thresholdPickVariance",
|
| 25 |
+
|
| 26 |
+
"Color":"color",
|
| 27 |
+
|
| 28 |
+
"Supplier Lot Flag":"itemAttributes.supplierLotFlag",
|
| 29 |
+
#"Lot Format ID":"itemAttributes.lotFormatId",
|
| 30 |
+
"Lot Flag":"itemAttributes.lotFlag",
|
| 31 |
+
"Revision Flag":"itemAttributes.revisionFlag",
|
| 32 |
+
"Origin Flag":"itemAttributes.originFlag",
|
| 33 |
+
"Ship Restricted Lot Flag":"itemAttributes.shipRestrictedLotFlag",
|
| 34 |
+
|
| 35 |
+
"Item Class Name":"itemClassName",
|
| 36 |
+
"Department Code":"departmentCode",
|
| 37 |
+
"Description": "description",
|
| 38 |
+
"Item type":"type",
|
| 39 |
+
|
| 40 |
+
"Commodity Code":"itemTransportation.commodityCode",
|
| 41 |
+
"Is Hazardous": "itemTransportation.hazardousMaterialFlag", # Needs translation
|
| 42 |
+
|
| 43 |
+
"Report UoM":"reportUom",
|
| 44 |
+
"Fit":"fit",
|
| 45 |
+
"Aging Profile Name":"itemDateControl.agingProfileName",
|
| 46 |
+
"Date Window Value":"itemDateControl.dateWindowValue",
|
| 47 |
+
"Shelf Life Time Code":"itemDateControl.shelfLifeTimeCode",
|
| 48 |
+
"Date Code":"itemDateControl.dateCode",
|
| 49 |
+
"Time To Warn For Expiration":"itemDateControl.timeToWarnForExpiration",
|
| 50 |
+
"Date Window Time Code":"itemDateControl.dateWindowTimeCode",
|
| 51 |
+
"Shelf Life":"itemDateControl.shelfLife",
|
| 52 |
+
"Date Window Type":"itemDateControl.dateWindowType",
|
| 53 |
+
|
| 54 |
+
"Conveyable Flag":"conveyableFlag",
|
| 55 |
+
"Count Near Zero Amount":"itemCountingConfiguration.countNearZeroAmount",
|
| 56 |
+
"Adjustment Flag":"itemCountingConfiguration.adjustmentFlag",
|
| 57 |
+
"Count Back Flag":"itemCountingConfiguration.countBackFlag",
|
| 58 |
+
"Count Near Zero Flag":"itemCountingConfiguration.countNearZeroFlag",
|
| 59 |
+
"Count Threshold Unit":"itemCountingConfiguration.countThresholdUnit",
|
| 60 |
+
"Count Threshold Cost":"itemCountingConfiguration.countThresholdCost",
|
| 61 |
+
|
| 62 |
+
"Maximum Extreme Tolerance":"catchConfiguration.maximumExtremeTolerance",
|
| 63 |
+
"Catch Unit Type":"catchConfiguration.catchUnitType",
|
| 64 |
+
"Maximum Item Tolerance":"catchConfiguration.maximumItemTolerance",
|
| 65 |
+
"Minimum Item Tolerance":"catchConfiguration.minimumItemTolerance",
|
| 66 |
+
"Average Catch Capture":"catchConfiguration.averageCatchCapture",
|
| 67 |
+
"Skip Prompt":"catchConfiguration.skipPrompt",
|
| 68 |
+
"Minimum Extreme Tolerance":"catchConfiguration.minimumExtremeTolerance",
|
| 69 |
+
"Catch Unit Weight":"catchConfiguration.catchUnitWeight",
|
| 70 |
+
"Catch Code":"catchConfiguration.catchCode",
|
| 71 |
+
"Catch Unit Cost":"catchConfiguration.catchUnitCost",
|
| 72 |
+
|
| 73 |
+
"Weight Code":"weightCode",
|
| 74 |
+
"Item Hierarchy Name":"itemHierarchyName",
|
| 75 |
+
|
| 76 |
+
"Receive Flag":"itemReceivingConfiguration.receiveFlag",
|
| 77 |
+
"Receive Status":"itemReceivingConfiguration.receiveStatus",
|
| 78 |
+
"Item Client ID":"itemClientId",
|
| 79 |
+
"ABC Code":"abcCode",
|
| 80 |
+
"Unit Cost":"itemCost.unitCost",
|
| 81 |
+
"Currency Code":"itemCost.currencyCode",
|
| 82 |
+
"Replace Pick Flag":"itemPutawayConfiguration.replacePickFlag",
|
| 83 |
+
"Opportunistic Cross Dock Flag":"itemPutawayConfiguration.opportunisticCrossDockFlag",
|
| 84 |
+
"Is Default Footprint":"footprints.0.isDefaultFootprint",
|
| 85 |
+
"Level Units":"footprints.0.levelUnits",
|
| 86 |
+
"Footprint Code":"footprints.0.footprintCode",
|
| 87 |
+
"Default LPN Attribute 1":"footprints.0.defaultLpnAttribute1",
|
| 88 |
+
"Default LPN Attribute 2":"footprints.0.defaultLpnAttribute2",
|
| 89 |
+
"Default LPN Attribute 5":"footprints.0.defaultLpnAttribute5",
|
| 90 |
+
#pallet
|
| 91 |
+
"Pallet UoM Code":"footprints.0.footprintDetails.0.uomCode",
|
| 92 |
+
"Is Pallet Stocking UoM":"footprints.0.footprintDetails.0.isStockingUom",
|
| 93 |
+
"Pallet Length":"footprints.0.footprintDetails.0.length",
|
| 94 |
+
"Pallet UoM Level":"footprints.0.footprintDetails.0.uomLevel",
|
| 95 |
+
"Pallet Net Weight":"footprints.0.footprintDetails.0.netWeight",
|
| 96 |
+
"Pallet Gross Weight":"footprints.0.footprintDetails.0.grossWeight",
|
| 97 |
+
"Is Pallet Default Receiving UoM":"footprints.0.footprintDetails.0.isDefaultReceivingUom",
|
| 98 |
+
"Pallet Unit Quantity":"footprints.0.footprintDetails.0.unitQuantity",
|
| 99 |
+
"Pallet Width":"footprints.0.footprintDetails.0.width",
|
| 100 |
+
"Is Pallet UoM":"footprints.0.footprintDetails.0.isPalletUom",
|
| 101 |
+
"Is Pallet Package UoM":"footprints.0.footprintDetails.0.isPackageUom",
|
| 102 |
+
"Is Pallet Case UoM":"footprints.0.footprintDetails.0.isCaseUom",
|
| 103 |
+
"Is Pallet Layer UoM":"footprints.0.footprintDetails.0.isLayerUom",
|
| 104 |
+
"Pallet Height":"footprints.0.footprintDetails.0.height",
|
| 105 |
+
#each
|
| 106 |
+
"Each UoM Code":"footprints.0.footprintDetails.1.uomCode",
|
| 107 |
+
"Is Each Stocking UoM":"footprints.0.footprintDetails.1.isStockingUom",
|
| 108 |
+
"Each Length":"footprints.0.footprintDetails.1.length",
|
| 109 |
+
"Each UoM Level":"footprints.0.footprintDetails.1.uomLevel",
|
| 110 |
+
"Each Net Weight":"footprints.0.footprintDetails.1.netWeight",
|
| 111 |
+
"Each Gross Weight":"footprints.0.footprintDetails.1.grossWeight",
|
| 112 |
+
"Is Each Default Receiving UoM":"footprints.0.footprintDetails.1.isDefaultReceivingUom",
|
| 113 |
+
"Each Unit Quantity":"footprints.0.footprintDetails.1.unitQuantity",
|
| 114 |
+
"Each Width":"footprints.0.footprintDetails.1.width",
|
| 115 |
+
"Is Each UoM":"footprints.0.footprintDetails.1.isPalletUom",
|
| 116 |
+
"Is Each Package UoM":"footprints.0.footprintDetails.1.isPackageUom",
|
| 117 |
+
"Is Each Case UoM":"footprints.0.footprintDetails.1.isCaseUom",
|
| 118 |
+
"Is Each Layer UoM":"footprints.0.footprintDetails.1.isLayerUom",
|
| 119 |
+
"Each Height":"footprints.0.footprintDetails.1.height",
|
| 120 |
+
#case
|
| 121 |
+
"Case UoM Code":"footprints.0.footprintDetails.2.uomCode",
|
| 122 |
+
"Is Case Stocking UoM":"footprints.0.footprintDetails.2.isStockingUom",
|
| 123 |
+
"Case Length":"footprints.0.footprintDetails.2.length",
|
| 124 |
+
"Case UoM Level":"footprints.0.footprintDetails.2.uomLevel",
|
| 125 |
+
"Case Net Weight":"footprints.0.footprintDetails.2.netWeight",
|
| 126 |
+
"Case Gross Weight":"footprints.0.footprintDetails.2.grossWeight",
|
| 127 |
+
"Is Case Default Receiving UoM":"footprints.0.footprintDetails.2.isDefaultReceivingUom",
|
| 128 |
+
"Case Unit Quantity":"footprints.0.footprintDetails.2.unitQuantity",
|
| 129 |
+
"Case Width":"footprints.0.footprintDetails.2.width",
|
| 130 |
+
"Is Case UoM":"footprints.0.footprintDetails.2.isPalletUom",
|
| 131 |
+
"Is Case Package UoM":"footprints.0.footprintDetails.2.isPackageUom",
|
| 132 |
+
"Is Case Case UoM":"footprints.0.footprintDetails.2.isCaseUom",
|
| 133 |
+
"Is Case Layer UoM":"footprints.0.footprintDetails.2.isLayerUom",
|
| 134 |
+
"Case Height":"footprints.0.footprintDetails.2.height",
|
| 135 |
+
"Description":"footprints.0.description",
|
| 136 |
+
"Case Level":"footprints.0.caseLevel",
|
| 137 |
+
"Default Lpn Attribute 3":"footprints.0.defaultLpnAttribute3",
|
| 138 |
+
"Default Lpn Attribute 4":"footprints.0.defaultLpnAttribute4",
|
| 139 |
+
"Default Handling Unit":"footprints.0.defaultHandlingUnit",
|
| 140 |
+
|
| 141 |
+
"Assorted Flag":"assortedFlag",
|
| 142 |
+
|
| 143 |
+
#"Warehouse ID":"itemId.warehouseId",
|
| 144 |
+
#"Item Number":"itemId.itemNumber",
|
| 145 |
+
#"Item Client ID":"itemId.itemClientId",
|
| 146 |
+
|
| 147 |
+
"Size":"size",
|
| 148 |
+
"Warehouse ID": "warehouseId",
|
| 149 |
+
"Delay Outbound Serial Capture Flag":"itemSerialization.delayOutboundSerialCaptureFlag",
|
| 150 |
+
"Serialization Level":"itemSerialization.serializationLevel",
|
| 151 |
+
"Serialization Type":"itemSerialization.serializationType",
|
| 152 |
+
"Style":"style",
|
| 153 |
+
|
| 154 |
+
"Velocity Zone Code": "itemVelocity.velocityZoneCode", # Needs translation
|
| 155 |
+
"Velocity Zone Recalculation Flag": "itemVelocity.velocityZoneRecalculationFlag", # Often Null
|
| 156 |
+
"Load Level":"loadLevel",
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
# 2. How should they look? (Display Name -> Transformer Function)
|
| 160 |
+
ITEM_FORMATTERS = {
|
| 161 |
+
"Ignore Pick Consolidation Flag":humanize_value,
|
| 162 |
+
"Color":humanize_value,
|
| 163 |
+
"Supplier Lot Flag":humanize_value,
|
| 164 |
+
#"Lot Format ID":"humanize_value,
|
| 165 |
+
"Lot Flag":humanize_value,
|
| 166 |
+
"Revision Flag":humanize_value,
|
| 167 |
+
"Origin Flag":humanize_value,
|
| 168 |
+
"Ship Restricted Lot Flag":humanize_value,
|
| 169 |
+
"Item Class Name":humanize_value,
|
| 170 |
+
"Department Code":humanize_value,
|
| 171 |
+
"Commodity Code":humanize_value,
|
| 172 |
+
"Is Hazardous":humanize_value,
|
| 173 |
+
"Report UoM":humanize_value,
|
| 174 |
+
"Fit":humanize_value,
|
| 175 |
+
"Aging Profile Name":humanize_value,
|
| 176 |
+
"Shelf Life":humanize_value,
|
| 177 |
+
"Date Window Type":humanize_value,
|
| 178 |
+
"Conveyable Flag":humanize_value,
|
| 179 |
+
"Count Near Zero Amount":humanize_value,
|
| 180 |
+
"Adjustment Flag":humanize_value,
|
| 181 |
+
"Count Back Flag":humanize_value,
|
| 182 |
+
"Count Near Zero Flag":humanize_value,
|
| 183 |
+
"Maximum Extreme Tolerance":humanize_value,
|
| 184 |
+
"Catch Unit Type":humanize_value,
|
| 185 |
+
"Maximum Item Tolerance":humanize_value,
|
| 186 |
+
"Minimum Item Tolerance":humanize_value,
|
| 187 |
+
"Average Catch Capture":humanize_value,
|
| 188 |
+
"Skip Prompt":humanize_value,
|
| 189 |
+
"Minimum Extreme Tolerance":humanize_value,
|
| 190 |
+
"Catch Unit Weight":humanize_value,
|
| 191 |
+
"Catch Unit Cost":humanize_value,
|
| 192 |
+
"Weight Code":humanize_value,
|
| 193 |
+
"Item Hierarchy Name":humanize_value,
|
| 194 |
+
"Receive Flag":humanize_value,
|
| 195 |
+
#"ABC Code":"abcCode",
|
| 196 |
+
"Replace Pick Flag":humanize_value,
|
| 197 |
+
"Opportunistic Cross Dock Flag":humanize_value,
|
| 198 |
+
"Is Default Footprint":humanize_value,
|
| 199 |
+
"Default LPN Attribute 1":humanize_value,
|
| 200 |
+
"Default LPN Attribute 2":humanize_value,
|
| 201 |
+
"Default LPN Attribute 5":humanize_value,
|
| 202 |
+
#pallet
|
| 203 |
+
"Is Pallet Stocking UoM":humanize_value,
|
| 204 |
+
"Is Pallet Default Receiving UoM":humanize_value,
|
| 205 |
+
"Is Pallet UoM":humanize_value,
|
| 206 |
+
"Is Pallet Package UoM":humanize_value,
|
| 207 |
+
"Is Pallet Case UoM":humanize_value,
|
| 208 |
+
"Is Pallet Layer UoM":humanize_value,
|
| 209 |
+
#each
|
| 210 |
+
"Is Each Stocking UoM":humanize_value,
|
| 211 |
+
"Is Each Default Receiving UoM":humanize_value,
|
| 212 |
+
"Is Each UoM":humanize_value,
|
| 213 |
+
"Is Each Package UoM":humanize_value,
|
| 214 |
+
"Is Each Case UoM":humanize_value,
|
| 215 |
+
"Is Each Layer UoM":humanize_value,
|
| 216 |
+
#case
|
| 217 |
+
"Is Case Stocking UoM":humanize_value,
|
| 218 |
+
"Is Case Default Receiving UoM":humanize_value,
|
| 219 |
+
"Is Case UoM":humanize_value,
|
| 220 |
+
"Is Case Package UoM":humanize_value,
|
| 221 |
+
"Is Case Case UoM":humanize_value,
|
| 222 |
+
"Is Case Layer UoM":humanize_value,
|
| 223 |
+
#"Case Level":"footprints.0.caseLevel",
|
| 224 |
+
"Default Lpn Attribute 3":humanize_value,
|
| 225 |
+
"Default Lpn Attribute 4":humanize_value,
|
| 226 |
+
"Assorted Flag":humanize_value,
|
| 227 |
+
"Size": humanize_value,
|
| 228 |
+
"Delay Outbound Serial Capture Flag":humanize_value,
|
| 229 |
+
"Style":humanize_value,
|
| 230 |
+
"Velocity Zone Code": translate_velocity, # Needs translation
|
| 231 |
+
"Velocity Zone Recalculation Flag": humanize_value # Often Null
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
# field_mapping.py (Add this)
|
| 235 |
+
#ITEM_TOOL = {
|
| 236 |
+
# "name": "get_item_data",
|
| 237 |
+
# "description": "Get real-time warehouse data for a specific item or article number.",
|
| 238 |
+
# "parameters": {
|
| 239 |
+
# "type": "object",
|
| 240 |
+
# "properties": {
|
| 241 |
+
# "item_number": {
|
| 242 |
+
# "type": "string",
|
| 243 |
+
# "description": "The unique item number (e.g., '100002')"
|
| 244 |
+
# }
|
| 245 |
+
# },
|
| 246 |
+
# "required": ["item_number"]
|
| 247 |
+
# }
|
| 248 |
+
#}
|
| 249 |
+
|
| 250 |
+
ITEM_TOOL = {
|
| 251 |
+
"name": "get_item_data",
|
| 252 |
+
"description": ("Retrieve complete real-time warehouse master data for a specific item. "
|
| 253 |
+
"Use this for any queries regarding: "
|
| 254 |
+
"1. Item Attributes (Lot, Supplier, Revision, Receivable/Receive, Origin flags). "
|
| 255 |
+
"2. Picking & Putting Configuration (Consolidation, Thresholds, Cross-dock). "
|
| 256 |
+
"3. Dimensions & Footprints (Weights, Heights, and Lengths for Each, Case, or Pallets). "
|
| 257 |
+
"4. Date Controls (Shelf life, Aging profiles, and Expiration windows). "
|
| 258 |
+
"5. Counting & Tolerance settings (Near zero flags, Catch weights, and extreme tolerances). "
|
| 259 |
+
"6. Transportation & Safety (Hazardous material flags and Commodity codes)."),
|
| 260 |
+
"parameters": {
|
| 261 |
+
"type": "object",
|
| 262 |
+
"properties": {
|
| 263 |
+
"item_number": {"type": "string", "description": "The item ID (e.g. '100002')"},
|
| 264 |
+
#"warehouse_id": {"type": "string", "description": "Warehouse ID. Optional: if not provided, the system uses the user's default session warehouse."},
|
| 265 |
+
"fields": {
|
| 266 |
+
"type": "array",
|
| 267 |
+
"items": {"type": "string"},
|
| 268 |
+
"description": "The specific display names of the fields requested by the user (e.g., ['Supplier Lot Flag', 'Color'])."
|
| 269 |
+
}
|
| 270 |
+
},
|
| 271 |
+
"required": ["item_number"]
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
HOLD_MAPPING = {
|
| 277 |
+
#"Hold Number": "hldnum",
|
| 278 |
+
"Warehouse ID": "wh_id",
|
| 279 |
+
"Hold Type": "hldtyp",
|
| 280 |
+
"Item": "prtnum",
|
| 281 |
+
"Item Description": "dsp_prtnum",
|
| 282 |
+
"Hold Date": "hlddte",
|
| 283 |
+
"User ID": "hld_usr_id",
|
| 284 |
+
"Hold Reason Code": "reacod",
|
| 285 |
+
"LPN": "lodnum",
|
| 286 |
+
"Sub-LPN": "subnum",
|
| 287 |
+
"Detail-LPN": "dtlnum",
|
| 288 |
+
"Hold Quantity": "untqty"
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
"""
|
| 292 |
+
HOLD_TOOL = {
|
| 293 |
+
"name": "get_inventory_holds",
|
| 294 |
+
"description": "Get inventory hold details by LPN, Load, Sub-load, or Detail ID for a specific warehouse.",
|
| 295 |
+
"parameters": {
|
| 296 |
+
"type": "object",
|
| 297 |
+
"properties": {
|
| 298 |
+
"warehouse_id": {"type": "string", "description": "The warehouse ID to filter results (e.g., 'WH1')"},
|
| 299 |
+
"lodnum": {"type": "string", "description": "Inventory Load Number/LPN"},
|
| 300 |
+
"subnum": {"type": "string", "description": "Inventory Sub Load Number"},
|
| 301 |
+
"dtlnum": {"type": "string", "description": "Inventory Detail Number"},
|
| 302 |
+
#"lpn": {"type": "string", "description": "License Plate Number"}
|
| 303 |
+
},
|
| 304 |
+
"required": ["warehouse_id"]
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
"""
|
| 308 |
+
HOLD_FORMATTERS = {
|
| 309 |
+
"Hold Type": format_hold_type,
|
| 310 |
+
"Hold Reason Code": format_reason_code,
|
| 311 |
+
"Hold Date": format_backend_date
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
HOLD_TOOL = {
|
| 315 |
+
"name": "get_inventory_holds",
|
| 316 |
+
"description": (
|
| 317 |
+
"Retrieve inventory hold records for a warehouse. "
|
| 318 |
+
"Use this for ANY query about inventory holds, including: "
|
| 319 |
+
"1. Listing ALL holds in a warehouse (when no specific ID is provided). "
|
| 320 |
+
"2. Counting the number of hold LPN/inventory. "
|
| 321 |
+
"3. Checking a specific LPN, Sub-LPN, or Detail-LPN."
|
| 322 |
+
),
|
| 323 |
+
"parameters": {
|
| 324 |
+
"type": "object",
|
| 325 |
+
"properties": {
|
| 326 |
+
##"warehouse_id": {
|
| 327 |
+
## "type": "string",
|
| 328 |
+
## "description": "The warehouse ID. If the user does not specify one, use 'WH1' as the default."
|
| 329 |
+
##},
|
| 330 |
+
#"warehouse_id": {"type": "string", "description": "The warehouse ID (e.g., 'WH1'). Default to 'WH1' if not specified."},
|
| 331 |
+
"lodnum": {"type": "string", "description": "LPN/Inventory/Inventory ID (optional)"},
|
| 332 |
+
"subnum": {"type": "string", "description": "Sub-LPN (optional)"},
|
| 333 |
+
"dtlnum": {"type": "string", "description": "Detail-LPN (optional)"},
|
| 334 |
+
},
|
| 335 |
+
"required": []
|
| 336 |
+
}
|
| 337 |
+
}
|
| 338 |
+
|
| 339 |
+
LOCATION_STATUS_MAPPING = {
|
| 340 |
+
"Location": "stoloc",
|
| 341 |
+
"Location Status":"locsts"
|
| 342 |
+
}
|
| 343 |
+
|
| 344 |
+
LOCATION_STATUS_FORMATTERS = {
|
| 345 |
+
"Location Status": translate_loc_sts
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
LOCATION_TOOL = {
|
| 349 |
+
"name": "get_location_status",
|
| 350 |
+
"description": "Check the status of a specific storage location (stoloc/Location).",
|
| 351 |
+
"parameters": {
|
| 352 |
+
"type": "object",
|
| 353 |
+
"properties": {
|
| 354 |
+
"stoloc": {
|
| 355 |
+
"type": "string",
|
| 356 |
+
"description": "The specific storage location or bin name."
|
| 357 |
+
},
|
| 358 |
+
#"warehouse_id": {
|
| 359 |
+
# "type": "string",
|
| 360 |
+
# "description": "Optional: Override the default warehouse ID."
|
| 361 |
+
#}
|
| 362 |
+
},
|
| 363 |
+
"required": ["stoloc"] # No longer mandatory for the user to speak it
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
TOOL_REGISTRY = {
|
| 368 |
+
"get_item_data": {
|
| 369 |
+
"function": get_item,
|
| 370 |
+
"mapping": ITEM_MAPPING,
|
| 371 |
+
"formatters": ITEM_FORMATTERS,
|
| 372 |
+
"response_key": "data",
|
| 373 |
+
"id_param": "item_number"
|
| 374 |
+
},
|
| 375 |
+
"get_inventory_holds": {
|
| 376 |
+
"function": get_inventory_holds,
|
| 377 |
+
"mapping": HOLD_MAPPING,
|
| 378 |
+
"formatters": HOLD_FORMATTERS,
|
| 379 |
+
"response_key": "data",
|
| 380 |
+
"id_param": "lodnum" # Default primary ID to look for
|
| 381 |
+
},
|
| 382 |
+
"get_location_status": {
|
| 383 |
+
"function": get_location_status,
|
| 384 |
+
"mapping": LOCATION_STATUS_MAPPING,
|
| 385 |
+
"formatters": LOCATION_STATUS_FORMATTERS,
|
| 386 |
+
"response_key": "data",
|
| 387 |
+
"id_param": "stoloc"
|
| 388 |
+
}
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
|
| 393 |
+
|
| 394 |
+
# Used in the Gemini API Payload
|
| 395 |
+
ALL_TOOLS = [ITEM_TOOL,HOLD_TOOL,LOCATION_TOOL]
|