From 25184cadd4011856d95e76f1d79b37ce51a3e548 Mon Sep 17 00:00:00 2001
From: chengsc <Demo@DESKTOP-CPA90BF>
Date: 星期三, 30 十月 2024 11:34:12 +0800
Subject: [PATCH] 修改问题
---
Web/src/views/device/deviceInfo/index.vue | 4
Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs | 75 ++++++++++++++++++
Web/src/views/device/alarmManage/index.vue | 45 ++++++----
Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs | 12 +++
Web/src/api/wcs/wcsDevice.ts | 16 ++++
Web/src/views/device/deviceStartStop/index.vue | 65 +++++++++++-----
6 files changed, 175 insertions(+), 42 deletions(-)
diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
index 5fb16db..2428bf4 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/Dto/WcsDeviceInput.cs
@@ -363,6 +363,18 @@
}
+public class WcsDeviceStartStop
+{
+ /// <summary>
+ /// 鎿嶄綔绫诲瀷
+ /// </summary>
+ public string Type { get; set; }
+ /// <summary>
+ /// 妤煎眰
+ /// </summary>
+ public string Layer { get; set; }
+}
+
diff --git a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
index 0b6596b..ee6a929 100644
--- a/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
+++ b/Admin.NET/WCS.Application/Service/WcsDevice/WcsDeviceService.cs
@@ -375,6 +375,81 @@
}
+
+ /// <summary>
+ /// 鎵嬪姩鍐欏叆PLC鍚仠淇℃伅
+ /// </summary>
+ /// <param name="input"></param>
+ /// <returns></returns>
+ [HttpPost]
+ [ApiDescriptionSettings(Name = "WriteStartStop")]
+ [DisplayName("鍐欏叆PLC鍚仠淇℃伅")]
+ public async Task WriteStartStop(WcsDeviceStartStop input)
+ {
+ WcsPlc modPlc;
+ string DbNum = "";// DB鍧�
+
+
+ var plcList = await _wcsPlcRep.Context.Queryable<WcsPlc>().Where(s => s.Type == PLCTypeEnum.ConveyorLine && s.IsDelete == false).ToListAsync();
+ if (input.Layer == "1")
+ {
+ modPlc = plcList.FirstOrDefault(m => m.Text == "1灞傛墭鐩樿緭閫佺嚎");
+ if (modPlc == null)
+ throw Oops.Bah($"鏈煡璇㈠埌1妤煎眰PLC淇℃伅");
+ DbNum = "";
+ }
+ else if (input.Layer == "2")
+ {
+ modPlc = plcList.FirstOrDefault(m => m.Text == "2灞傛墭鐩樿緭閫佺嚎");
+ if (modPlc == null)
+ throw Oops.Bah($"鏈煡璇㈠埌2妤煎眰PLC淇℃伅");
+ DbNum = "91";
+ PLCUtil modUtil = new PLCUtil(modPlc);
+ switch (input.Type)
+ {
+ case "TwoPalletStart":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.0", "true");
+ break;
+ case "OnePalletStop":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.1", "true");
+ break;
+ case "TwoMaStart":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.0", "true");
+ break;
+ case "TwoMaStop":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.1", "true");
+ break;
+ case "TwoMaTwoStart":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.2", "true");
+ break;
+ case "TwoMaTwoStop":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "58.3", "true");
+ break;
+ case "TwoBoxStart":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.2", "true");
+ break;
+ case "TwoBoxStop":
+ modUtil.SetPlcDBValue(PLCDataTypeEnum.Bit, DbNum, "46.3", "true");
+ break;
+ default:
+ break;
+ }
+ modUtil.Close();
+ }
+ else if (input.Layer == "3")
+ {
+ modPlc = plcList.FirstOrDefault(m => m.Text == "3灞傛墭鐩樿緭閫佺嚎");
+ if (modPlc == null)
+ throw Oops.Bah($"鏈煡璇㈠埌3妤煎眰PLC淇℃伅");
+ DbNum = "";
+ }
+ else
+ {
+ throw Oops.Bah("鎿嶄綔绫诲瀷淇℃伅閿欒");
+ }
+
+ }
+
#endregion
/// <summary>
diff --git a/Web/src/api/wcs/wcsDevice.ts b/Web/src/api/wcs/wcsDevice.ts
index 33f31fb..1211e99 100644
--- a/Web/src/api/wcs/wcsDevice.ts
+++ b/Web/src/api/wcs/wcsDevice.ts
@@ -17,6 +17,8 @@
WriteInfo = '/api/wcsDevice/WriteInfo',
+ WriteTaskInfo = '/api/wcsDevice/WriteTaskInfo',
+ WriteStartStop = '/api/wcsDevice/WriteStartStop',
}
// 澧炲姞璁惧淇℃伅
export const WriteInfo = (params?: any) =>
@@ -25,6 +27,20 @@
method: 'post',
data: params,
});
+// 澧炲姞璁惧淇℃伅
+export const WriteTaskInfo = (params?: any) =>
+ request({
+ url: Api.WriteTaskInfo,
+ method: 'post',
+ data: params,
+ });
+// 澧炲姞璁惧淇℃伅
+export const WriteStartStop = (params?: any) =>
+ request({
+ url: Api.WriteStartStop,
+ method: 'post',
+ data: params,
+ });
// 澧炲姞璁惧淇℃伅
export const addWcsDevice = (params?: any) =>
diff --git a/Web/src/views/device/alarmManage/index.vue b/Web/src/views/device/alarmManage/index.vue
index a69788f..13e490c 100644
--- a/Web/src/views/device/alarmManage/index.vue
+++ b/Web/src/views/device/alarmManage/index.vue
@@ -11,9 +11,10 @@
<el-table-column prop="alarmName" label="鎻忚堪" align="center"></el-table-column>
<el-table-column prop="stationNum" label="浣嶇疆" align="center"></el-table-column>
<el-table-column prop="alarmTime" label="鏃堕棿" align="center"></el-table-column>
- <el-table-column label="鎿嶄綔" width="80" align="center" fixed="right" show-overflow-tooltip="" >
+ <el-table-column label="鎿嶄綔" width="80" align="center" fixed="right" show-overflow-tooltip="">
<template #default="scope">
- <el-button icon="ele-Check" size="small" text="" type="primary" @click="topUpAlarm(scope.row)" >鎭㈠</el-button>
+ <el-button icon="ele-Check" size="small" text="" type="primary"
+ @click="topUpAlarm(scope.row)">鎭㈠</el-button>
</template>
</el-table-column>
</el-table>
@@ -195,7 +196,7 @@
// row.Layer = 3;
// }
// row.TypeName = type;
-
+
// console.log(row);
// var res = await WriteInfo(row);
// console.log(res.data.result);
@@ -203,22 +204,28 @@
// }
//鎶ヨ鎭㈠
const topUpAlarm = async (row: any) => {
- ElMessageBox.confirm(`纭畾瑕佹姤璀︽仮澶嶄换鍔″悧?`, "鎻愮ず", {
- confirmButtonText: "纭畾",
- cancelButtonText: "鍙栨秷",
- type: "warning",
- })
- .then(async () => {
- var param = Object.assign(row);
- console.log(row.stationNum);
- console.log(param);
-
- // await topUpWcsTask(param);
- // handleQuery();
- // handleQuery2();
- ElMessage.success("缃《浠诲姟鎴愬姛"+param);
- })
- .catch(() => { });
+ ElMessageBox.confirm(`纭畾瑕佹姤璀︽仮澶嶄换鍔″悧?`, "鎻愮ず", {
+ confirmButtonText: "纭畾",
+ cancelButtonText: "鍙栨秷",
+ type: "warning",
+ })
+ .then(async () => {
+ var param = Object.assign(row);
+ console.log(row.stationNum);
+ console.log(layer.value);
+ var data = {
+ LocatNo: row.stationNum,//宸ヤ綅
+ Layer: layer.value,//妤煎眰
+ }
+
+ var res = await WriteInfo(data);
+ console.log(res.data.result);
+ // await topUpWcsTask(param);
+ // handleQuery();
+ // handleQuery2();
+ // ElMessage.success("鎶ヨ鎭㈠澶辫触锛�" + res.data.result);
+ })
+ .catch(() => { });
}
diff --git a/Web/src/views/device/deviceInfo/index.vue b/Web/src/views/device/deviceInfo/index.vue
index 9a90978..d422c71 100644
--- a/Web/src/views/device/deviceInfo/index.vue
+++ b/Web/src/views/device/deviceInfo/index.vue
@@ -198,7 +198,7 @@
<script lang="ts" setup>
import { ref, reactive, onMounted } from 'vue';
import { listStatus, listPosition } from '/@/api/wcs/wcsPlc';
-import { WriteInfo } from '/@/api/wcs/wcsDevice';
+import { WriteInfo,WriteTaskInfo } from '/@/api/wcs/wcsDevice';
import { signalR } from './signalR';
import { cellsDataLine, cellsDataOne, cellsDataTwo, cellsDataThree } from './data';
import { ElMessage } from "element-plus";
@@ -436,7 +436,7 @@
row.Layer = 3;
}
row.TypeName = type;
- var res = await WriteInfo(row);
+ var res = await WriteTaskInfo(row);
console.log(type+"鎶捣浜嬩欢");
// ElMessage.success('asdf'+ res.data.result);
diff --git a/Web/src/views/device/deviceStartStop/index.vue b/Web/src/views/device/deviceStartStop/index.vue
index a1d5f65..a197f3c 100644
--- a/Web/src/views/device/deviceStartStop/index.vue
+++ b/Web/src/views/device/deviceStartStop/index.vue
@@ -2,23 +2,27 @@
<el-row :gutter="10">
<el-col :span="8">
<el-collapse v-model="activeNames">
- <el-collapse-item title="浠撳簱浜屽眰" name="1">
+ <el-collapse-item title="浠撳簱涓�灞�" name="1">
<el-card class="box-card" shadow="hover">
- <el-switch v-model="state.boRunningState" active-text="" inactive-text="鎵樼洏杈撻��"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鎵樼洏杈撻��</el-text>
+ <el-button @click="write('OnePalletStart','1')">鍚姩</el-button>
+ <el-button @click="write('OnePalletStop','1')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="鎷嗚泛鏈哄櫒浜�1"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鎷嗚泛鏈哄櫒浜�1</el-text>
+ <el-button @click="write('OneChaiStart','1')">鍚姩</el-button>
+ <el-button @click="write('OneChaiStop','1')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="鎷嗚泛鏈哄櫒浜�2"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鎷嗚泛鏈哄櫒浜�2</el-text>
+ <el-button @click="write('OneChaiTwoStart','1')">鍚姩</el-button>
+ <el-button @click="write('OneChaiTwoStop','1')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="浠剁杈撻��"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">浠剁杈撻��</el-text>
+ <el-button @click="write('OneBoxStart','1')">鍚姩</el-button>
+ <el-button @click="write('OneBoxStop','1')">鍋滄</el-button>
</el-card>
</el-collapse-item>
</el-collapse>
@@ -28,21 +32,25 @@
<el-collapse v-model="activeNames2">
<el-collapse-item title="浠撳簱浜屽眰" name="2">
<el-card class="box-card" shadow="hover">
- <el-switch active-text="" inactive-text="鎵樼洏杈撻��"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鎵樼洏杈撻��</el-text>
+ <el-button @click="write('TwoPalletStart','2')">鍚姩</el-button>
+ <el-button @click="write('TwoPalletStop','2')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="鐮佸灈鏈哄櫒浜�1"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鐮佽泛鏈哄櫒浜�1</el-text>
+ <el-button @click="write('TwoMaStart','2')">鍚姩</el-button>
+ <el-button @click="write('TwoMaStop','2')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="鐮佸灈鏈哄櫒浜�2"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鐮佽泛鏈哄櫒浜�2</el-text>
+ <el-button @click="write('TwoMaTwoStart','2')">鍚姩</el-button>
+ <el-button @click="write('TwoMaTwoStop','2')">鍋滄</el-button>
</el-card>
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="浠剁杈撻��"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">浠剁杈撻��</el-text>
+ <el-button @click="write('TwoBoxStart','2')">鍚姩</el-button>
+ <el-button @click="write('TwoBoxStop','2')">鍋滄</el-button>
</el-card>
</el-collapse-item>
</el-collapse>
@@ -52,8 +60,9 @@
<el-collapse v-model="activeNames3">
<el-collapse-item title="浠撳簱涓夊眰" name="3">
<el-card class="box-card" shadow="hover" style="margin-top: 3px;">
- <el-switch active-text="" inactive-text="鎵樼洏杈撻��"
- @change=""></el-switch>
+ <el-text style="margin-right: 15px;">鎵樼洏杈撻��</el-text>
+ <el-button @click="write('ThreePalletStart','3')">鍚姩</el-button>
+ <el-button @click="write('ThreePalletStop','3')">鍋滄</el-button>
</el-card>
</el-collapse-item>
</el-collapse>
@@ -65,7 +74,11 @@
<script lang="ts" setup>
-import { ref } from 'vue';
+
+import { ref, reactive, onMounted } from 'vue';
+import { listStatus, listPosition } from '/@/api/wcs/wcsPlc';
+import { WriteStartStop } from '/@/api/wcs/wcsDevice';
+import { ElMessage } from "element-plus";
const activeNames = ref(['1'])
const activeNames2 = ref(['2'])
@@ -73,7 +86,17 @@
const state = ref<any>({});
-
+const write = async (type: string,layer: string) => {
+
+ var data = {
+ Type:type,
+ Layer: layer
+ };
+
+ var res = await WriteStartStop(data);
+ console.log(res.data.result);
+ // ElMessage.success(res.data.result);
+}
</script>
--
Gitblit v1.8.0