Browse Source

fix: 调试指令消息通知重复

feature/three
guoapeng 3 months ago
parent
commit
156cfa45e6
  1. 97
      src/views/debug/index.vue

97
src/views/debug/index.vue

@ -8,6 +8,8 @@ const systemStore = useSystemStore()
const debugStore = useDebugStore()
let currentCommandId = ''
onMounted(() => {
socket.init(receiveMessage, 'notification')
})
@ -17,12 +19,13 @@ onUnmounted(() => {
})
const receiveMessage = (data: Socket.NotificationData) => {
systemStore.pushSystemList(data)
data.commandId === currentCommandId && systemStore.pushSystemList(data)
}
const pallet_elevator_lift_up = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_pallet_elevator_lift_up',
params: {
index: debugStore.formData.heatArea.index,
@ -33,8 +36,9 @@ const pallet_elevator_lift_up = async () => {
}
const pallet_elevator_lift_down = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_pallet_elevator_lift_down',
params: {
index: debugStore.formData.heatArea.index,
@ -45,8 +49,9 @@ const pallet_elevator_lift_down = async () => {
}
const pallet_elevator_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_pallet_elevator_stop',
params: {
index: debugStore.formData.heatArea.index,
@ -56,8 +61,9 @@ const pallet_elevator_stop = async () => {
}
const heater_start = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_heater_start',
params: {
index: debugStore.formData.heatArea.index,
@ -67,8 +73,9 @@ const heater_start = async () => {
await debugStore.sendControl(params)
}
const heater_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_heater_stop',
params: {
index: debugStore.formData.heatArea.index,
@ -78,8 +85,9 @@ const heater_stop = async () => {
}
const debug_heater_start_heat_maintaining = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_heater_start_heat_maintaining',
params: {
index: debugStore.formData.heatArea.index,
@ -90,8 +98,9 @@ const debug_heater_start_heat_maintaining = async () => {
}
const debug_heater_stop_heat_maintaining = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_heater_stop_heat_maintaining',
params: {
index: debugStore.formData.heatArea.index,
@ -101,8 +110,9 @@ const debug_heater_stop_heat_maintaining = async () => {
}
const debug_fan_start = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_fan_start',
params: {
index: debugStore.formData.heatArea.index,
@ -112,8 +122,9 @@ const debug_fan_start = async () => {
}
const debug_fan_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_fan_stop',
params: {
index: debugStore.formData.heatArea.index,
@ -123,8 +134,9 @@ const debug_fan_stop = async () => {
}
const debug_cover_elevator_lift_up = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_cover_elevator_lift_up',
params: {
...debugStore.formData.lidData,
@ -134,8 +146,9 @@ const debug_cover_elevator_lift_up = async () => {
}
const debug_cover_elevator_lift_down = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_cover_elevator_lift_down',
params: {
...debugStore.formData.lidData,
@ -145,8 +158,9 @@ const debug_cover_elevator_lift_down = async () => {
}
const debug_cover_elevator_reset = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_cover_elevator_reset',
params: {},
}
@ -154,8 +168,9 @@ const debug_cover_elevator_reset = async () => {
}
const debug_cover_elevator_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_cover_elevator_stop',
params: {},
}
@ -163,8 +178,9 @@ const debug_cover_elevator_stop = async () => {
}
const liquid_arm_reset = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_arm_reset',
params: {
target: ['largeArm', 'smallArm'],
@ -174,8 +190,9 @@ const liquid_arm_reset = async () => {
}
const liquid_arm_rotation = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_arm_rotation',
params: {
...debugStore.formData.liquidArmData,
@ -185,8 +202,9 @@ const liquid_arm_rotation = async () => {
}
const liquid_arm_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_arm_stop',
params: {
target: ['largeArm', 'smallArm'],
@ -196,8 +214,9 @@ const liquid_arm_stop = async () => {
}
const liquid_pump_pre_filling = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_pump_pre_filling',
params: {
index: debugStore.formData.liquidPumpData.index,
@ -207,8 +226,9 @@ const liquid_pump_pre_filling = async () => {
}
const liquid_pump_pre_evacuation = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_pump_pre_evacuation',
params: {
index: debugStore.formData.liquidPumpData.index,
@ -218,8 +238,9 @@ const liquid_pump_pre_evacuation = async () => {
}
const liquid_pump_start = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_pump_start',
params: {
...debugStore.formData.liquidPumpData,
@ -229,8 +250,9 @@ const liquid_pump_start = async () => {
}
const liquid_pump_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_liquid_pump_stop',
params: {
index: debugStore.formData.liquidPumpData.index,
@ -240,8 +262,9 @@ const liquid_pump_stop = async () => {
}
const shaker_start = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_shaker_start',
params: {
...debugStore.formData.shakeSpeed,
@ -251,8 +274,9 @@ const shaker_start = async () => {
}
const shaker_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_shaker_stop',
params: {},
}
@ -260,8 +284,9 @@ const shaker_stop = async () => {
}
const debug_transportation_arm_reset = async (motor: 'x' | 'y' | 'z') => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_transportation_arm_reset',
params: {
dim: [motor],
@ -271,8 +296,9 @@ const debug_transportation_arm_reset = async (motor: 'x' | 'y' | 'z') => {
}
const debug_transportation_arm_move = async (motor: 'x' | 'y' | 'z') => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_transportation_arm_move',
params: {
...debugStore.formData.transferModule[`${motor}MotorData`],
@ -282,8 +308,9 @@ const debug_transportation_arm_move = async (motor: 'x' | 'y' | 'z') => {
}
const debug_transportation_arm_stop = async (motor: 'x' | 'y' | 'z') => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_transportation_arm_stop',
params: {
dim: [motor],
@ -293,8 +320,9 @@ const debug_transportation_arm_stop = async (motor: 'x' | 'y' | 'z') => {
}
const debug_holding_jaw_open = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_holding_jaw_open',
params: {
...debugStore.formData.transferModule.JawData,
@ -304,8 +332,9 @@ const debug_holding_jaw_open = async () => {
}
const debug_holding_jaw_close = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_holding_jaw_close',
params: {
...debugStore.formData.transferModule.JawData,
@ -315,8 +344,9 @@ const debug_holding_jaw_close = async () => {
}
const debug_holding_jaw_pause = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_holding_jaw_pause',
params: {},
}
@ -324,8 +354,9 @@ const debug_holding_jaw_pause = async () => {
}
const door_open = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_door_open',
params: {},
}
@ -333,8 +364,9 @@ const door_open = async () => {
}
const door_close = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_door_close',
params: {},
}
@ -342,8 +374,9 @@ const door_close = async () => {
}
const door_stop = async () => {
currentCommandId = Date.now().toString()
const params = {
commandId: Date.now().toString(),
commandId: currentCommandId,
command: 'debug_door_stop',
params: {},
}

Loading…
Cancel
Save