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