CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -442,5 +442,12 @@ "D04.State": "D04.状态", "D05.State": "D05.状态", "D06.State": "D06.状态" } }, "Automatic State":"自动状态", "ManualJog":"开关控制", "ManualonePosition":"手动定位", "Servomanualone":"半自动", "Address parameter settings":"地址参数设置", "Speed parameter settings":"速度参数设置" } CanadaMes-ui/src/layout/index.vue
@@ -102,10 +102,18 @@ <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column> </el-table> </el-dialog> <el-dialog :visible.sync="dialogFormCountDown" :title="$t('Approximately resettable time')" top="5vh"> <div :style="'font-size: ' + PromptSize + 'px;text-align: center;'"> <!-- {{ this.CountDowns }} --> {{ this.CountDowns }} </div> </el-dialog> <el-dialog :visible.sync="dialogFormVisible3" > <el-button :class="{ 'blue-button': receivedData === 1 }" @click="toggleButtonValue(1)">{{ $t('A01Abort/ResumeTasks') }}</el-button> <el-button :class="{ 'blue-button': receivedData2 === 1 }" @click="toggleButtonValue(2)">{{ $t('A02Abort/ResumeTasks') }}</el-button> <el-button :class="{ 'blue-button': receivedData === 1 }" @click="toggleButtonValue(1)">{{ $t('A01Abort/ResumeTasks') }}</el-button> <el-button :class="{ 'blue-button': receivedData2 === 1 }" @click="toggleButtonValue(2)">{{ $t('A02Abort/ResumeTasks') }}</el-button> </el-dialog> @@ -149,7 +157,12 @@ dialogFormVisible2: false, dialogFormVisible3: false, alarm: [], alarm2: [] alarm2: [], CountDowns: "0", EmergencyStop: false, PromptSize: 250, dialogFormCountDown:false } }, // components: { @@ -255,6 +268,22 @@ this.alarm = obj.alarmmg[0]; this.dialogFormVisible2 = false; } //是否急停 if (obj.emergencystop != null) { this.EmergencyStop = obj.emergencystop[0]; } //复位倒计时 if (obj.countdown != null) { if ((obj.countdown[0] == true && this.CountDowns == 0) || this.EmergencyStop == true) { this.CountDown(); } } //复位完成信号 if (obj.reset != null) { this.reset = obj.reset[0]; } } @@ -283,6 +312,36 @@ console.log("websocket发生了错误"); } } }, //45秒复位倒数计时 CountDown() { let count = 45; let timer = setInterval( () => { if (this.EmergencyStop == true) { this.dialogFormCountDown = false; clearInterval(timer); this.CountDowns = "0"; } else { if (count > 0) { this.PromptSize = 500; this.CountDowns = count; count--; this.dialogFormCountDown = true; } else { this.PromptSize = 200; this.CountDowns = "Waiting for reset"; if (this.reset == true) { clearInterval(timer); this.dialogFormCountDown = false; } } } }, 1000 ); }, logout: function () { removeToken() @@ -436,10 +495,12 @@ margin-left: 10px; } } .blue-button { background-color: green; color: white; } .el-header { background-color: #576574; springboot-vue3/src/main/java/com/example/springboot/component/MessageHandler.java
@@ -204,6 +204,17 @@ public short[] convertBooleanListToShortArray(List<Boolean> booleanList) { short[] shortArray = new short[booleanList.size()]; for (int i = 0; i < booleanList.size(); i++) { boolean value = booleanList.get(i); shortArray[i] = value ? (short) 1 : (short) 0; } return shortArray; } springboot-vue3/src/main/java/com/example/springboot/component/PlcManualonePosition.java
@@ -206,7 +206,6 @@ // 写入A02 customS7Control.WriteWordToPLC(messageArray, addresses2, 1); // 写入B01 customS7Control.WriteWordToPLC(messageArray, addresses3, 2); springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter2.java
@@ -15,20 +15,13 @@ import java.util.List; public class PlcParameter2 extends Thread { @Autowired StorageCageService storageCageService; // 用于存储应用程序的配置信息 private Configuration config; // 创建一个自定义的 S7 控制器消息处理器对象 MessageHandler customS7Control = new MessageHandler(); // 用于存储应用程序的配置信息 private Configuration config; public PlcParameter2() throws IOException { @@ -49,7 +42,7 @@ List<String> addressList1 = Arrays.asList(config.getProperty("Parameter2.id").split(",")); List<String> paramlist = S7control.getinstance().readStrings(addressList1); // System.out.println("addressList:" + paramlist); // System.out.println(paramlist); //手动状态 List<String> addresses = Arrays.asList(config.getProperty("Parameter2.state").split(",")); @@ -82,7 +75,7 @@ List<Short> data4 = S7control.getinstance().readWords(addresses4); //System.out.println(data); // List<Long> TIME2 = Collections.singletonList(S7control.getinstance().readtime("DB100.194")); // System.out.println("addressList:" + TIME2); @@ -104,19 +97,22 @@ // List<Short> data4 = new ArrayList<>(Arrays.asList(values4)); // // // JSONObject jsonObject = new JSONObject(); // short[] params = new short[data2.size()]; // for (int i = 0; i < data2.size(); i++) { // boolean value = data2.get(i); // params[i] = value ? (short) 1 : (short) 0; // } //// // short[] anniuparams = new short[anniuread.size()]; // for (int i = 0; i < anniuread.size(); i++) { // boolean value = anniuread.get(i); // anniuparams[i] = value ? (short) 1 : (short) 0; // } //boolean转为0 1 short[] params = customS7Control.convertBooleanListToShortArray(data2); short[] anniuparams = customS7Control.convertBooleanListToShortArray(anniuread); JSONObject jsonObject = new JSONObject(); short[] params = new short[data2.size()]; for (int i = 0; i < data2.size(); i++) { boolean value = data2.get(i); params[i] = value ? (short) 1 : (short) 0; } // short[] anniuparams = new short[anniuread.size()]; for (int i = 0; i < anniuread.size(); i++) { boolean value = anniuread.get(i); anniuparams[i] = value ? (short) 1 : (short) 0; } jsonObject.append("params", params); jsonObject.append("params", paramlist); jsonObject.append("params", data); @@ -141,7 +137,6 @@ if (webserver != null) { List<String> messages = webserver.getMessages(); @@ -175,10 +170,6 @@ // 将布尔值添加到布尔值列表中 sValue.add(val); System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); } catch (NumberFormatException e) { @@ -229,9 +220,6 @@ } catch (Exception e) { System.err.println("An error occurred while writing bit to PLC: " + e.getMessage()); } //急停 @@ -289,8 +277,6 @@ } catch (Exception e) { System.err.println("An error occurred while writing bit to PLC: " + e.getMessage()); } //存片等待延迟 springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -353,7 +353,7 @@ try { return s7PLC.readTime(address); } catch (Exception e) { e.printStackTrace(); System.out.println("读取 " + address + " 失败:" + e.getMessage()); return null; } } springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -19,22 +19,22 @@ //new PlcHold().start(); // new Plchome().start(); // // new Plcalarm().start(); // // new Plcsign().start(); // // // new Plcstate().start(); // new PlcPositioning1().start(); // // new PlcParameter2().start(); // // new PLCAutomaticParameterSetting().start(); // new PlcManualonePosition().start(); // new PlcManualonePosition2().start(); // new PlcServoManualone().start(); // new PLCManualJog().start(); new Plchome().start(); new Plcalarm().start(); new Plcsign().start(); new Plcstate().start(); new PlcPositioning1().start(); new PlcParameter2().start(); new PLCAutomaticParameterSetting().start(); new PlcManualonePosition().start(); new PlcManualonePosition2().start(); new PlcServoManualone().start(); new PLCManualJog().start(); } } springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -35,6 +35,8 @@ @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width from storage_cage where cage<=5 group by cage,cell order by cage desc,cell desc") List<StorageCage> selectRack4(); // 根据任务类型查询当前正在出片,进片的玻璃信息 @Select("select * from storage_cage where state=#{task_type}") List<StorageCage> selectinout(@Param("task_type") Integer task_type);