{"version":3,"file":"index-mFSCz1uu.js","sources":["../../../app/frontend/entrypoints/controllers/wms/picking/index.ts"],"sourcesContent":["import DefaultController from \"../../defaultController\";\nimport Utils from \"../../../utils\";\nimport WmsTransactionEntity from \"../transactions/entity\";\nimport eventBus from '../../../utils/eventBus';\n\n\nexport default class WMSPicking extends DefaultController {\n\n private wmsUIEvents = eventBus.channel('wms_ui')\n\n private pickData: any = {}\n private datatable: null | DataTable = null\n\n private currentScanMode = \"product\";\n private currentLocationId: undefined | string;\n private currentPalletId: undefined | string;\n private currentProductId: undefined | string;\n private currentKeyboardInput = \"\";\n\n private infoBar: HTMLElement | undefined;\n\n async init() {\n this.entity = \"wms/transactions\";\n this.infoBar = document.querySelector(\"#wms_picking_action\") as HTMLElement;\n await super.init();\n await this.mapData();\n console.log(\"pickData\", this.pickData);\n this.bindKeyboardEvents();\n this.createTable()\n this.continue()\n this.infoBar.innerHTML = `Artikel oder Palette scannen!`\n }\n\n bindKeyboardEvents() {\n document.addEventListener(\"keyup\", (e) => {\n if (e.key === \"Enter\") {\n if (this.currentScanMode === \"product\") {\n this.scanProductOrPallet(this.currentKeyboardInput)\n } else if (this.currentScanMode === \"serial\") {\n this.scanEan(this.currentKeyboardInput);\n }\n this.currentKeyboardInput = \"\";\n } else if (e.key !== \"Meta\" && e.key !== \"Shift\") {\n console.log(e)\n if (e.key === \"Backspace\") {\n this.currentKeyboardInput = this.currentKeyboardInput.slice(0, -1);\n } else {\n this.currentKeyboardInput += e.key;\n }\n if (this.infoBar) {\n if (this.currentScanMode === \"product\") {\n this.infoBar.innerHTML = `Artikel oder Palette scannen! - ${this.currentKeyboardInput} `\n } else if (this.currentScanMode === \"serial\") {\n this.infoBar.innerHTML = `Seriennummer scannen! - ${this.currentKeyboardInput} `\n }\n }\n }\n })\n }\n\n scanProductOrPallet(ean: string) {\n const productElems = document.querySelectorAll(`.datatables-users tr[data-product-ean='${ean}']`) as NodeListOf\n const palletElems = document.querySelectorAll(`.datatables-users tr[data-pallet-id='${ean}']`) as NodeListOf\n if (productElems.length > 0) {\n productElems.forEach((productElem) => {\n const wmsId = productElem.getAttribute(\"data-wms-id\") as string\n const serial = productElem.getAttribute(\"data-serial\")\n const palletId = productElem.getAttribute(\"data-pallet-id\")\n if ((this.currentPalletId && palletId === this.currentPalletId) || !this.currentPalletId) {\n if (!serial) {\n this.pickItemDone(wmsId)\n } else {\n this.currentProductId = ean;\n this.currentScanMode = \"serial\"\n if (this.infoBar) {\n this.infoBar.innerHTML = `Seriennummer scannen! `\n }\n productElem.style.background = \"#e7e7e7\"\n }\n }\n })\n } else if (palletElems.length > 0) {\n palletElems.forEach((palletElem) => {\n this.currentPalletId = ean;\n palletElem.style.background = \"#e7e7e7\"\n })\n } else {\n this.toastr.error(\"NOTHIng found\")\n }\n }\n\n scanEan(serial: string) {\n let elem = null;\n if (this.currentPalletId) {\n elem = document.querySelector(`.datatables-users tr[data-product-ean='${this.currentProductId}'][data-pallet-id='${this.currentPalletId}'][data-serial='${serial}']`)\n } else {\n elem = document.querySelector(`.datatables-users tr[data-product-ean='${this.currentProductId}'][data-serial='${serial}']`)\n }\n if (elem) {\n const wmsId = elem.getAttribute(\"data-wms-id\") as string\n this.pickItemDone(wmsId)\n } else {\n this.toastr.error(\"NOTHIng found\")\n }\n }\n\n\n pickReset() {\n\n (document.querySelectorAll(`.datatables-users tr`) as NodeListOf).forEach((tr) => {\n tr.style.background = '';\n });\n this.currentScanMode = \"product\"\n this.currentKeyboardInput = \"\";\n if (this.infoBar) {\n this.infoBar.innerHTML = `Artikel oder Palette scannen!`\n }\n }\n\n async pickItemDone(id: string) {\n this.currentPalletId = undefined;\n this.currentProductId = undefined;\n const elem = document.querySelector(`.datatables-users tr[data-wms-id='${id}']`) as HTMLElement;\n elem.remove();\n this.pickReset();\n await Utils.entity.upsert({\n uuid: id,\n picked: true,\n picked_at: new Date().toISOString()\n }, 'wms/transaction_order_items')\n\n // @ts-ignore\n const currentLocation = this.pickData[this.currentLocationId];\n this.setPicked(currentLocation, id)\n this.continue()\n\n this.toastr.success(`Done picking ${id}`)\n this.wmsUIEvents.trigger(\"item_picked\")\n }\n\n setPicked(location: IWMSPickLocation, id: string) {\n console.log(\"setpicked\", id);\n // @ts-ignore\n [Object.values(location.items), ...Object.values(location.pallets).map(p => Object.values(p.items))].flat().forEach((item: IWMSPickListItem) => {\n console.log(item)\n item.maps.forEach((map) => {\n if (map.uuid === id) {\n map.picked = true\n }\n })\n })\n }\n\n async generateWarehouseMap() {\n // Retrieve the current warehouse ID from localStorage\n const currentWarehouseId = localStorage.getItem('tickware_wms_warehouse') as string;\n\n // Get the warehouse information by querying the ERP system and retrieve the warehouse configuration\n const warehouse = (await Utils.entity.get(currentWarehouseId, 'erp/warehouses')).data[0];\n const config = warehouse.wms_config; // Store the warehouse configuration (assumed to be a 2D grid)\n\n // Initialize the warehouseMap array, which will hold the locations found in the path\n let warehouseMap: string[] = [];\n\n if (!config || config.length === 0) {\n // If the warehouse configuration is empty, return an empty map\n return warehouseMap;\n } else {\n // Variables to track the start, end, current, and past cells\n let startCell: number[] = [];\n let endCell: number[] = [];\n let currentCell: number[] = [];\n let pastCells: number[][] = []; // Store the cells that have already been visited\n\n // Function to determine neighboring cells based on direction\n const getNeighborCell = (row: number, col: number, direction: string) => {\n switch (direction) {\n case 'left':\n return config[row] ? config[row][col - 1] : null;\n case 'right':\n return config[row] ? config[row][col + 1] : null;\n case 'top':\n return config[row - 1] ? config[row - 1][col] : null;\n case 'bottom':\n return config[row + 1] ? config[row + 1][col] : null;\n default:\n return null;\n }\n };\n\n // Function to check if a specific cell has already been visited\n const isVisited = (row: number, col: number) => {\n return pastCells.some(cell => cell[0] === row && cell[1] === col);\n };\n\n // Function to update the current cell to a neighboring \"PATH\" cell, if valid\n const updateCurrentCell = (row: number, col: number, direction: string) => {\n const neighbor = getNeighborCell(row, col, direction);\n const [nextRow, nextCol] = direction === 'left' ? [row, col - 1]\n : direction === 'right' ? [row, col + 1]\n : direction === 'top' ? [row - 1, col]\n : [row + 1, col]; // bottom\n\n // Check if the neighboring cell is a valid \"PATH\" and hasn't been visited\n if (neighbor && neighbor.mode === \"PATH\" && !isVisited(nextRow, nextCol)) {\n return [nextRow, nextCol];\n }\n return null;\n };\n\n // Identify the start and end cells by iterating through the configuration grid\n config.forEach((column: any, row: number) => {\n column.forEach((cell: any, col: number) => {\n if (cell.id === \"START\") startCell = [row, col]; // Identify start cell\n if (cell.id === \"END\") endCell = [row, col]; // Identify end cell\n });\n });\n\n currentCell = startCell; // Start at the start cell\n\n // Loop until the current cell reaches the end cell\n while (currentCell[0] !== endCell[0] || currentCell[1] !== endCell[1]) {\n pastCells.push(currentCell); // Mark the current cell as visited\n\n // List of directions to check for neighboring cells\n const directions = ['left', 'right', 'top', 'bottom'];\n let newCell = null;\n\n // Check neighboring cells for \"LOCATION\" mode and add their ID to the warehouseMap\n directions.forEach(direction => {\n const neighbor = getNeighborCell(currentCell[0], currentCell[1], direction);\n if (neighbor && neighbor.mode === \"LOCATION\") {\n warehouseMap.push(neighbor.id); // Add location ID to map\n }\n });\n\n // Try to move to an adjacent \"PATH\" cell\n for (let direction of directions) {\n newCell = updateCurrentCell(currentCell[0], currentCell[1], direction);\n if (newCell) break; // If a valid path is found, move to that cell\n }\n\n // Check for the \"END\" cell in neighboring cells\n directions.forEach(direction => {\n const neighbor = getNeighborCell(currentCell[0], currentCell[1], direction);\n if (neighbor && neighbor.mode === \"END\") {\n // Update newCell to match the direction of the \"END\" cell\n newCell = [currentCell[0], currentCell[1] + (direction === 'right' ? 1 : direction === 'left' ? -1 : 0)];\n newCell = [currentCell[0] + (direction === 'bottom' ? 1 : direction === 'top' ? -1 : 0), currentCell[1]];\n }\n });\n\n // Break the loop if the newCell matches the endCell\n if (newCell && newCell[0] === endCell[0] && newCell[1] === endCell[1]) {\n break; // End cell is reached\n }\n\n // If no valid path is found or the path hasn't changed, break the loop\n if (!newCell || (newCell[0] === currentCell[0] && newCell[1] === currentCell[1])) {\n break; // No valid path found\n }\n\n // Move to the new cell\n currentCell = newCell;\n }\n }\n\n // Return the list of location IDs found along the path\n return warehouseMap;\n\n }\n\n async mapData() {\n const data: any = {}\n for (const item of this.data.items.filter((i: { picked: string; }) => !i.picked)) {\n if (!data[item.warehouse_location_uuid]) {\n data[item.warehouse_location_uuid] = {\n name: ((await Utils.entity.get(item.warehouse_location_uuid, 'erp/warehouse_locations')).data[0].name),\n pallets: {},\n items: {}\n }\n }\n let target = data[item.warehouse_location_uuid].items\n if (item.warehouse_location_pallet_uuid) {\n if (!data[item.warehouse_location_uuid].pallets[item.warehouse_location_pallet_uuid]) {\n data[item.warehouse_location_uuid].pallets[item.warehouse_location_pallet_uuid] = {\n name: ((await Utils.entity.get(item.warehouse_location_pallet_uuid, 'erp/warehouse_location_pallets')).data[0].name),\n items: {}\n }\n }\n }\n if (!target[item.product_uuid]) {\n const p = (await Utils.entity.get(item.product_uuid, 'erp/products')).data[0]\n target[item.product_uuid] = {\n name: p.name,\n ean: p.ean,\n productNumber: p.productNumber,\n maps: []\n }\n }\n target[item.product_uuid].maps.push({\n uuid: item.uuid,\n mapId: item.warehouse_location_product_mapping_uuid,\n orderId: item.order_uuid,\n orderLineItemId: item.order_line_item_uuid,\n serial: item.serial,\n picked: item.picked\n })\n }\n const warehousePath = await this.generateWarehouseMap()\n console.log(\"warehousePath\", warehousePath)\n warehousePath.forEach(key => {\n if (data.hasOwnProperty(key)) {\n this.pickData[key] = data[key];\n }\n });\n }\n\n createTable() {\n this.datatable = new DataTable('.datatables-users', {\n columns: [\n {data: 'palletName'},\n {data: 'productName'},\n {data: 'serial'},\n ],\n order: [[1, 'desc']],\n dom: 't',\n createdRow: (row: HTMLTableRowElement, data: IWMSPickTableRow, dataIndex: number) => {\n row.setAttribute(\"data-wms-id\", data.wmsId);\n row.setAttribute(\"data-pallet-id\", data.palletId);\n row.setAttribute(\"data-product-ean\", data.ean);\n if (data.serial) {\n row.setAttribute(\"data-serial\", data.serial);\n }\n },\n language: {\n sLengthMenu: '_MENU_',\n search: '',\n searchPlaceholder: `${Utils.translate('generic.search')}...`,\n \"zeroRecords\": `${Utils.translate('generic.datatable.no_results')}`,\n \"emptyTable\": `${Utils.translate('generic.datatable.no_results')}`,\n \"paginate\": {\n \"first\": `${Utils.translate('generic.datatable.pagination.first')}`,\n \"last\": `${Utils.translate('generic.datatable.pagination.last')}`,\n \"next\": `${Utils.translate('generic.datatable.pagination.next')}`,\n \"previous\": `${Utils.translate('generic.datatable.pagination.previous')}`\n },\n \"info\": `${Utils.translate('generic.datatable.info.info')}`,\n \"infoEmpty\": `${Utils.translate('generic.datatable.info.empty')}`,\n \"infoFiltered\": `${Utils.translate('generic.datatable.info.filtered')}`,\n },\n buttons: []\n });\n }\n\n\n async animateSwitch() {\n console.log(\"ANIM\")\n }\n\n getCurrentLocationId() {\n for (const locationId of Object.keys(this.pickData)) {\n const location = this.pickData[locationId];\n const items = [Object.values(location.items), ...Object.values(location.pallets).map((p: any) => {\n return Object.values(p.items)\n })].flat();\n const unpickedItems = items.map((p: any) => {\n return p.maps\n }).flat().filter((p) => {\n return !p.picked\n })\n if (unpickedItems.length > 0) {\n return locationId;\n }\n }\n return null\n }\n\n async pickFinished() {\n await Utils.wms.generatePackages(this.generateOrderMap())\n await Utils.entity.upsert({\n uuid: this.data.uuid,\n status: \"DONE\",\n }, 'wms/transactions')\n document.location.href = `/${(window as any).currentLocale}/wms`\n }\n\n generateOrderMap() {\n let orderMap: IWMSOrderMap = {};\n (Object.values(this.pickData) as IWMSPickLocation[]).forEach((location: IWMSPickLocation) => {\n const items = [Object.values(location.items), ...Object.values(location.pallets).map(p => Object.values(p.items))].flat()\n const maps = items.map(i => i.maps).flat()\n items.forEach((item) => {\n item.maps.forEach((map) => {\n if (!orderMap[map.orderId]) {\n orderMap[map.orderId] = {}\n }\n if (!orderMap[map.orderId][map.orderLineItemId]) {\n orderMap[map.orderId][map.orderLineItemId] = {\n maps: [],\n name: item.name,\n productNumber: item.productNumber\n }\n }\n orderMap[map.orderId][map.orderLineItemId].maps.push({\n mapId: map.mapId,\n serial: map.serial\n })\n })\n })\n });\n\n return orderMap;\n }\n\n async continue() {\n const currentLocationId = this.getCurrentLocationId()\n if (!currentLocationId) {\n await this.pickFinished()\n return\n }\n if (currentLocationId !== this.currentLocationId && this.currentLocationId) {\n await this.animateSwitch();\n }\n this.currentLocationId = currentLocationId\n const currentLocation = this.pickData[this.currentLocationId];\n console.log(\"currentLocation\", currentLocation)\n const currentCount = this.getItemCount(currentLocation);\n //Html Elements\n (document.querySelector(\"#wms_picking_current_location\") as HTMLElement).innerHTML = currentLocation.name;\n (document.querySelector(\"#wms_picking_current_count\") as HTMLElement).innerHTML = `${currentCount.picked}/${currentCount.total}`;\n if (this.datatable) {\n this.datatable.clear();\n this.datatable.rows.add(this.generateTableData(currentLocation));\n this.datatable.draw();\n }\n\n }\n\n generateTableData(location: IWMSPickLocation) {\n let a: IWMSPickTableRow[] = [];\n const generateItems = (parent: IWMSPickLocation | IWMSPickPallet, name: string, palletId: (string | null) = null) => {\n Object.keys(parent.items).forEach((productId) => {\n const product = parent.items[productId];\n product.maps.forEach((map: IWMSPickItemMap) => {\n console.log(map)\n if (!map.picked) {\n a.push({\n wmsId: map.uuid,\n productId,\n palletId,\n palletName: name,\n productName: `${product.name}[${product.ean}]`,\n ean: product.ean,\n serial: map.serial\n })\n }\n })\n })\n }\n Object.keys(location.pallets).forEach((palletId) => {\n const pallet = location.pallets[palletId];\n generateItems(pallet, pallet.name, palletId)\n })\n generateItems(location, \"---\", null)\n\n return a;\n }\n\n getItemCount(location: IWMSPickLocation) {\n let picked = 0;\n let total = 0;\n const getItems = (items: { [key: string]: IWMSPickListItem }) => {\n Object.keys(items).forEach((productId) => {\n const product = items[productId];\n product.maps.forEach((map: IWMSPickItemMap) => {\n total++;\n if (map.picked) {\n picked++;\n }\n })\n })\n };\n getItems(location.items)\n Object.keys(location.pallets).forEach((palletId) => {\n const pallet = location.pallets[palletId];\n getItems(pallet.items)\n })\n return {picked, total}\n }\n\n protected getEntityData(elem: any) {\n return WmsTransactionEntity.getEntityData(elem)\n }\n\n bindListeners() {\n document.addEventListener(\"click\", (e) => {\n const target = e.target as null | HTMLElement\n if (target && target.id === 'wms_picking_cancel_action') {\n this.pickReset();\n }\n })\n }\n}"],"names":[],"mappings":";;;;;;;;;;AAMA,MAAqB,mBAAmB,kBAAkB;AAAA,EAA1D,cAAA;AAAA,UAAA,GAAA,SAAA;AAEY,SAAA,cAAc,SAAS,QAAQ,QAAQ;AAE/C,SAAQ,WAAgB;AACxB,SAAQ,YAA8B;AAEtC,SAAQ,kBAAkB;AAI1B,SAAQ,uBAAuB;AAAA,EAAA;AAAA,EAI/B,MAAM,OAAO;AACT,SAAK,SAAS;AACT,SAAA,UAAU,SAAS,cAAc,qBAAqB;AAC3D,UAAM,MAAM;AACZ,UAAM,KAAK;AACH,YAAA,IAAI,YAAY,KAAK,QAAQ;AACrC,SAAK,mBAAmB;AACxB,SAAK,YAAY;AACjB,SAAK,SAAS;AACd,SAAK,QAAQ,YAAY;AAAA,EAC7B;AAAA,EAEA,qBAAqB;AACR,aAAA,iBAAiB,SAAS,CAAC,MAAM;AAClC,UAAA,EAAE,QAAQ,SAAS;AACf,YAAA,KAAK,oBAAoB,WAAW;AAC/B,eAAA,oBAAoB,KAAK,oBAAoB;AAAA,QAAA,WAC3C,KAAK,oBAAoB,UAAU;AACrC,eAAA,QAAQ,KAAK,oBAAoB;AAAA,QAC1C;AACA,aAAK,uBAAuB;AAAA,MAAA,WACrB,EAAE,QAAQ,UAAU,EAAE,QAAQ,SAAS;AAC9C,gBAAQ,IAAI,CAAC;AACT,YAAA,EAAE,QAAQ,aAAa;AACvB,eAAK,uBAAuB,KAAK,qBAAqB,MAAM,GAAG,EAAE;AAAA,QAAA,OAC9D;AACH,eAAK,wBAAwB,EAAE;AAAA,QACnC;AACA,YAAI,KAAK,SAAS;AACV,cAAA,KAAK,oBAAoB,WAAW;AACpC,iBAAK,QAAQ,YAAY,0CAA0C,K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