基质喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

588 lines
16 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <main>
  3. <div class="ml-[20px]">
  4. <el-tabs v-model="activeName" class="demo-tabs">
  5. <el-tab-pane label="设备调试" name="debug"></el-tab-pane>
  6. <el-tab-pane label="应用调试" name="app"></el-tab-pane>
  7. </el-tabs>
  8. </div>
  9. <div v-if="activeName == 'debug'">
  10. <div class="debug_axis">
  11. <div class="axis">
  12. <div class="w-[3rem]">X轴</div>
  13. <input
  14. v-model="machineryForm.X"
  15. type="number"
  16. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
  17. <div class="w-[3rem]">毫米</div>
  18. <div class="flex">
  19. <el-button type="primary" @click="onMoveMachinery('X')">移动</el-button>
  20. <el-button type="primary" @click="onStopRotate('X')">停止</el-button>
  21. </div>
  22. </div>
  23. <div class="axis">
  24. <div class="w-[4rem]">Y轴</div>
  25. <input
  26. v-model="machineryForm.Y"
  27. type="number"
  28. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
  29. <div class="w-[2.5rem]">毫米</div>
  30. <div class="flex">
  31. <el-button type="primary" @click="onMoveMachinery('Y')">移动</el-button>
  32. <el-button type="primary" @click="onStopRotate('Y')">停止</el-button>
  33. </div>
  34. </div>
  35. <div class="axis">
  36. <div class="w-[3rem]">Z轴</div>
  37. <input
  38. v-model="machineryForm.Z"
  39. type="number"
  40. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[80px]" />
  41. <div class="w-[2.5rem]">毫米</div>
  42. <div class="flex">
  43. <el-button type="primary" @click="onMoveMachinery('Z')">移动</el-button>
  44. <el-button type="primary" @click="onStopRotate('Z')">停止</el-button>
  45. </div>
  46. </div>
  47. </div>
  48. <div class="debug_main">
  49. <div class="debug_left">
  50. <div class="">
  51. <el-row>
  52. <el-col :span="6" class="text-right">指定电机转速</el-col>
  53. <el-col :span="20" class="ml-[5rem]">
  54. <el-radio-group v-model="rotateForm.axis">
  55. <el-radio value="X">X</el-radio>
  56. <el-radio value="Y">Y</el-radio>
  57. <el-radio value="Z">Z</el-radio>
  58. </el-radio-group>
  59. <div class="flex">
  60. <div>
  61. 速度:<input
  62. type="number"
  63. v-model="rotateForm.speed"
  64. placeholder=""
  65. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />毫米/
  66. </div>
  67. <div class="ml-[20px]">
  68. <el-button type="primary" @click="onRotate">确定</el-button>
  69. </div>
  70. </div>
  71. </el-col>
  72. </el-row>
  73. <el-divider />
  74. <el-row>
  75. <el-col :span="6" class="text-right"> 电压控制器 </el-col>
  76. <el-col :span="6" class="ml-[20px]">
  77. <input
  78. v-model="voltageValue"
  79. placeholder="0~5000v"
  80. type="number"
  81. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  82. </el-col>
  83. <el-col :span="8">
  84. <el-button type="primary" @click="onTurnOnHighVoltage">开启</el-button>
  85. <el-button @click="onTurnOffHighVoltage">关闭</el-button>
  86. </el-col>
  87. </el-row>
  88. <el-divider />
  89. <el-row class="mt-[10px]">
  90. <el-col :span="4" class="text-right"> 注射泵 </el-col>
  91. <el-col :span="20">
  92. <div class="ml-[20px]">
  93. <input
  94. v-model="syringeForm.rotationSpeed"
  95. placeholder="转速"
  96. type="number"
  97. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />微升/每分钟
  98. </div>
  99. <div class="mt-[10px] ml-[20px]">
  100. <input
  101. v-model="syringeForm.time"
  102. placeholder="时间"
  103. type="number"
  104. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  105. </div>
  106. <div class="ml-[20px] mt-[10px]">
  107. 方向
  108. <el-radio v-model="syringeForm.direction" value="0">后退</el-radio>
  109. <el-radio v-model="syringeForm.direction" value="1">前进</el-radio>
  110. <br />
  111. <el-button type="primary" @click="onTurnOnSyringePump">开始</el-button>
  112. <el-button type="primary" class="ml-[20px]" @click="onTurnOffSyringePump">停止</el-button>
  113. </div>
  114. </el-col>
  115. </el-row>
  116. <el-divider />
  117. <el-row class="mt-[10px]">
  118. <el-col :span="6" class="text-right"> 湿度 </el-col>
  119. <el-col :span="12" class="ml-[20px]">
  120. <input
  121. placeholder="湿度"
  122. type="number"
  123. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  124. <div class="flex mt-[10px]">
  125. <el-button type="primary">开始除湿</el-button>
  126. <el-button type="primary">结束除湿</el-button>
  127. </div>
  128. </el-col>
  129. </el-row>
  130. <el-divider />
  131. </div>
  132. </div>
  133. <div class="debug_right">
  134. <div>
  135. <el-button type="primary">急停</el-button>
  136. <div class="mt-[20px]">
  137. <input
  138. v-model="brightness"
  139. placeholder="亮度"
  140. type="number"
  141. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  142. <el-button class="ml-[20px]" type="primary" @click="onTurnOnLightPanel">开启照明灯</el-button>
  143. <el-button @click="onTurnOffLightPanel">关闭照明灯</el-button>
  144. </div>
  145. </div>
  146. <el-divider />
  147. <div>
  148. <div>切换三通</div>
  149. <el-button type="primary" @click="onSwitchThreeWayValve('clean')">管路切换到基质</el-button>
  150. <el-button type="primary" @click="onSwitchThreeWayValve('spray')">管路切换到清洗</el-button>
  151. </div>
  152. <el-divider />
  153. <div>
  154. <div>气压阀</div>
  155. <div>
  156. <el-button type="primary" @click="onControlValve('Cleaning', true)">打开清洗阀</el-button>
  157. <el-button @click="onControlValve('Cleaning', false)">关闭清洗阀</el-button>
  158. </div>
  159. <div class="mt-[10px]">
  160. <el-button type="primary" @click="onControlValve('Nozzle', true)">打开喷嘴阀</el-button>
  161. <el-button @click="onControlValve('Nozzle', false)">关闭喷嘴阀</el-button>
  162. </div>
  163. <div class="mt-[10px]">
  164. <el-button type="primary" @click="onControlValve('Dehumidification', true)">打开除湿阀</el-button>
  165. <el-button @click="onControlValve('Dehumidification', false)">关闭除湿阀</el-button>
  166. </div>
  167. </div>
  168. <el-divider />
  169. <div class="mt-[10px]">
  170. <el-button type="primary" @click="onStartWash('injector')">开始清洗注射器</el-button>
  171. <el-button type="primary" @click="onStartWash('nozzle')">开始清洗喷涂部分</el-button>
  172. <el-button @click="onStopWash">停止清洗</el-button>
  173. </div>
  174. <!-- <el-divider />
  175. <div class="h-[13rem] bg-[#f4f4f4] p-[10px]">
  176. <div>状态反馈区</div>
  177. </div> -->
  178. </div>
  179. </div>
  180. </div>
  181. <div v-if="activeName == 'app'">
  182. <div class="bg-[#FBFBFB] h-[75vh] p-[10px]">
  183. <el-row class="mt-[10px]">
  184. <el-col :span="3" class="text-right"> 开始喷涂 </el-col>
  185. <el-col :span="12" class="ml-[20px]">
  186. <div>喷涂路线</div>
  187. <div>
  188. <el-radio-group v-model="workForm.routeType">
  189. <el-radio :value="1">横向</el-radio>
  190. <el-radio :value="2">纵向</el-radio>
  191. </el-radio-group>
  192. </div>
  193. <div class="mt-[20px]">
  194. 选择玻片
  195. <el-radio-group v-model="axis.index">
  196. <el-radio :value="0">玻片1</el-radio>
  197. <el-radio :value="1">玻片2</el-radio>
  198. <el-radio :value="2">玻片3</el-radio>
  199. <el-radio :value="3">玻片4</el-radio>
  200. </el-radio-group>
  201. </div>
  202. <div class="mt-[20px]">
  203. 行间距
  204. <input
  205. v-model="workForm.space"
  206. placeholder=""
  207. type="number"
  208. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  209. 毫米
  210. </div>
  211. <div class="mt-[20px]">
  212. 氮气流速
  213. <input
  214. v-model="workForm.nitrogenFlowVelocity"
  215. placeholder=""
  216. type="number"
  217. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  218. 毫米/
  219. </div>
  220. <div class="mt-[20px]">
  221. 氮气气压
  222. <input
  223. v-model="workForm.matrixFlowVelocity"
  224. placeholder=""
  225. type="number"
  226. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  227. Mp
  228. </div>
  229. <div class="mt-[20px]">
  230. 电压
  231. <input
  232. v-model="workForm.voltage"
  233. placeholder=""
  234. type="number"
  235. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  236. V
  237. </div>
  238. <div class="mt-[20px]">
  239. 喷针距离玻片高度
  240. <input
  241. v-model="workForm.height"
  242. placeholder=""
  243. type="number"
  244. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  245. 毫米
  246. </div>
  247. <div class="mt-[20px]">
  248. 移速
  249. <input
  250. v-model="workForm.movementSpeed"
  251. placeholder=""
  252. type="number"
  253. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  254. 毫米/
  255. </div>
  256. <div>起始坐标</div>
  257. <div>
  258. X:<input
  259. v-model="axis.x1"
  260. placeholder=""
  261. type="number"
  262. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  263. Y:<input
  264. v-model="axis.y1"
  265. placeholder=""
  266. type="number"
  267. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  268. </div>
  269. <div class="mt-[10px]">结束坐标</div>
  270. <div class="flex">
  271. X:<input
  272. v-model="axis.x2"
  273. placeholder=""
  274. type="number"
  275. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  276. Y:<input
  277. v-model="axis.y2"
  278. placeholder=""
  279. type="number"
  280. class="border-none outline-none h-[34px] bg-[#E8ECF7] text-primary font-medium rounded-md text-lg text-center w-[100px]" />
  281. </div>
  282. <div class="mt-[20px] text-center">
  283. <el-button type="primary" class="ml-[10px] w-[100px]" @click="onStartWork">开始喷涂</el-button>
  284. <el-button type="primary" class="ml-[10px] w-[100px]" @click="onStopWork">结束喷涂</el-button>
  285. </div>
  286. </el-col>
  287. </el-row>
  288. </div>
  289. </div>
  290. </main>
  291. </template>
  292. <script lang="ts" setup>
  293. import { ref, onMounted, onUnmounted, watch } from "vue";
  294. import { createWebSocket, sharedWsUrl } from "@/services/socket";
  295. import { ElMessage } from "element-plus";
  296. import type {
  297. ControlNitrogen,
  298. MachineryType,
  299. SyringeType,
  300. SyringeParams,
  301. VoltageType,
  302. ControlValueType,
  303. Axis,
  304. } from "@/services/globalCmd/cmdTypes";
  305. import {
  306. moveMotorToPosition,
  307. switchThreeWayValve,
  308. controlValve,
  309. turnOnHighVoltage,
  310. turnOffHighVoltage,
  311. turnOnSyringePump,
  312. turnOffSyringePump,
  313. startWork,
  314. stopWork,
  315. stopMotor,
  316. turnOffLightPanel,
  317. turnOnLightPanel,
  318. stopWash,
  319. stopDehumidify,
  320. setMotorSpeed,
  321. type WashType,
  322. startWash
  323. } from "@/services/globalCmd/globalCmd";
  324. import type { BaseResponse } from "@/services/httpRequest";
  325. import type { WorkType } from '../../services/globalCmd/cmdTypes';
  326. const activeName = ref("debug");
  327. const voltageValue = ref();
  328. const syringeForm = ref<SyringeParams>({
  329. rotationSpeed: 1,
  330. time: 0,
  331. direction: "1",
  332. });
  333. const workForm = ref<WorkType>({
  334. routeType: 1,
  335. space: 2,
  336. nitrogenFlowVelocity: 1,
  337. nitrogenAirPressure: 1,
  338. matrixFlowVelocity: 1,
  339. voltage: 1,
  340. needPower: false,
  341. height: 6,
  342. movementSpeed: 10,
  343. position: [],
  344. });
  345. const axis = ref<Axis>({
  346. index: 0,
  347. x1: 10,
  348. y1: 10,
  349. x2: 20,
  350. y2: 20,
  351. });
  352. const rotateForm = ref<{ axis: "X" | "Y" | "Z"; speed: number }>({ axis: "X", speed: 20 });
  353. watch(voltageValue,(newVal)=>{
  354. if(newVal > 5000){
  355. voltageValue.value = 5000
  356. }
  357. if(newVal < 0){
  358. voltageValue.value = 0
  359. }
  360. })
  361. onMounted(() => {
  362. //连接websocket
  363. const wsClient = createWebSocket(sharedWsUrl);
  364. const subscription = wsClient.dataOb.subscribe(data => {
  365. });
  366. wsClient.connect();
  367. onUnmounted(() => {
  368. subscription && subscription.unsubscribe();
  369. });
  370. });
  371. const machineryForm = ref<Record<string, string>>({});
  372. const onMoveMachinery = (axis: string) => {
  373. if (!axis) return;
  374. const params = <MachineryType>{
  375. axis,
  376. position: parseFloat(machineryForm.value[axis]),
  377. };
  378. moveMotorToPosition(params).then((res) => {
  379. console.log("-----moveMotorToPosition----res---", res);
  380. success(res);
  381. });
  382. };
  383. const onSwitchThreeWayValve = (type: string) => {
  384. const params = {
  385. type,
  386. };
  387. switchThreeWayValve(params).then((res) => {
  388. console.log("---onSwitchThreeWayValve---res---", res);
  389. success(res);
  390. });
  391. };
  392. const onControlValve = (type: ControlNitrogen, open: boolean) => {
  393. const params = <ControlValueType>{
  394. params: {
  395. valveType: type,
  396. isOpen: open,
  397. },
  398. };
  399. controlValve(params).then((res) => {
  400. console.log("---onControlValve---res---", res);
  401. success(res);
  402. });
  403. };
  404. const onStopDehumidify = () => {
  405. stopDehumidify().then((res) => {
  406. success(res);
  407. });
  408. };
  409. function onStartWash(type: WashType) {
  410. startWash({ type }).then(res => {
  411. if (res.success) {
  412. ElMessage.success("已经开始清洗");
  413. } else {
  414. ElMessage.error(res.msg);
  415. }
  416. });
  417. }
  418. const onStopWash = () => {
  419. stopWash({}).then((res) => {
  420. success(res);
  421. });
  422. };
  423. //电压控制 开启
  424. const onTurnOnHighVoltage = () => {
  425. const params = <VoltageType>{
  426. params: { voltage: +voltageValue.value },
  427. };
  428. turnOnHighVoltage(params).then((res) => {
  429. console.log("---onTurnOnHighVoltage- 电压控制 on --res---", res);
  430. success(res);
  431. });
  432. };
  433. //电压控制 关闭
  434. const onTurnOffHighVoltage = () => {
  435. turnOffHighVoltage().then((res) => {
  436. console.log("---onTurnOffHighVoltage- 电压控制 off--res---", res);
  437. success(res);
  438. });
  439. };
  440. //注射泵开启
  441. const onTurnOnSyringePump = () => {
  442. // SyringeType
  443. const params = <SyringeType>{
  444. params: {
  445. rotationSpeed: syringeForm.value.rotationSpeed,
  446. // direction: syringeForm.value.direction,
  447. // time: syringeForm.value.time,
  448. },
  449. };
  450. turnOnSyringePump(params).then((res) => {
  451. console.log("---onTurnOffHighVoltage- 电泵开启--res---", res);
  452. success(res);
  453. });
  454. };
  455. const onTurnOffSyringePump = () => {
  456. turnOffSyringePump().then((res) => {
  457. success(res);
  458. });
  459. };
  460. const onStartWork = () => {
  461. const params = <WorkType>{
  462. ...workForm.value,
  463. position: [axis.value],
  464. };
  465. startWork(params).then((res) => {
  466. success(res);
  467. });
  468. };
  469. function onStopWork() {
  470. stopWork().then((res) => {
  471. success(res);
  472. });
  473. }
  474. const onRotate = () => {
  475. const params = {
  476. ...rotateForm.value,
  477. };
  478. setMotorSpeed(params).then((res) => {
  479. success(res);
  480. });
  481. };
  482. const onStopRotate = (axis: string) => {
  483. stopMotor({axis}).then((res) => {
  484. success(res);
  485. });
  486. };
  487. let brightness = ref()
  488. const onTurnOnLightPanel = () => {
  489. turnOnLightPanel({brightness: brightness.value}).then(res => {
  490. success(res);
  491. });
  492. };
  493. function onTurnOffLightPanel() {
  494. const params = {
  495. brightness: brightness.value,
  496. };
  497. turnOffLightPanel(params).then((res) => {
  498. success(res);
  499. });
  500. }
  501. function success(data:BaseResponse) {
  502. if (data && data.msg == "ok") {
  503. ElMessage.success("发送成功");
  504. } else {
  505. ElMessage.error(data.msg);
  506. }
  507. }
  508. </script>
  509. <style lang="scss" scoped>
  510. div {
  511. color: #0349a8;
  512. }
  513. .el-button--primary {
  514. background: linear-gradient(90deg, #0657c0 24%, #096ae0 101%);
  515. }
  516. .debug_axis {
  517. height: 3rem;
  518. background: #fbfbfb;
  519. margin-left: 3.5rem;
  520. margin-right: 3.5rem;
  521. border-radius: 6px;
  522. display: flex;
  523. align-items: center;
  524. .axis {
  525. display: flex;
  526. align-items: center;
  527. color: #0349a8;
  528. }
  529. }
  530. .debug_main {
  531. display: flex;
  532. align-items: center;
  533. margin-left: 4rem;
  534. margin-top: 2rem;
  535. .debug_left {
  536. width: 42vw;
  537. height: 18.75rem;
  538. background: #fbfbfb;
  539. height: 70vh;
  540. padding: 2rem;
  541. }
  542. .debug_right {
  543. width: 42vw;
  544. height: 70vh;
  545. background: #fbfbfb;
  546. margin-left: 2rem;
  547. padding: 2rem;
  548. }
  549. }
  550. </style>