Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes
| | |
| | | "This glass is already in the Queue":"This glass is already in the Queue",
|
| | | "Complete":"Complete",
|
| | | "Not Allow":"Not Allow",
|
| | | "Completed":"Completed",
|
| | | "Waiting":"Waiting",
|
| | | "Deleted":"Deleted",
|
| | | "Glass State":"Glass State",
|
| | | "Absent":"Absent",
|
| | | "ServoManualone": {
|
| | | "A01 所在格子": "A01 Current Grid",
|
| | | "数量": "Quantity",
|
| | |
| | | "This glass is already in the Queue":"此玻璃已在出片队列中",
|
| | | "Complete":"完成",
|
| | | "Not Allow":"不允许",
|
| | | "Completed":"已完成",
|
| | | "Waiting":"等待中",
|
| | | "Deleted":"已删除",
|
| | | "Glass State":"玻璃状态",
|
| | | "Absent":"不存在",
|
| | | "langparameter": {
|
| | | "conveyor Velocity(Auto FAST)": "D01-D06 皮带输送自动快速",
|
| | | "conveyor Velocity(Auto SLOW)": "D01-D06 皮带输送自动慢速",
|
| | |
| | | </el-form>
|
| | | <template #footer>
|
| | | <span class="dialog-footer">
|
| | | <el-button @click="sbumitglassid()" :style="{ display: confirm1 == true ? '' : 'none' }"
|
| | | <!-- <el-button @click="sbumitglassid()" :style="{ display: confirm1 == true ? '' : 'none' }"
|
| | | type="primary">{{
|
| | | $t('confirm') }}</el-button>
|
| | | $t('confirm') }}</el-button> -->
|
| | | <el-button @click="FeedInglassid()" :style="{ display: confirm2 == true ? '' : 'none' }"
|
| | | type="primary">{{
|
| | | $t('confirm') }}</el-button>
|
| | |
| | | <el-table-column :min-width="100" prop="orderId" :label="$t('Order No')"></el-table-column>
|
| | | <el-table-column :min-width="80" prop="listId" :label="$t('List No')"></el-table-column>
|
| | | <el-table-column :min-width="100" prop="boxId" :label="$t('Box No')"></el-table-column>
|
| | | <el-table-column :min-width="90" prop="state" :label="$t('State')">
|
| | | <el-table-column :min-width="90" prop="state" :label="$t('Glass State')">
|
| | | <template slot-scope='scope'>
|
| | | {{
|
| | | scope.row.state == 1 ? $t('Normal') : scope.row.state == 2 ? $t('Entering') : scope.row.state == 3 ?
|
| | |
| | | </el-table-column>
|
| | | <el-table-column :min-width="250" :label="$t('Operate')">
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="scope.row.state == 1 ? false : true"
|
| | | @click="deleteglass(scope.row.glassId, scope.row.state)">{{ $t('Delete') }}</el-button>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;"
|
| | | :disabled="scope.row.state == 1 ? false : true"
|
| | |
| | | }}</el-button>
|
| | | <el-table :data="this.OutSlice" :height="700" :span-method="objectSpanMethod" border :cell-style="cellStyle"
|
| | | style="width: 100%;overflow: auto;">
|
| | | <el-table-column prop="glassId" :label="$t('Barcode')"></el-table-column>
|
| | | <el-table-column :min-width="100" prop="glassId" :label="$t('Barcode')"></el-table-column>
|
| | | <el-table-column prop="storageCage.orderId" :label="$t('Order No')"></el-table-column>
|
| | | <el-table-column prop="storageCage.listId" :label="$t('List No')"></el-table-column>
|
| | | <el-table-column prop="storageCage.boxId" :label="$t('Box No')"></el-table-column>
|
| | | <el-table-column prop="storageCage.glasswidthmm" :label="$t('Length')"></el-table-column>
|
| | | <el-table-column prop="storageCage.glassheightmm" :label="$t('Width')"></el-table-column>
|
| | | <el-table-column prop="state" :label="$t('State')">
|
| | | <el-table-column prop="state" :label="$t('Glass State')">
|
| | | <template slot-scope='scope'>
|
| | | {{ scope.row.state == 0 ? "Waiting" : scope.row.state == 1 ?"Outing":"Completed" }}
|
| | | {{ scope.row.state == 0 ? $t('Waiting') : scope.row.state == 1 ? $t('Outing') : scope.row.state == 2 ? $t('Completed') :scope.row.state == 3 ? $t('Absent') :$t('Deleted') }}
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column prop="sequence" :label="$t('Sequence')"></el-table-column>
|
| | | <el-table-column prop="position" :label="$t('Position')">
|
| | | <el-table-column prop="position" :label="$t('Position')" style="font-size: 20px;">
|
| | | <template slot-scope='scope'>
|
| | | {{ scope.row.position==1?$t('Yes'):$t('No') }}
|
| | | {{ scope.row.position == 1 ? "▄▄▄" : "▋" }}
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column prop="position" :label="$t('Flip')">
|
| | | <template slot-scope='scope'>
|
| | | {{ scope.row.flip==1?$t('Yes'):$t('No') }}
|
| | | {{ scope.row.flip == 1 ? $t('Yes') : $t('No') }}
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column prop="barcode" :label="$t('Frame No')"></el-table-column>
|
| | |
|
| | | <el-table-column prop="barcode" :label="$t('Complete')">
|
| | | <template slot-scope='scope'>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="!isAllowQueue"
|
| | | @click="CompleteQueue(scope.row.id,scope.row.barcode,scope.row.glassId)">{{ $t('Complete') }}</el-button>
|
| | | <el-button type="primary" style="padding: 4px 10px;font-size: 12px;" :disabled="(!isAllowQueue||scope.row.state!=1)"
|
| | | @click="CompleteQueue(scope.row.id, scope.row.barcode, scope.row.glassId)">{{ $t('Complete')
|
| | | }}</el-button>
|
| | | </template>
|
| | | </el-table-column>
|
| | | <el-table-column :width="280" :label="$t('Operate')">
|
| | |
| | | OutingQueue: true,
|
| | | OrderInfo: true,
|
| | | CageDetails: true,
|
| | | |
| | |
|
| | | };
|
| | | },
|
| | | created() {
|
| | |
| | | }
|
| | | ,
|
| | | methods: {
|
| | | |
| | | |
| | |
|
| | |
|
| | | init() {
|
| | | let viewname = "Home";
|
| | | if (typeof (WebSocket) == "undefined") {
|
| | |
| | | if (res.data.message == 200) {
|
| | | this.dialogFormVisible1 = false;
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | |
|
| | | } else {
|
| | | this.$message.error(this.$t('There is no glass for this order'));
|
| | | }
|
| | |
| | | },
|
| | | //手动上片
|
| | | FeedInglassid() {
|
| | | Inglassid(this.insertcage, this.insertcell, this.inserttier, this.form).then(res => {
|
| | | if (this.form.barcode != "") {
|
| | | if (this.form.glassId != ""&&this.form.glassId != null) {
|
| | | Inglassid(this.insertcage, this.insertcell, this.inserttier, this.form).then(res => {
|
| | | if (res.data.message == 200) {
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | | this.dialogFormVisible = false;
|
| | | } else {
|
| | | }
|
| | | else if (res.data.message == 400) {
|
| | | this.$message.error(this.$t('The glass size is not within the range'));
|
| | | }
|
| | | else if (res.data.message == 300) {
|
| | | this.$message.error(this.$t('This glass is already in the cage'));
|
| | | }
|
| | | } else {
|
| | | this.$message.error(this.$t('There is no such glass'));
|
| | | }
|
| | | });
|
| | | } else {
|
| | | this.$message.error(this.$t('There is no such glass'));
|
| | | }
|
| | |
|
| | | });
|
| | |
|
| | | },
|
| | | //启用//理片笼禁用
|
| | | UpdateDisabled(cage, cell, disabled) {
|
| | |
| | | });
|
| | | }
|
| | | ,
|
| | | cellStyle({ row, column, rowIndex, columnIndex }) {
|
| | | // console.log(row, column, "ss");
|
| | | column=rowIndex;
|
| | | rowIndex=column;
|
| | | let style="";
|
| | | if (columnIndex === 8&&row.position==1) {
|
| | | style="background-Color:yellow;";
|
| | | }
|
| | | if (columnIndex === 9&&row.flip==1) {
|
| | | style="background-Color:yellow;";
|
| | | }
|
| | | return style;
|
| | | }
|
| | | cellStyle({ row, column, rowIndex, columnIndex }) {
|
| | | // console.log(row, column, "ss");
|
| | | column = rowIndex;
|
| | | rowIndex = column;
|
| | | let style = "";
|
| | | if (columnIndex === 8 ) {
|
| | | style = "font-size:25px;";
|
| | | }
|
| | | if (columnIndex === 9 && row.flip == 1) {
|
| | | style = "background-Color:yellow;";
|
| | | }
|
| | | style
|
| | | return style;
|
| | | }
|
| | | ,
|
| | | //合并行
|
| | | objectSpanMethod({ row, column, rowIndex, columnIndex }) {
|
| | |
| | | this.form5 = {};
|
| | | },
|
| | | //手动完成出片任务
|
| | | CompleteQueue(id,frameid,glassid) {
|
| | | CompleteQueue(id,frameid,glassid).then(res => {
|
| | | CompleteQueue(id, frameid, glassid) {
|
| | | CompleteQueue(id, frameid, glassid).then(res => {
|
| | | if (res.data.message == 200) {
|
| | | this.$message.success(this.$t('Operation successful'));
|
| | | }
|
| New file |
| | |
| | | package com.example.springboot.component;
|
| | | import cn.hutool.json.JSONArray;
|
| | | import com.example.springboot.component.*;
|
| | | import com.google.common.primitives.Bytes;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | |
|
| | | public class MessageHandler {
|
| | | //写入byte
|
| | | public void outmesid(String glassid,String address) {
|
| | | //System.out.println("outmesid:" + glassid);
|
| | | List<Byte> glassidlist = new ArrayList();
|
| | | char ds[]=glassid.toCharArray();
|
| | | for (char iditem : ds) {
|
| | | glassidlist.add((byte)iditem);
|
| | | }
|
| | | byte[] bytes = Bytes.toArray(glassidlist);
|
| | | System.out.println("outmesidbytes:" + bytes.length);
|
| | | S7control.getinstance().WriteByte(address, bytes);
|
| | | }
|
| | | //写入bit
|
| | | public void writeBitToPLC( JSONArray messageArray,List<String> addresses, int index) {
|
| | | if (messageArray.getJSONArray(index).size() > 0) {
|
| | | JSONArray jsonArray = messageArray.getJSONArray(index);
|
| | | List<Boolean> sValue = new ArrayList<>();
|
| | | for (int i = 0; i < jsonArray.size(); i++) {
|
| | | Object value = jsonArray.get(i);
|
| | | if (value != null && !value.toString().equals("null")) {
|
| | | try {
|
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
|
| | | boolean val = "1".equals(cleanedValue.trim());
|
| | | sValue.add(val);
|
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list");
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为 boolean 类型,则忽略该部分
|
| | | System.err.println("Could not parse value: " + value);
|
| | | }
|
| | | }
|
| | | }
|
| | | if (!sValue.isEmpty()) {
|
| | | // 这里假设 S7control.getinstance().WriteBit 方法可以正确写入 sValue 到地址列表 addresses
|
| | | S7control.getinstance().WriteBit(addresses, sValue);
|
| | | System.out.println("Values " + sValue + " written to PLC at address " + addresses);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | //写入Word
|
| | | public void WriteWordToPLC( JSONArray messageArray,List<String> addresses, int index) {
|
| | | if (messageArray.getJSONArray(index).size() > 0) {
|
| | | JSONArray jsonArray = messageArray.getJSONArray(index);
|
| | | List<Short> sValues = new ArrayList<>();
|
| | |
|
| | | for (int i = 0; i < jsonArray.size(); i++) {
|
| | | Object value = jsonArray.get(i);
|
| | |
|
| | | if (value != null && !value.toString().equals("null")) {
|
| | | try {
|
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", "");
|
| | | short val = Short.parseShort(cleanedValue.trim());
|
| | | sValues.add(val);
|
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list");
|
| | | } catch (NumberFormatException e) {
|
| | | // 如果无法解析为 short 类型,则忽略该部分
|
| | | System.err.println("Could not parse value: " + value);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (!sValues.isEmpty()) {
|
| | | S7control.getinstance().WriteWord(addresses.get(index), sValues);
|
| | | System.out.println("Values " + sValues + " written to PLC at address " + addresses.get(index));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //写入String
|
| | | public void writeStringToPLC( JSONArray messageArray, String addresses,int index) {
|
| | | if (messageArray.getJSONArray(index).size() > 0) {
|
| | | JSONArray jsonArray = messageArray.getJSONArray(index);
|
| | |
|
| | | if (!jsonArray.isEmpty()) {
|
| | | String value = (String) jsonArray.get(0);
|
| | | outmesid(value.trim(), addresses);
|
| | | System.out.println("Value " + value + " written to PLC at address " + addresses);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | } |
| | |
| | | public class PlcServoManualone extends Thread { |
| | | |
| | | |
| | | |
| | | // 用于存储应用程序的配置信息 |
| | | private Configuration config; |
| | | |
| | | // 创建一个自定义的 S7 控制器消息处理器对象 |
| | | MessageHandler customS7Control = new MessageHandler(); |
| | | |
| | | |
| | | public PlcServoManualone() throws IOException { |
| | | config = new Configuration("config.properties"); |
| | | } |
| | | |
| | | //将布尔列表转换为二进制的 short 数组 |
| | | public static class PLCBooleanConverter { |
| | | |
| | | public static short[] convertListsToBinaryShortArray(List<Boolean>... lists) { |
| | |
| | | } |
| | | return writedstrIdOut; |
| | | } |
| | | //写入id |
| | | public void outmesid(String glassid,String address) { |
| | | //System.out.println("outmesid:" + glassid); |
| | | List<Byte> glassidlist = new ArrayList(); |
| | | char ds[]=glassid.toCharArray(); |
| | | for (char iditem : ds) { |
| | | glassidlist.add((byte)iditem); |
| | | } |
| | | byte[] bytes = Bytes.toArray(glassidlist); |
| | | System.out.println("outmesidbytes:" + bytes.length); |
| | | S7control.getinstance().WriteByte(address, bytes); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void run() { |
| | |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | |
| | | |
| | | //A01组合中地址表集合 |
| | | List<String> addresses = Arrays.asList(config.getProperty("A01.addresses").split(",")); |
| | |
| | | StringBuilder queueid1 = queGlassid(inputGlassIdAddress, 14); |
| | | // 存片id地址 |
| | | StringBuilder queueid2 = queGlassid(outputGlassIdAddress, 14); |
| | | |
| | | //A01 A02启动 半自动启动 |
| | | List<Boolean> A01readstart = S7control.getinstance().readBits(A01start); |
| | | List<Boolean> A02readstart = S7control.getinstance().readBits(A02start); |
| | | List<Boolean> A01readBstart = S7control.getinstance().readBits(A01Bstart); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //所有未回零按钮转换为1和0 |
| | | List<Boolean> arraylist8 = S7control.getinstance().readBits(addresses8); |
| | | short[] params = new short[arraylist8.size()]; |
| | | for (int i = 0; i < arraylist8.size(); i++) { |
| | |
| | | |
| | | |
| | | // 写入AO1组合 |
| | | if (messageArray.getJSONArray(0).size() > 0) { |
| | | JSONArray jsonArray = messageArray.getJSONArray(0); |
| | | List<Short> sValue = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object value = jsonArray.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | customS7Control.WriteWordToPLC(messageArray, addresses,0); |
| | | if (A01readstart != null && !A01readstart.isEmpty()) { |
| | | // 创建一个新的列表用于写入新值 |
| | | List<Boolean> a01startval = new ArrayList<>(); |
| | | // 遍历所有读取到的位值 |
| | | for (Boolean bit : A01readstart) { |
| | | // 取反当前位的值并添加到新的列表中 |
| | | a01startval.add(!bit); |
| | | } |
| | | if (!sValue.isEmpty()) { |
| | | |
| | | S7control.getinstance().WriteWord(addresses, sValue); |
| | | // 检查是否读取到了位值,并且列表不为空 |
| | | if (A01readstart != null && !A01readstart.isEmpty()) { |
| | | // 创建一个新的列表用于写入新值 |
| | | List<Boolean> a01startval = new ArrayList<>(); |
| | | // 遍历所有读取到的位值 |
| | | for (Boolean bit : A01readstart) { |
| | | // 取反当前位的值并添加到新的列表中 |
| | | a01startval.add(!bit); |
| | | } |
| | | // 写入新的位值列表 |
| | | S7control.getinstance().WriteBit(A01start, a01startval); |
| | | } |
| | | System.out.println("Values " + sValue + " written to PLC at address " + addresses); |
| | | } |
| | | // 写入新的位值列表 |
| | | S7control.getinstance().WriteBit(A01start, a01startval); |
| | | } |
| | | |
| | | |
| | | //// 写入AO2组合 |
| | | if (messageArray.getJSONArray(1).size() > 0) { |
| | | JSONArray jsonArray2 = messageArray.getJSONArray(1); |
| | | List<Short> sValue2 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray2.size(); i++) { |
| | | Object value = jsonArray2.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | short val = Short.parseShort(cleanedValue.trim()); |
| | | sValue2.add(val); |
| | | System.out.println("messageValue:" + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 short 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue2.isEmpty()) { |
| | | S7control.getinstance().WriteWord(addresses2, sValue2); |
| | | |
| | | if (A02readstart != null && !A02readstart.isEmpty()) { |
| | | // 创建一个新的列表用于写入新值 |
| | | List<Boolean> a02startval = new ArrayList<>(); |
| | | // 遍历所有读取到的位值 |
| | | for (Boolean bit : A02readstart) { |
| | | // 取反当前位的值并添加到新的列表中 |
| | | a02startval.add(!bit); |
| | | } |
| | | // 写入新的位值列表 |
| | | S7control.getinstance().WriteBit(A02start, a02startval); |
| | | } |
| | | System.out.println("Values " + sValue2 + " written to PLC at address " + addresses2); |
| | | // 写入AO2组合 |
| | | customS7Control.WriteWordToPLC(messageArray, addresses2,1); |
| | | |
| | | if (A02readstart != null && !A02readstart.isEmpty()) { |
| | | // 创建一个新的列表用于写入新值 |
| | | List<Boolean> a02startval = new ArrayList<>(); |
| | | // 遍历所有读取到的位值 |
| | | for (Boolean bit : A02readstart) { |
| | | // 取反当前位的值并添加到新的列表中 |
| | | a02startval.add(!bit); |
| | | } |
| | | // 写入新的位值列表 |
| | | S7control.getinstance().WriteBit(A02start, a02startval); |
| | | } |
| | | |
| | | |
| | | // 复位按钮写入 |
| | | if (messageArray.getJSONArray(2).size() > 0) { |
| | | JSONArray jsonArray3 = messageArray.getJSONArray(2); |
| | | List<Boolean> sValue3 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray3.size(); i++) { |
| | | Object value = jsonArray3.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValue3.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue3.isEmpty()) { |
| | | S7control.getinstance().WriteBit(Reset, sValue3); |
| | | System.out.println("Values " + sValue3 + " written to PLC at address " + Reset); |
| | | } |
| | | } |
| | | customS7Control.writeBitToPLC( messageArray, Reset,2); |
| | | |
| | | //回零按钮写入 |
| | | if (messageArray.getJSONArray(3).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(3); |
| | | List<Boolean> sValue4 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValue4.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValue4.isEmpty()) { |
| | | S7control.getinstance().WriteBit(waddresses4, sValue4); |
| | | System.out.println("Values " + sValue4 + " written to PLC at address " + waddresses4); |
| | | } |
| | | } |
| | | customS7Control.writeBitToPLC( messageArray, waddresses4,3); |
| | | |
| | | |
| | | //取片ID写入 |
| | | if (messageArray.getJSONArray(5).size() > 0) { |
| | | // JSONArray jsonArray5 = messageArray.getJSONArray(4); |
| | | String jsonArray5 = String.valueOf(messageArray.getJSONArray(5)); |
| | | if (!jsonArray5.isEmpty()) { |
| | | // String value = (String) jsonArray5.get(0); |
| | | jsonArray5 = jsonArray5.replaceAll("[\\[\\]\"]", ""); // 去除方括号和双引号 |
| | | outmesid(jsonArray5, outputGlassIdAddress); |
| | | System.out.println("Values1 " + jsonArray5 + " written to PLC at address " + outputGlassIdAddress); |
| | | } |
| | | } |
| | | // 进片ID写入 |
| | | if (messageArray.getJSONArray(4).size() > 0) { |
| | | JSONArray jsonArray6 = messageArray.getJSONArray(4); |
| | | customS7Control.writeStringToPLC( messageArray,inputGlassIdAddress,4); |
| | | //取片ID写入 |
| | | customS7Control.writeStringToPLC( messageArray,outputGlassIdAddress,5); |
| | | |
| | | if (!jsonArray6.isEmpty()) { |
| | | String value2 = (String) jsonArray6.get(0); |
| | | outmesid(value2.trim(), inputGlassIdAddress); |
| | | System.out.println("Values2 " + value2 + " written to PLC at address " + inputGlassIdAddress); |
| | | } |
| | | } |
| | | //A01半自动 |
| | | customS7Control.writeBitToPLC( messageArray, A01Bstart,6); |
| | | |
| | | |
| | | if (messageArray.getJSONArray(6).size() > 0) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(6); |
| | | List<Boolean> sValueb4 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValueb4.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValueb4.isEmpty()) { |
| | | |
| | | S7control.getinstance().WriteBit(A01Bstart, sValueb4); |
| | | System.out.println("Values " + sValueb4 + " written to PLC at address " + A01Bstart); |
| | | } |
| | | } |
| | | |
| | | |
| | | if (messageArray.getJSONArray(7).size() > 0 && !messageArray.isNull(7)) { |
| | | JSONArray jsonArray4 = messageArray.getJSONArray(7); |
| | | List<Boolean> sValueb5 = new ArrayList<>(); |
| | | for (int i = 0; i < jsonArray4.size(); i++) { |
| | | Object value = jsonArray4.get(i); |
| | | if (value != null && !value.toString().equals("null")) { |
| | | try { |
| | | String cleanedValue = value.toString().replaceAll("[^0-9-]", ""); |
| | | boolean val = "1".equals(cleanedValue.trim()); |
| | | sValueb5.add(val); |
| | | System.out.println("messageValue: " + Arrays.asList(val) + " added to the list"); |
| | | } catch (NumberFormatException e) { |
| | | // 如果无法解析为 boolean 类型,则忽略该部分 |
| | | System.err.println("Could not parse value: " + value); |
| | | } |
| | | } |
| | | } |
| | | if (!sValueb5.isEmpty()) { |
| | | |
| | | S7control.getinstance().WriteBit(A02Bstart, sValueb5); |
| | | System.out.println("Values " + sValueb5 + " written to PLC at address " + A02Bstart); |
| | | } |
| | | } |
| | | |
| | | //A02半自动 |
| | | customS7Control.writeBitToPLC( messageArray, A02Bstart,7); |
| | | |
| | | |
| | | |
| | |
| | | |
| | | // 获取当前登录用户权限 |
| | | @GetMapping("/SelectPermissionByUserName") |
| | | public Result SelectPermissionByUserName(String username) { |
| | | public Result SelectPermissionByUserName(String username) throws SQLException { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<RolePermission> permission = homeMapper.SelectPermissionByUserName(username); |
| | | map.put("permission", permission); |
| | |
| | | @GetMapping("/UpdateTask") |
| | | public Result UpdateTask(Integer types, Integer shelfrack, String glassid) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | homeMapper.UpdateTask(types,glassid); |
| | | homeMapper.UpdateTask(types, glassid); |
| | | StorageCage glass = homeMapper.SelectGlassInfo(glassid); |
| | | if (types == 0) { |
| | | homeMapper.UpdateCageTask1(glassid); |
| | |
| | | int sequence = homeMapper.SelectMaxSquence(); |
| | | homeMapper.AddOutSliceS(glassid, flip, north_glass_buffer1.getFrameBarcode(), |
| | | north_glass_buffer1.getglasslengthmm().toString(), north_glass_buffer1.getglassheightmm().toString(), |
| | | sequence, position); |
| | | sequence, position, 0); |
| | | map.put("message2", "200"); |
| | | } else { |
| | | map.put("message2", "300"); |
| | |
| | | public Result Inglassid(short cage, short cell, short tier, @RequestBody Queue queue) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | short result = homeMapper.SelectStorageByGlassId(queue.getglassId()); |
| | | if (result > 0) { |
| | | map.put("message", "300"); |
| | | Double cagewidth = homeMapper.SelectCageWidth(cage, cell); |
| | | if (cagewidth - queue.getglasswidth() - 400 < 0 || (cagewidth == 2750 && queue.getglasswidth() > cagewidth)) { |
| | | map.put("message", "400"); |
| | | } else { |
| | | homeMapper.Inglassid(queue, cage, cell, tier); |
| | | spianMapper.UpdataAddCage1(queue.getglasswidth(), cage, cell); |
| | | map.put("message", "200"); |
| | | if (result > 0) { |
| | | map.put("message", "300"); |
| | | } else { |
| | | homeMapper.Inglassid(queue, cage, cell, tier); |
| | | spianMapper.UpdataAddCage1(queue.getglasswidth(), cage, cell); |
| | | map.put("message", "200"); |
| | | } |
| | | } |
| | | return Result.success(map); |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 查询玻璃信息 |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | // 根据玻璃id删除出片队列玻璃 |
| | | // 根据铝框id删除出片队列玻璃 |
| | | @PostMapping("/DeleteProductionQueueGlass") |
| | | public Result DeleteProductionQueueGlass(String FrameNo) { |
| | | homeMapper.DeleteProductionQueueGlass(FrameNo); |
| | | homeMapper.CompleteQueueByFrameNo(FrameNo); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("message", "200"); |
| | | return Result.success(map); |
| | |
| | | return Result.success(map); |
| | | } |
| | | |
| | | //手动完成任务 |
| | | // 手动完成任务 |
| | | @PostMapping("/CompleteQueue") |
| | | public Result CompleteQueue(String id,String frameid,String glassid) { |
| | | return outSliceServive.CompleteQueue(id,frameid,glassid); |
| | | |
| | | public Result CompleteQueue(String id, String frameid, String glassid) { |
| | | return outSliceServive.CompleteQueue(id, frameid, glassid); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | north_glass_buffer1 SelectBoxNo(String glassid); |
| | | |
| | | //查询出片队列信息 |
| | | @Select("select * from out_slice where state=0 or state=1 or state=2 order by sequence") |
| | | @Select("select * from out_slice order by sequence") |
| | | List<Out_slice> SelectProductionqueue(); |
| | | |
| | | //根据玻璃id查询笼内玻璃信息 |
| | |
| | | StorageCage SelectStorageGlassById(String glassid); |
| | | |
| | | |
| | | //根据玻璃id删除出片队列玻璃 |
| | | @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)") |
| | | void DeleteProductionQueueGlass(String id); |
| | | // //根据玻璃id删除出片队列玻璃 |
| | | // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)") |
| | | // void DeleteProductionQueueGlass(String id); |
| | | |
| | | //根据铝框id查询对应玻璃信息 |
| | | @Select("select * from north_glass_buffer1 where FrameBarcode=#{FrameBarcode}") |
| | |
| | | Out_slice SelectQueueByglassid(String getbarcode); |
| | | |
| | | //添加出片队列 |
| | | @Insert("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`, `sequence`, `time` ,`position`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, 0, #{flip}, #{sequence}, now(), #{position});") |
| | | void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm, int sequence, String position); |
| | | @Insert("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`, `sequence`, `time` ,`position`) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, #{state}, #{flip}, #{sequence}, now(), #{position});") |
| | | void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm, int sequence, String position, Short state); |
| | | |
| | | //出片队列调序 |
| | | @Update("update out_slice set sequence=#{sequence} where glassid=#{glassId}") |
| | |
| | | @Select("select count(*) from out_slice where barcode=#{frameid} and state<2") |
| | | Short SelectCountByFrameNo(String frameid); |
| | | |
| | | //铝框id对应玻璃改完全部完成状态 |
| | | @Update("update out_slice set state=3 where barcode=#{frameid} and state=2") |
| | | //删除已完成的任务 |
| | | @Update("delete from out_slice where Barcode=#{frameid}") |
| | | void CompleteQueueByFrameNo(String frameid); |
| | | |
| | | @Select("Select width from storage_cage where cage=#{cage} and cell=#{cell} limit 1") |
| | | Double SelectCageWidth(short cage, short cell); |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private JdbcConnections jdbcConnections; |
| | | |
| | | //获取玻璃是否在笼子,是否在出片队列 |
| | | public List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode) throws SQLException { |
| | | List<north_glass_buffer1> listAluminumFrame = jdbcConnections |
| | | .SelectGlassByGlassIdOrderIdFrameIdss(FrameBarcode); |
| | |
| | | return listAluminumFrame; |
| | | } |
| | | |
| | | //根据铝框id添加玻璃到出片队列 |
| | | public void AddOutSliceS(String FrameBarcode) throws SQLException{ |
| | | List<north_glass_buffer1> north_glass_buffer1s=SelectAluminumFrameInfoById(FrameBarcode); |
| | | String flip = jdbcConnections.SelectFlipByFrameBarcode(FrameBarcode); |
| | | String position =jdbcConnections.SelectPositionByFrameBarcode(FrameBarcode); |
| | | int sequence=homeMapper.SelectMaxSquence(); |
| | | |
| | | for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) { |
| | | if(north_glass_buffer1.getstorageCage()!=null&&north_glass_buffer1.getOut_slice()==null){ |
| | | homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode, north_glass_buffer1.getglasslengthmm().toString(), north_glass_buffer1.getglassheightmm().toString(), sequence, position); |
| | | Short state=0; |
| | | if(north_glass_buffer1.getOut_slice()==null){ |
| | | if(north_glass_buffer1.getstorageCage()==null){ |
| | | state=3; |
| | | } |
| | | homeMapper.AddOutSliceS(north_glass_buffer1.getbarcode(), flip, FrameBarcode, north_glass_buffer1.getglasslengthmm().toString(), north_glass_buffer1.getglassheightmm().toString(), sequence, position, state); |
| | | sequence+=1; |
| | | } |
| | | } |
| | |
| | | // 添加到数据库 |
| | | for (String[] item : AluminumFrames) { |
| | | if (item[1] == "true") { |
| | | Short state=0; |
| | | String position = jdbcConnections.SelectPositionByFrameBarcode(item[3]); |
| | | homeMapper.AddOutSliceS(item[0], item[2], item[3], item[4], item[5], sequence, position); |
| | | homeMapper.AddOutSliceS(item[0], item[2], item[3], item[4], item[5], sequence, position,state ); |
| | | sequence += 1; |
| | | } |
| | | } |
| | |
| | | homeMapper.CompleteQueueByFrameNo(frameid); |
| | | } |
| | | StorageCage storageCage = homeMapper.SelectGlassInfo(glassid); |
| | | spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell()); |
| | | |
| | | if(storageCage!=null){ |
| | | spianMapper.UpdataOutCage1(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell()); |
| | | } |
| | | homeMapper.UpdateCageTask2(glassid); |
| | | S7control.getinstance().WriteWord("DB105.12", (short) 0); |
| | | Map<String, Object> map = new HashMap<>(); |