fixed some errors
parent
335b1df740
commit
ef5b21e7ae
|
@ -126,17 +126,14 @@ export default function WebSocketProvider({
|
||||||
};
|
};
|
||||||
|
|
||||||
const SendSocketMessage = (cmd, body) => {
|
const SendSocketMessage = (cmd, body) => {
|
||||||
if (isWebSocketReady && ws.current !== null) {
|
if (
|
||||||
|
isWebSocketReady &&
|
||||||
|
ws.current !== null &&
|
||||||
|
ws.current.readyState === 1
|
||||||
|
) {
|
||||||
ws.current.send(JSON.stringify({ Cmd: cmd, Body: body }));
|
ws.current.send(JSON.stringify({ Cmd: cmd, Body: body }));
|
||||||
} else {
|
} else {
|
||||||
/*notificationApi["error"]({
|
|
||||||
message: `Websocket is not ready`,
|
|
||||||
description: `Please check your internet connection`,
|
|
||||||
}); */
|
|
||||||
|
|
||||||
wsMessageCache.current.push({ Cmd: cmd, Body: body });
|
wsMessageCache.current.push({ Cmd: cmd, Body: body });
|
||||||
|
|
||||||
// message.error(`Websocket is not ready`);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -238,10 +238,8 @@ export function handleWebSocketMessage(
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
"a",
|
"here1",
|
||||||
scannerContext
|
scannerContext.checkboxAutomaticFillingOfInputFieldsCheckedRef.current
|
||||||
.checkboxAutomaticRecognitionOfEquipmentDocumentationCheckedRef
|
|
||||||
.current
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -250,19 +248,33 @@ export function handleWebSocketMessage(
|
||||||
.current &&
|
.current &&
|
||||||
IsScannedQrCodeValid(body)
|
IsScannedQrCodeValid(body)
|
||||||
) {
|
) {
|
||||||
OpenScannedEquipmentDocumentation({
|
let item = null;
|
||||||
navigate: navigate,
|
|
||||||
scannedEquipment: JSON.parse(body).stockitem.toString(),
|
// check if body is json
|
||||||
});
|
try {
|
||||||
} else if (
|
item = JSON.parse(body).stockitem.toString();
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
if (item !== null) {
|
||||||
|
OpenScannedEquipmentDocumentation({
|
||||||
|
navigate: navigate,
|
||||||
|
scannedEquipment: item,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
scannerContext.checkboxAutomaticFillingOfInputFieldsCheckedRef.current
|
scannerContext.checkboxAutomaticFillingOfInputFieldsCheckedRef.current
|
||||||
) {
|
) {
|
||||||
// get the current focused input on the page and set the value
|
// get the current focused input on the page and set the value
|
||||||
const foundInput = document.activeElement;
|
const foundInput = document.activeElement;
|
||||||
|
console.log(
|
||||||
if (!foundInput) break;
|
"here",
|
||||||
|
scannerContext.checkboxAutomaticFillingOfInputFieldsCheckedRef.current
|
||||||
setNativeValue(foundInput, body);
|
);
|
||||||
|
if (foundInput) {
|
||||||
|
setNativeValue(foundInput, body);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -350,6 +350,8 @@ export default function Robots() {
|
||||||
const getRobotsTableItems = (robots) => {
|
const getRobotsTableItems = (robots) => {
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
|
if (robots === undefined || robots.length === 0) return items;
|
||||||
|
|
||||||
robots.sort((a, b) => new Date(b.CreatedAt) - new Date(a.CreatedAt));
|
robots.sort((a, b) => new Date(b.CreatedAt) - new Date(a.CreatedAt));
|
||||||
|
|
||||||
robots.forEach((robot) =>
|
robots.forEach((robot) =>
|
||||||
|
@ -471,6 +473,9 @@ export default function Robots() {
|
||||||
const getUnauthorizedTableItems = (unauthorizedRobots) => {
|
const getUnauthorizedTableItems = (unauthorizedRobots) => {
|
||||||
let items = [];
|
let items = [];
|
||||||
|
|
||||||
|
if (unauthorizedRobots === undefined || unauthorizedRobots.length === 0)
|
||||||
|
return items;
|
||||||
|
|
||||||
unauthorizedRobots.forEach((robot) => {
|
unauthorizedRobots.forEach((robot) => {
|
||||||
items.push({
|
items.push({
|
||||||
key: robot.Id,
|
key: robot.Id,
|
||||||
|
|
Loading…
Reference in New Issue