3 changed files with 69 additions and 41 deletions
-
48src/services/globalCmd/cmdTypes.ts
-
36src/services/globalCmd/globalCmd.ts
-
20src/views/SprayView.vue
@ -1,29 +1,29 @@ |
|||
export type OperationCmd = |
|||
| "moveMotorToPosition" // 移动电机
|
|||
export type OperationCmd = "moveMotorToPosition"; // 移动电机
|
|||
|
|||
export type ControlType = { |
|||
valveType: string, |
|||
isOpen: Boolean |
|||
} |
|||
valveType: string; |
|||
isOpen: Boolean; |
|||
}; |
|||
|
|||
export type SyringeType = { |
|||
rotationSpeed: string | number, |
|||
direction: string | number, |
|||
time: string | number, |
|||
} |
|||
rotationSpeed: string | number; |
|||
direction: string | number; |
|||
time: string | number; |
|||
}; |
|||
type PositionType = { |
|||
x:string | number |
|||
y:string | number |
|||
} |
|||
type PositionListType = [PositionType] |
|||
export type workType = { |
|||
direction: string |
|||
space: string | number |
|||
nitrogenFlowVelocity : string | number |
|||
nitrogenAirPressure : string | number |
|||
matrixFlowVelocity : string | number |
|||
voltage : string | number |
|||
height : string | number |
|||
movementSpeed : string | number |
|||
position: PositionListType |
|||
} |
|||
x: number; |
|||
y: number; |
|||
}; |
|||
type PositionListType = PositionType[]; |
|||
export type WorkType = { |
|||
direction: 1 | 2; |
|||
space: number; |
|||
nitrogenFlowVelocity: number; |
|||
nitrogenAirPressure: number; |
|||
matrixFlowVelocity: number; |
|||
voltage: number; |
|||
needPower?: boolean; |
|||
height: number; |
|||
movementSpeed: number; |
|||
position: PositionListType; |
|||
}; |
@ -1,48 +1,62 @@ |
|||
import httpRequest, { type BaseResponse } from "../httpRequest"; |
|||
import { addTxnRecord } from "../txn"; |
|||
import type { OperationCmd, ControlType, SyringeType, workType } from "./cmdTypes"; |
|||
import type { OperationCmd, ControlType, SyringeType, WorkType } from "./cmdTypes"; |
|||
|
|||
//移动电机
|
|||
export function moveMotorToPosition(params: { commandName: string; params: Record<string, any> }) { |
|||
const commandId = addTxnRecord({ ...params, category: "debug" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "api/cmd/moveMotorToPosition", params: { ...params, commandId }, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ |
|||
url: "/api/cmd/moveMotorToPosition", |
|||
params: { ...params, commandId }, |
|||
method: "POST", |
|||
}); |
|||
} |
|||
|
|||
//切换清洗管路
|
|||
export function switchThreeWayValve(params: { type: string }) { |
|||
const commandId = addTxnRecord({ ...params, category: "debug" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/switchThreeWayValve", params: { ...params, commandId }, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ |
|||
url: "/api/cmd/switchThreeWayValve", |
|||
params: { ...params, commandId }, |
|||
method: "POST", |
|||
}); |
|||
} |
|||
|
|||
//氮气三路
|
|||
export function controlValve(params: ControlType) { |
|||
const commandId = addTxnRecord({ ...params, category: "debug" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/controlValve", params: { ...params, commandId }, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/controlValve", params: { ...params, commandId }, method: "POST" }); |
|||
} |
|||
|
|||
//电压控制 开启
|
|||
export function turnOnHighVoltage(params: { voltage: string | number }) { |
|||
const commandId = addTxnRecord({ ...params, category: "debug" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/turnOnHighVoltage", params: { ...params, commandId }, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ |
|||
url: "/api/cmd/turnOnHighVoltage", |
|||
params: { ...params, commandId }, |
|||
method: "POST", |
|||
}); |
|||
} |
|||
|
|||
//电压控制 关闭
|
|||
export function turnOffHighVoltage() { |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/turnOffHighVoltage", params: {}, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/turnOffHighVoltage", params: {}, method: "POST" }); |
|||
} |
|||
|
|||
//注射泵开启
|
|||
export function turnOnSyringePump(params: SyringeType) { |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/turnOnSyringePump", params: {...params}, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/turnOnSyringePump", params: { ...params }, method: "POST" }); |
|||
} |
|||
|
|||
//注射泵关闭
|
|||
export function turnOffSyringePump() { |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/turnOffSyringePump", params: {}, method: "POST" }); |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/turnOffSyringePump", params: {}, method: "POST" }); |
|||
} |
|||
|
|||
//开始喷涂
|
|||
export function startWork(params:workType) { |
|||
return httpRequest<BaseResponse<string>>({ url: "/cmd/startWork", params, method: "POST" }); |
|||
export function startWork(params: WorkType) { |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/startWork", params, method: "POST" }); |
|||
} |
|||
export function stopWork() { |
|||
return httpRequest<BaseResponse<string>>({ url: "/api/cmd/stopWork", method: "POST" }); |
|||
} |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue