wuyouming666
2024-01-19 85a0a75ab65874f8c010df5ba9cec0d97bf84708
Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

# Conflicts:
# CanadaMes-ui/src/views/home/index.vue
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
15个文件已修改
1个文件已添加
914 ■■■■■ 已修改文件
CanadaMes-ui/src/api/home.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/layout/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 402 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/api/home.js
@@ -285,3 +285,11 @@
        data:""
    })
}
export function SwitchScanMethod(scansmethod) {
    return request({
        url: '/home/SwitchScanMethod?scansmethod='+scansmethod,
        method: 'post',
        data:""
    })
}
CanadaMes-ui/src/lang/locales/en-US.json
@@ -1,6 +1,5 @@
{
  "ip": "localhost",
  "ip":"localhost",
  "systemTitle": "Login System",
  "usernamePlaceholder": "Please enter username",
  "passwordPlaceholder": "Please enter password",
@@ -303,7 +302,7 @@
  "current Information":"current information",
  "Modify Information":"Modify information",
  "Clear Current":"Clear Current",
  "Confirm Modification":"Confirm modification",
  "Confirm":"Confirm",
  "The glass ID already exists in the loading queue":"The glass ID already exists in the loading queue",
  "This glass ID already exists in the sorting cage":"This glass ID already exists in the sorting cage",
  "Outing Queue":"Outing Queue",
@@ -349,6 +348,17 @@
  "Outside":"Outside",
  "Inside":"Inside",
  "Cancel":"Cancel",
  "Are you sure to clear this barcode ?":"Are you sure to clear this barcode ?",
  "Terminate Feeding":"Terminate Feeding",
  "Terminate Outing":"Terminate Outing",
  "SoftEmergencyStop":"SoftEmergencyStop",
  "Unable to clear glass ID in automatic mode":"Unable to clear glass ID in automatic mode",
  "Are you sure you want an emergency stop ?":"Are you sure you want an emergency stop ?",
  "Current State":"Current State",
  "Automatic":"Automatic",
  "Hand Movement":"Hand Movement",
  "Please enter the correct glassID":"Please enter the correct glassID",
  "Switch":"Switch",
    "ServoManualone": {
      "A01 所在格子": "A01 Current Grid",
      "数量": "Quantity",
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -1,5 +1,5 @@
{
  "ip": "localhost",
  "ip":"localhost",
  "systemTitle": "登录系统",
  "usernamePlaceholder": "请输入用户名",
  "passwordPlaceholder": "请输入密码",
@@ -290,7 +290,7 @@
  "current Information": "当前信息",
  "Modify Information": "修改信息",
  "Clear Current": "清除当前",
  "Confirm Modification": "确认修改",
  "Confirm": "确认",
  "The glass ID already exists in the loading queue": "上片队列已存在此玻璃id",
  "This glass ID already exists in the sorting cage": "理片笼内已存在此玻璃id",
  "Outing Queue":"出片队列",
@@ -338,6 +338,17 @@
  "Outside":"外侧",
  "Inside":"内侧",
  "Cancel":"取消",
  "Are you sure to clear this barcode ?":"确定清除此玻璃id吗 ?",
  "Terminate Feeding":"终止进片",
  "Terminate Outing":"终止出片",
  "SoftEmergencyStop":"软急停",
  "Unable to clear glass ID in automatic mode":"无法在自动模式下清除玻璃ID",
  "Are you sure you want an emergency stop ?":"确定要急停吗?",
  "Current State":"当前状态",
  "Automatic":"自动",
  "Hand Movement":"手动",
  "Please enter the correct glassID":"请输入正确的玻璃ID",
  "Switch":"切换",
  "langparameter": {
    "conveyor Velocity(Auto FAST)": "D01-D06 皮带输送自动快速",
    "conveyor Velocity(Auto SLOW)": "D01-D06 皮带输送自动慢速",
CanadaMes-ui/src/layout/index.vue
@@ -231,7 +231,7 @@
    },
    init() {
      let viewname = "Home";
      let viewname = "Layout";
      if (typeof (WebSocket) == "undefined") {
        console.log("您的浏览器不支持WebSocket");
      } else {
@@ -289,8 +289,6 @@
          if (obj.Abort) {
            if (obj.Abort[0].length > 0) {
@@ -340,7 +338,7 @@
        },
        1000
      );
      if (this.reset == false&&this.EmergencyStop != true) {
      if (this.reset == false && this.EmergencyStop != true) {
        this.dialogFormCountDown = true;
      }
    },
CanadaMes-ui/src/views/home/index.vue
@@ -252,7 +252,7 @@
            <div style="display:flex;justify-content: space-around;width: 9zz5%;margin: 0 auto;">
                <!-- <el-input style="width:15%;" :placeholder="$t('Enter the glass barcode')" v-model="glassid1"
                    :class="ManuallyInfeedGlass == true ? 'hide' : ''"></el-input> -->
                <el-button type="primary" @click="SelectGlassByGlassIDs(2)" :disabled="ManuallyInfeedGlass"
                <el-button type="primary" @click="SelectGlassByGlassIDs()" :disabled="ManuallyInfeedGlass"
                    :class="ManuallyInfeedGlass == true ? 'hide' : ''">
                    {{ $t('Manually Infeed Glass') }}</el-button>
                <el-button type="primary" @click="showform2()" :disabled="OrderInfo"
@@ -263,12 +263,11 @@
                    {{ $t('Outing Queue') }}</el-button>
                <el-button type="primary" @click="TaskStop(0)" :disabled="OutingQueue"
                    :class="StopTask == true ? 'hide' : ''">
                    {{ $t('Stop Feeding') }}</el-button>
                <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask"
                    :class="StopTask == true ? 'hide' : ''">
                    {{ $t('Stop Outing') }}</el-button>
                <el-button type="primary" @click="SoftEmergencyStop()" :disabled="SoftEmergencyStop"
                    :class="SoftEmergencyStop == true ? 'hide' : ''">
                    {{ $t('Terminate Feeding') }}</el-button>
                <el-button type="primary" @click="TaskStop(1)" :disabled="StopTask" :class="StopTask == true ? 'hide' : ''">
                    {{ $t('Terminate Outing') }}</el-button>
                <el-button type="primary" @click="SoftEmergencyStop()" :disabled="SoftEmergencyStopState"
                    :class="SoftEmergencyStopState == true ? 'hide' : ''">
                    {{ $t('SoftEmergencyStop') }}</el-button>
                <!-- <el-input style="width:15%;" :placeholder="$t('Enter the Order No')" v-model="order"></el-input>
                <el-button type="warning" @click="showform1();">{{ $t('Exit the glass by order number') }}</el-button> -->
@@ -390,10 +389,10 @@
                    A01.1:{{ ShowGlassIdList(4) }}</div>
                <div class="glass A01" style="top: 290px;left: 289px;position: absolute;"
                    @click="ClearGlassId('DB101.10.1,5')">A01.2:{{ ShowGlassIdList(5) }}</div>
                    @click="ClearGlassId('DB101.10.1,5',5)">A01.2:{{ ShowGlassIdList(5) }}</div>
                <div class="glass A02" style="top: 310px;left: 300px;position: absolute;"
                    @click="ClearGlassId('DB101.10.2,6')">A02:{{ ShowGlassIdList(6) }}</div>
                <div class="glass A02" style="top: 310px;left: 289px;position: absolute;"
                    @click="ClearGlassId('DB101.10.2,6',6)">A02:{{ ShowGlassIdList(6) }}</div>
                <div class="glass D03" style="top: 137px;left: 42px;position: absolute;"
                    @click="ClearGlassId('DB101.9.4', 7)">
@@ -574,19 +573,29 @@
                        }}</el-button>
                    </el-form-item> -->
                    <el-form-item>
                        <el-input style="width:70%;" :placeholder="$t('Enter the glass barcode')"
                            v-model="glassid1"></el-input>
                        <el-button type="primary" @click="SelectGlassByGlassIDs(2)">{{ $t('Add')
                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
                        <el-button type="primary" @click="isConfirmState()">
                            {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
                    </el-form-item>
                    <el-form-item>
                        {{ $t('Current State') }}:{{ this.Scanningmethod==true?$t('Automatic'):$t('Hand Movement')}}
                        <el-button type="primary" @click="SwitchScanMethod()">{{ $t('Switch')
                        }}</el-button>
                    </el-form-item>
                    <el-form-item>
                        <el-input style="width:70%;" maxlength="13" :placeholder="$t('Enter the glass barcode')"
                            v-model="glassid1"></el-input>
                        <el-button type="primary" :disabled="!Scanningmethod" @click="WriteGlassID()">{{ $t('Add')
                        }}</el-button>
                    </el-form-item>
                    <el-form-item>
                        {{ $t('Barcode') }}:
                        <el-input style="width:70%;" maxlength="14" :disabled="true" v-model="CurrrentGlassId"></el-input>
                    </el-form-item>
                </div>
                <div style="display: flex;justify-content: space-around;">
                    <label for="">{{ $t('Upper film position') }}</label>
                    <div>
                        {{ $t('Confirm State') }}:{{ this.isConfirm == true ? $t('Not Allow') : $t('Allow') }}
                        <el-button type="primary" @click="isConfirmState()">
                            {{ this.isConfirm == true ? $t('Allow') : $t('Not Allow') }}</el-button>
                    </div>
                    <label for="">{{ $t('Scan Code Point') }}</label>
                </div>
                <div style="display: flex;justify-content: space-around;height: 40px;">
@@ -684,19 +693,19 @@
                    <!-- <el-button @click="DeleteQueueGlasss(2)" type="primary">{{ $t('Clear Current')
                    }}</el-button>
                    <el-button @click="InsertQueueGlass(2)" type="primary" :disabled="disabled">
                        {{ $t('Confirm Modification') }}</el-button>
                        {{ $t('Confirm') }}</el-button>
                    <el-button @click="DeleteQueueGlasss(1)" type="primary">{{ $t('Clear Current')
                    }}</el-button> -->
                    <el-button @click="InsertQueueGlass(1)" style="margin-right: 100px;" type="primary"
                        :disabled="disabled1">
                        {{ $t('Confirm Modification') }}</el-button>
                        {{ $t('Confirm') }}</el-button>
                </div>
            </el-form>
            <template #footer>
            <!-- <template #footer>
                <span class="dialog-footer">
                    <el-button @click="cancel3()">{{ $t('cancel') }}</el-button>
                </span>
            </template>
            </template> -->
        </el-dialog>
        <el-dialog :visible.sync="dialogFormVisible6" :title="$t('Outing Queue')" top="5vh">
@@ -873,7 +882,7 @@
    home, home2, InsertOrder, Addglassid, UpdateTask, SelectAlarmmgInfo, SelectCageInfo, DeleteByGlassID, OutByGlassID, Loadcarlist,
    SelectPassword, SelectGlassByGlassID, Disabled, Inglassid, SelectGlass, InsertQueueGlassId, UpdateQueueState, DeleteQueueGlass, SelectGlassNo,
    SelectAluminumFrameInfoById, DeleteProductionQueueGlass, AddOutSliceS, isAllowQueues, isConfirmStates, SelectPermissionByUserName, currentUsername, CompleteQueue,
    isAllowReorderings, FrameStateUpdate, WriteGlassID, ClearGlassId, CloseForm7, TaskStop, SoftEmergencyStop
    isAllowReorderings, FrameStateUpdate, WriteGlassID, ClearGlassId, CloseForm7, TaskStop, SoftEmergencyStop, SwitchScanMethod
} from "../../api/home";
@@ -959,9 +968,9 @@
            OutingQueue: true,
            OrderInfo: true,
            CageDetails: true,
            ClearGlassID:true,
            StopTask:true,
            SoftEmergencyStop:true,
            ClearGlassID: true,
            StopTask: true,
            SoftEmergencyStopState: true,
            CountDowns: "0",
            D01RequestState: false,
            EmergencyStop: false,
@@ -970,7 +979,9 @@
            isQueueWarning: false,
            CurrentFrame: [],
            DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            GlassIdList: []
            GlassIdList: [],
            Scanningmethod: true,
            CurrrentGlassId:""
        };
    },
    created() {
@@ -1016,6 +1027,17 @@
                    this.tasklist1 = obj.tasklist1[0];
                    this.tasklist2 = obj.tasklist2[0];
                    this.alarm = obj.alarmmg[0];
                    //获取当前扫码方式
                    if (obj.Scanningmethod != null) {
                        this.Scanningmethod=obj.Scanningmethod[0];
                    }
                    //获取当前扫码枪玻璃id
                    if(obj.CurrrentGlassId!=null){
                        const specialChars = /[^\w\s]/g;
                        this.CurrrentGlassId=obj.CurrrentGlassId[0].replace(specialChars, "");
                    }
                    //查询当前铝框信息
                    this.CurrentFrame = obj.CurrentFrame;
                    //获取设备状态
@@ -1100,10 +1122,13 @@
                    } else {
                        this.form3 = {};
                    }
                    if (obj.form3 != null && obj.form3 != "" && obj.state[0] == 0) {
                        this.loadglassheight1 = 70;
                        if(this.form5.glassId!=obj.form3[0].glassId){
                            this.showform3();
                        }
                        this.form5 = obj.form3[0];
                        this.showform3();
                        this.glassid1 = "";
                        if (this.D01RequestState == true) {
                            this.Sizerange(this.form5, 3);
@@ -1155,14 +1180,14 @@
                        if (item.permissionId == "35" && item.state == 1) {
                            this.CageDetails = false;
                        }
                        if (item.permissionId == "36" && item.state == 1) {
                        if (item.permissionId == "37" && item.state == 1) {
                            this.ClearGlassID = false;
                        }
                        if (item.permissionId == "37" && item.state == 1) {
                        if (item.permissionId == "38" && item.state == 1) {
                            this.StopTask = false;
                        }
                        if (item.permissionId == "38" && item.state == 1) {
                            this.SoftEmergencyStop = false;
                        if (item.permissionId == "39" && item.state == 1) {
                            this.SoftEmergencyStopState = false;
                        }
                    });
                });
@@ -1298,11 +1323,13 @@
        },
        //手动写入plc扫码位玻璃id
        WriteGlassID() {
            if (this.glassid1 != "") {
            if (this.glassid1.length ==14) {
                WriteGlassID(this.glassid1).then(res => {
                    console.log(res.data);
                    this.$message.success(this.$t('Successful operation'));
                });
            }else{
                this.$message.error(this.$t('Please enter the correct glassID'));
            }
        },
        //获取扫码位和上片位数据
@@ -2017,8 +2044,9 @@
        //清除玻璃id
        ClearGlassId(position, num) {
            if (this.ClearGlassID == false) {
                if (this.DeviceList[position] != null) {
                    if (this.GlassIdList[num].length == 14) {
                console.log(this.DeviceList,num);
                if (this.DeviceList[num] == 0) {
                    if (this.GlassIdList[num].length < 14) {
                        this.$confirm(this.$t('Are you sure to clear this barcode ?'), this.$t('confirm'), {
                            confirmButtonText: this.$t('Yes'),
                            cancelButtonText: this.$t('No'),
@@ -2056,9 +2084,29 @@
                }
            });
        },
        SoftEmergencyStop2() {
            SoftEmergencyStop.then(res => {
                if (res.data.message == 200) {
        //软急停
        SoftEmergencyStop() {
            this.$confirm(this.$t('Are you sure you want an emergency stop ?'), this.$t('confirm'), {
                confirmButtonText: this.$t('Yes'),
                cancelButtonText: this.$t('No'),
                type: 'warning'
            }).then(() => {
                SoftEmergencyStop.then(res => {
                    if (res.data.message == 200) {
                        this.$message.success(this.$t('Operation successful'));
                    }
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: this.$t('Operation canceled')
                });
            });
        },
        //切换二维码获取方式
        SwitchScanMethod(){
            SwitchScanMethod(!this.Scanningmethod).then(res => {
                if(res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
            });
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
@@ -26,10 +26,10 @@
        this.storageCageService = storageCageService;
        this.plcParameterObject = new PlcParameterObject();
        this.plcBitObject = new PlcBitObject();
        String jsonFilePath = "JsonFile/PlcParameter.json";
        InitUtil.initword(jsonFilePath); // 初始化 PlcParameterObject
        String jsonFilePath2 = "JsonFile/PlcSign.json";
        InitUtil.initbit(jsonFilePath2); // 初始化 PlcSign
        // String jsonFilePath = "JsonFile/PlcParameter.json";
        // InitUtil.initword(jsonFilePath); // 初始化 PlcParameterObject
        // String jsonFilePath2 = "JsonFile/PlcSign.json";
        // InitUtil.initbit(jsonFilePath2); // 初始化 PlcSign
    }
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -29,7 +29,7 @@
        // \\ TODO Auto-generated catch block
        e.printStackTrace();
      }
      if (S7control.getinstance().CheckConnected() == false) {
      // if (S7control.getinstance().CheckConnected() == false) {
        spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
        spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
        jdbcConnections = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
@@ -41,7 +41,7 @@
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // }
         spianService.selectAll("X21942610402GV");
        // spianService.selectAll("X21942610402GV");
        // 出片任务////////////////////////////////
        List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态
        List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动
@@ -165,7 +165,7 @@
        // 查询数据库
        // 推送到前端
      }
      // }
    }
  }
springboot-vue3/src/main/java/com/example/springboot/component/PlcLayout.java
New file
@@ -0,0 +1,116 @@
package com.example.springboot.component;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.example.springboot.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.entity.Out_slice;
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.alarmmg;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.SpianMapper;
public class PlcLayout extends Thread {
    @Autowired
    private HomeMapper homeMapper;
    @Autowired
    // 出片队列是否允许出片
    public static Boolean isAllowQueue = true;
    public static Boolean isAllowReordering = true;
    // 出片队列警告
    public static Boolean isQueueWarning = false;
    // 铝框id
    public static String FrameNo = "";
    // 是否需要手动确认玻璃
    public static Boolean isConfirm = false;
    // 待确认的出片队列
    public static List<north_glass_buffer1> AluminumFrame;
    // private Configuration config;
    private StorageCageService storageCageService;
    // public Plchome() throws IOException {
    // config = new Configuration("config.properties");
    // }
    // public static Map b=new HashMap<>();
    // b.put()
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            JSONObject jsonObject = new JSONObject();
            // 注入mapper
            homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
            if (S7control.getinstance().CheckConnected() == true) {
                // 查询报警信息
            List<alarmmg> alarmmg = homeMapper.SelectAlarmmgInfo();
            jsonObject.append("alarmmg", alarmmg);
                // 复位倒计时
                // 地址104.9.6
                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
                for (Boolean countdowns : countdown) {
                    jsonObject.append("countdown", countdowns);
                }
                // jsonObject.append("countdown", true);
                // 复位完成信号ss
                List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
                for (Boolean reset : resetss) {
                    jsonObject.append("reset", reset);
                }
                // 是否急停
                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
                for (Boolean emergencystop : emergencystops) {
                    jsonObject.append("emergencystop", emergencystop);
                }
            }
            // jsonObject.append("params", new short[] { 30, 40, });
            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Layout");
            if (sendwServer != null) {
                for (WebSocketServer webserver : sendwServer) {
                    webserver.sendMessage(jsonObject.toString());
                    if (webserver != null) {
                        List<String> messages = webserver.getMessages();
                        if (!messages.isEmpty()) {
                            // // 将最后一个消息转换为整数类型的列表
                            webserver.clearMessages();
                        }
                    }
                }
            }
        }
    }
}
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -28,7 +28,7 @@
    FileInputStream fileInputStream;
    try {
      // 从文件中读取字节数据存入 fileInputStream
      fileInputStream = new FileInputStream("D:/canadames/Alarm.json");
      fileInputStream = new FileInputStream("D:/code/canadames/Alarm.json");
      // 读取 fileInputStream 中字节并将其解码为字符
      InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
      // 提高读取效率,在 BufferedReader 内包装 InputStreamReader
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -38,7 +38,7 @@
    public static String FrameNo = "";
    // 是否需要手动确认玻璃
    public static Boolean isConfirm = false;
    //待确认的出片队列
    // 待确认的出片队列
    public static List<north_glass_buffer1> AluminumFrame;
    // private Configuration config;
@@ -46,7 +46,7 @@
    private StorageCageService storageCageService;
    // public Plchome() throws IOException {
    //     config = new Configuration("config.properties");
    // config = new Configuration("config.properties");
    // }
    // public static Map b=new HashMap<>();
@@ -119,186 +119,184 @@
            Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
            jsonObject.append("CurrentFrame", CurrentFrame);
            if (S7control.getinstance().CheckConnected() == true) {
                // 获取D01-D06,A01,A02,B01,B02状态
                List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
                jsonObject.append("DeviceList", DeviceList);
                // 获取D01-D06,A01,A02,B01,B02玻璃id
                List<String> GlassIdList = new ArrayList<String>();
                GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.212", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.128", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.142", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.156", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.72", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.86", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.100", 14).toString());
                GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
                jsonObject.append("GlassIdList", GlassIdList);
                // 读去Plc进片车与出片车位置W
                List<String> addressList = new ArrayList<String>();
                addressList.add("DB106.12");
                addressList.add("DB106.0");
                List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
                if (paramlist != null) {
                    jsonObject.append("params", paramlist);
                }
                // 获取进片车状态
                List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
                        1);// 获取进片车状态
                if (datas1ListState != null) {
                    boolean exist1 = datas1ListState.contains((short) 0);
                    jsonObject.append("zhuangtai", exist1);
                }
                // 获取进片玻璃信息
                List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
                if (inglassInfo != null) {
                    if (inglassInfo.size() > 0) {
                        jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
                    }
                }
                // // 获取铝框idDB106.DBW64,添加到出片队列
                // String frameno="X21763329601FB";
                String frameno = spianService.queGlassid("DB103.270", 14).toString();
                if (!frameno.equals(Plchome.FrameNo)) {
                    Plchome.FrameNo = frameno;
                    try {
                        Short num=0;
                        List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service.SelectAluminumFrameInfoById(Plchome.FrameNo);
                        for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
                            if(north_glass_buffer1.getstorageCage()==null){
                                break;
                            }
                            num++;
                        }
                        if(num==north_glass_buffer1s.size()){
                            north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                        }else{
                            Plchome.AluminumFrame=north_glass_buffer1s;
                        }
                    } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                if(AluminumFrame!=null){
                    jsonObject.append("AluminumFrame", AluminumFrame);
                }
                // // 获取铝框idDB106.DBW64,添加到出片队列
                // String frameno = spianService.queGlassid("DB103.270", 14).toString();
                // // String frameno="X12345611002GV";
                // // frameno="X21763329601FB";
                // if (!frameno.equals(Plchome.FrameNo)) {
                //     Plchome.FrameNo = frameno;
                //     try {
                //         Short num=0;
                //         List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service.SelectAluminumFrameInfoById(Plchome.FrameNo);
                //         for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
                //             if(north_glass_buffer1.getstorageCage()==null){
                //                 north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                //                 break;
                //             }
                //             num++;
                //         }
                //         if(num==north_glass_buffer1s.size()){
                //             jsonObject.append("AluminumFrame", north_glass_buffer1s);
                //         }
                //     } catch (SQLException e) {
                //         // TODO Auto-generated catch block
                //         e.printStackTrace();
                //     }
                // }
                // 获取进片请求状态
                List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
                boolean D01RequestState = D01Request.contains((short) 1);
                // boolean D01RequestState =true;
                jsonObject.append("D01RequestState", D01RequestState);
                // 复位倒计时
                // 地址104.9.6
                List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
                for (Boolean countdowns : countdown) {
                    jsonObject.append("countdown", countdowns);
                }
                // jsonObject.append("countdown", true);
                // 复位完成信号ss
                List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
                for (Boolean reset : resetss) {
                    jsonObject.append("reset", reset);
                }
                // 是否急停
                List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
                for (Boolean emergencystop : emergencystops) {
                    jsonObject.append("emergencystop", emergencystop);
                }
                // // 终止继续按钮
                // List<String> niuanaddressList3 =
                // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
                // List<Boolean> anniuread =
                // S7control.getinstance().readBits(niuanaddressList3);
                // // Boolean[] value4 = { false, false};
                // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
                // Boolean[] value5 = { true };
                // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
                // 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;
                // }
                // short[] resets2 = new short[resets.size()];
                // for (int i = 0; i < resets.size(); i++) {
                // boolean value = resets.get(i);
                // resets2[i] = value ? (short) 1 : (short) 0;
                // }
                // for (short number : resets2) {
                // if (number == 1) {
                // jsonObject.append("Abort", anniuparams);
                // }
                // }
            }
            // 铝框线交互
            // //铝框id请求字
            // List<Short> framerequest = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
            // if(framerequest!=null){
            // //铝框id
            // String franmeno= spianService.queGlassid("铝框id地址", 14).toString();
            // List<Short> listd17 = S7control.getinstance().ReadWord("DB17.0",10);
            // String id=spianService.queGlassid("DB17.10", 14).toString();
            //
            // // 铝框线交互
            // try {
            // if (CurrentFrame != null) {
            // spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
            // }
            // List<Short> framerequests = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
            // for (Short framerequest : framerequests) {
            // if (framerequest == 1) {
            // // 铝框id
            // String franmeno = spianService.queGlassid("DB17.10", 14).toString();
            // String position;
            // try {
            // position=dbserve.SelectPositionByFrameBarcode(franmeno);
            // position = dbserve.SelectPositionByFrameBarcode(franmeno);
            // } catch (SQLException e) {
            // // TODO Auto-generated catch block
            // position="0";
            // position = "0";
            // e.printStackTrace();
            // }
            // Short send;
            // if(position=="0"){
            // send=0;
            // }else{
            // send=1;
            // if (position == "0") {
            // send = 0;
            // } else {
            // send = 1;
            // }
            // S7control.getinstance().WriteWord("铝框翻转发送地址", (short)send);
            // S7control.getinstance().WriteWord("铝框翻转发送地址", (short) send);
            // }
            // }
            // } catch (Exception e) {
            // // TODO: handle exception
            // }
            // if (S7control.getinstance().CheckConnected() == true) {
            // 获取当前扫码方式
            List<Boolean> Scanningmethods = S7control.getinstance().ReadBits("DB101.11.4", 1);
            if(Scanningmethods!=null){
                for (Boolean Scanningmethod : Scanningmethods) {
                    jsonObject.append("Scanningmethod", Scanningmethod);
                }
            }
            String CurrrentGlassId = spianService.queGlassid("DB103.256", 14).toString();
            jsonObject.append("CurrrentGlassId", CurrrentGlassId);
            // 获取D01-D06,A01,A02,B01,B02状态
            List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
            jsonObject.append("DeviceList", DeviceList);
            // 获取D01-D06,A01,A02,B01,B02玻璃id
            List<String> GlassIdList = new ArrayList<String>();
            GlassIdList.add(spianService.queGlassid("DB103.40", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.58", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.184", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.212", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.128", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.142", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.156", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.72", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.86", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.100", 14).toString());
            GlassIdList.add(spianService.queGlassid("DB103.114", 14).toString());
            jsonObject.append("GlassIdList", GlassIdList);
            // 读去Plc进片车与出片车位置W
            List<String> addressList = new ArrayList<String>();
            addressList.add("DB106.12");
            addressList.add("DB106.0");
            List<Short> paramlist = S7control.getinstance().ReadWord(addressList);
            if (paramlist != null) {
                jsonObject.append("params", paramlist);
            }
            // 获取进片车状态
            List<Short> datas1ListState = S7control.getinstance().ReadWord("DB106.8",
                    1);// 获取进片车状态
            if (datas1ListState != null) {
                boolean exist1 = datas1ListState.contains((short) 0);
                jsonObject.append("zhuangtai", exist1);
            }
            // 获取进片玻璃信息
            List<Short> inglassInfo = S7control.getinstance().ReadWord("DB106.24", 1);
            if (inglassInfo != null) {
                if (inglassInfo.size() > 0) {
                    jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
                }
            }
            // // 获取铝框idDB106.DBW64,添加到出片队列
            // String frameno="X21763329601FB";
            String frameno = spianService.queGlassid("DB103.270", 14).toString();
            if (!frameno.equals(Plchome.FrameNo)) {
                Plchome.FrameNo = frameno;
                try {
                    Short num = 0;
                    List<north_glass_buffer1> north_glass_buffer1s = north_Glass_Buffer1Service
                            .SelectAluminumFrameInfoById(Plchome.FrameNo);
                    for (north_glass_buffer1 north_glass_buffer1 : north_glass_buffer1s) {
                        if (north_glass_buffer1.getstorageCage() == null) {
                            break;
                        }
                        num++;
                    }
                    if (num == north_glass_buffer1s.size()) {
                        north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                    } else {
                        Plchome.AluminumFrame = north_glass_buffer1s;
                    }
                } catch (SQLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            if (AluminumFrame != null) {
                jsonObject.append("AluminumFrame", AluminumFrame);
            }
            // 获取进片请求状态
            List<Short> D01Request = S7control.getinstance().ReadWord("DB106.24", 1);
            boolean D01RequestState = D01Request.contains((short) 1);
            // boolean D01RequestState =true;
            jsonObject.append("D01RequestState", D01RequestState);
            // 复位倒计时
            // 地址104.9.6
            List<Boolean> countdown = S7control.getinstance().ReadBits("DB104.9.6", 1);
            for (Boolean countdowns : countdown) {
                jsonObject.append("countdown", countdowns);
            }
            // jsonObject.append("countdown", true);
            // 复位完成信号ss
            List<Boolean> resetss = S7control.getinstance().ReadBits("DB103.284", 1);
            for (Boolean reset : resetss) {
                jsonObject.append("reset", reset);
            }
            // 是否急停
            List<Boolean> emergencystops = S7control.getinstance().ReadBits("DB104.5.1", 1);
            for (Boolean emergencystop : emergencystops) {
                jsonObject.append("emergencystop", emergencystop);
            }
            // // 终止继续按钮
            // List<String> niuanaddressList3 =
            // Arrays.asList(config.getProperty("Parameter2.stop").split(","));
            // List<Boolean> anniuread =
            // S7control.getinstance().readBits(niuanaddressList3);
            // // Boolean[] value4 = { false, false};
            // // List<Boolean> anniuread = new ArrayList<>(Arrays.asList(value4));
            // Boolean[] value5 = { true };
            // List<Boolean> resets = new ArrayList<>(Arrays.asList(value5));
            // 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;
            // }
            // short[] resets2 = new short[resets.size()];
            // for (int i = 0; i < resets.size(); i++) {
            // boolean value = resets.get(i);
            // resets2[i] = value ? (short) 1 : (short) 0;
            // }
            // for (short number : resets2) {
            // if (number == 1) {
            // jsonObject.append("Abort", anniuparams);
            // }
            // }
            // }
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
            boolean dbconnected = false;
@@ -322,64 +320,6 @@
                        if (!messages.isEmpty()) {
                            // // 将最后一个消息转换为整数类型的列表
                            // String lastMessage = messages.get(messages.size() - 1);
                            // System.out.println("lastMessage:" + lastMessage);
                            // JSONArray messageArray = new JSONArray(lastMessage);
                            // try {
                            // // 检查索引是否有效
                            // if (messageArray.getJSONArray(0).size() > 0) {
                            // // 获取消息数组
                            // JSONArray jsonArray = messageArray.getJSONArray(0);
                            // // 创建一个布尔值列表
                            // 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);
                            // }
                            // }
                            // }
                            // // 终止进片任务
                            // boolean Value1 = sValue.get(0);
                            // boolean Value2 = sValue.get(1);
                            // if (Value1) {
                            // storageCageService.EndTask(0);
                            // }
                            // if (Value2) {
                            // storageCageService.EndTask(1);
                            // }
                            // // 检查布尔值列表是否为空
                            // if (!sValue.isEmpty()) {
                            // // 调用 S7control.getinstance().WriteBit 方法将布尔值列表写入地址列表
                            // S7control.getinstance().WriteBit(niuanaddressList3, sValue);
                            // System.out.println(
                            // "Values " + sValue + " written to PLC at address " + niuanaddressList3);
                            // }
                            // }
                            // } catch (Exception e) {
                            // System.err.println("An error occurred while writing bit to PLC: " +
                            // e.getMessage());
                            // }
                            webserver.clearMessages();
                        }
springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java
@@ -65,6 +65,15 @@
            sessionMap.put(username, arrayListwebserver);
        } else {
            webSocketServers.add(this);
            // Short i=0;
            // for (WebSocketServer webSocketServer : webSocketServers) {
            //     if(webSocketServer==this){
            //         i++;
            //     }
            // }
            // if(i==0){
            //     webSocketServers.add(this);
            // }
        }
        
        log.info("有新用户加入,username={}, 当前在线人数为:{}", username, sessionMap.get(username).size());
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -400,8 +400,12 @@
  // 手动写入plc扫码位玻璃id
  @PostMapping("/WriteGlassID")
  public void WriteGlassID(String glassid) {
  public Result WriteGlassID(String glassid) {
    // 扫码位写入玻璃id
    spianService.outmesid(glassid, "DB103.286");
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
  // 清除指定位置id
@@ -431,20 +435,30 @@
  // 软急停
  @PostMapping("/SoftEmergencyStop")
  public Result SoftEmergencyStop(Short num) {
    String position="DB101.11.3";
    String position = "DB101.11.3";
    Map<String, Object> map = new HashMap<>();
        if (S7control.getinstance().CheckConnected() == true) {
            S7control.getinstance().WriteBit(position, false);
            try {
                TimeUnit.MILLISECONDS.sleep(300);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            S7control.getinstance().WriteBit(position, true);
            map.put("message", "200");
        } else {
            map.put("message", "300");
        }
        return Result.success(map);
    if (S7control.getinstance().CheckConnected() == true) {
      S7control.getinstance().WriteBit(position, false);
      try {
        TimeUnit.MILLISECONDS.sleep(300);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
      S7control.getinstance().WriteBit(position, true);
      map.put("message", "200");
    } else {
      map.put("message", "300");
    }
    return Result.success(map);
  }
  // 切换PLC获取二维码方式
  @PostMapping("/SwitchScanMethod")
  public Result SwitchScanMethod(Boolean scansmethod) {
    S7control.getinstance().WriteBit("DB101.11.4", scansmethod);
    Map<String, Object> map = new HashMap<>();
    map.put("message", "200");
    return Result.success(map);
  }
}
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -58,7 +58,7 @@
  short SelectInTask();
  // 手动完成任务
  @Update("update storage_task set task_state=1 where task_type=#{task_type} and task_state=0 and glass_id=#{glassid}")
  @Update("update storage_task set task_state=1 where task_type=#{task_type} and glass_id=#{glassid}")
  void UpdateTask(@Param("task_type") Integer task_type,String glassid);
  // 手动完成进片任务修改笼子数据
@@ -88,6 +88,10 @@
  //根据玻璃id查询理片笼信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  StorageCage SelectGlassInfo(String glassid);
  //根据玻璃id查询理片笼信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  List<StorageCage> SelectStorageInfoByGlassId(String glassid);
  //查询玻璃信息
//  @Select("select * from glass where glassid=#{glassid}")
@@ -172,7 +176,7 @@
  @Select("select ifnull(max(sequence),0)+1 from out_slice ")
  Short SelectMaxSquence();
  //查询用户权限
  @Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35 or permission_id=36 or permission_id=37 or permission_id=38)")
  @Select("select rp.* from role_permission rp inner join user r on rp.role_id=r.role_id and r.username=#{username} and (permission_id=32 or permission_id=33 or permission_id=34 or permission_id=35 or permission_id=36 or permission_id=37 or permission_id=38 or permission_id=39)")
  List<RolePermission> SelectPermissionByUserName(String username);
  //根据玻璃完成出片任务
@@ -215,4 +219,8 @@
  @Select("select task_type from storage_task where glass_id=#{glassid} and task_state!=2")
  Short SelectTaskByGlassId(String glassid);
  //修改格子宽度
  @Update("update storage_cage set width=width+#{width} where   cage=#{cage} and cell=#{cell};")
  void UpdataCageWidth(double width, int cage, int cell);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java
@@ -78,7 +78,7 @@
    @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{orderid},glasswidth=#{width} where id=#{id};")
    void UpdataAddCage(String orderid, String glassid, double width, int cage, int cell, int id, int state);
    @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.FrameBarcode} where id=#{id};")
    @Update("update storage_cage set state=#{state},glass_id=#{glassid},order_id=#{glass.ordernumber},glasswidth=#{glass.glasslengthmm},glassheight=#{glass.glassheightmm},glasswidthmm=#{glass.glasslength},glassheightmm=#{glass.glassheight},listid=#{glass.listnumber},boxid=#{glass.boxnumber},FrameBarcode=#{glass.frameBarcode} where id=#{id};")
    void UpdataAddCage2(String orderid, String glassid, north_glass_buffer1 glass, int cage, int cell, int id,int state);
    // 修改笼子信息(多片进片)
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java
@@ -23,6 +23,8 @@
  private SpianMapper spianMapper;
  @Autowired
  SpianService spianService;
  @Autowired
  StorageCageService storageCageService;
  public void AddOutSliceS(String[][] AluminumFrames) throws SQLException {
    // int sequence = homeMapper.SelectMaxSquence();
@@ -78,23 +80,34 @@
  // 终止进片/出片
  public void StopTask(String glassid, int i) {
    if (i == 0) {// 进片终止
      spianService.overtask(glassid);
      DeleteByGlassIDs(glassid);
      homeMapper.UpdateTask(0,glassid);// 完成进片任务
      DeleteByGlassIDs(glassid);//删除进片任务
      homeMapper.UpdateOutSliceGlass(glassid);
    } else {// 出片终止
      spianMapper.UpdatetaskOut(glassid);// 完成出片任务
    } else if(i==1) {// 出片终止
      homeMapper.UpdateTask(1,glassid);// 完成出片任务
      spianMapper.UpdataGlassCage(glassid, 0);// 清除出片格子玻璃信息
      spianMapper.UpdateCageOver(glassid, 0);// 更改笼子表出片状态
      homeMapper.UpdateOutSliceGlass(glassid);// 修改出片队列此玻璃状态为缺失
    }else{
      //清除进片
      homeMapper.UpdateTask(2,glassid);
      homeMapper.UpdateOutSliceGlass(glassid);
      //清除进出片玻璃id
      DeleteByGlassIDs(glassid);
    }
  }
  // 删除笼内玻璃还原宽度
  public void DeleteByGlassIDs(String glassid) {
    StorageCage glassinfor = homeMapper.SelectGlassInfo(glassid);
    spianMapper.UpdataOutCage1(glassinfor.getGlassWidth(), glassinfor.getCage(), glassinfor.getCell());
    List<StorageCage> glassinfor = homeMapper.SelectStorageInfoByGlassId(glassid);
    for (StorageCage storageCage : glassinfor) {
      if (storageCage.getState().equals("2")) {
        homeMapper.UpdataCageWidth(storageCage.getGlassWidth(), storageCage.getCage(), storageCage.getCell());
      }
    }
    homeMapper.DeleteByGlassID(glassid);
  }
  //修改铝框确认状态
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -31,79 +31,122 @@
        String A02glassid1 = spianService.queGlassid("DB103.156", 14).toString();
        String B01glassid = spianService.queGlassid("DB103.184", 14).toString();
        String B02glassid = spianService.queGlassid("DB103.198", 14).toString();
        List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
        if (types == 0) {// 终止进片任务
            List<StorageTask> cageList = homeMapper.SelectTaskByState(types);
            for (StorageTask storageTask : cageList) {
                // 判断出片任务位置并清除对应玻璃id
                if (storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2) {
                if ((storageTask.getGlassId() == A01glassid1 || storageTask.getGlassId() == A01glassid2)&&DeviceList.get(4)==0) {
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                    ClearGlassId("DB101.10.0");
                } else if (storageTask.getGlassId() == B01glassid) {
                } else if (storageTask.getGlassId() == B01glassid&&DeviceList.get(2)==0) {
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                    ClearGlassId("DB101.10.2");
                } else if (storageTask.getGlassId() == B02glassid) {
                } else if (storageTask.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
                    ClearGlassId("DB101.10.3");
                    outSliceServive.StopTask(storageTask.getGlassId(), types);
                }
            }
            // 发送终止进片任务信号
        } else {// 终止出片任务
            List<StorageCage> storageCages = homeMapper.selectinout(3);
            for (StorageCage storageCage : storageCages) {
                List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId());
                for (StorageCage storageCagez : storageCagess) {
                    if (storageCagez.getState().equals("2")) {// 调拨进片
                        outSliceServive.StopTask(storageCagez.getGlassId(), 0);
                    } else {// 出片
                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
                    }
                    // 判断出片任务位置并清除对应玻璃id
                    if (storageCagez.getGlassId() == A02glassid1) {
                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
            List<StorageTask> cageLists = homeMapper.SelectTaskByState(types);
            List<StorageTask> cageList2 = homeMapper.SelectTaskByState(2);
            if (cageList2.size()>0) {
                cageLists.add(cageList2.get(0));
            }
            for (StorageTask cageList : cageLists) {
                if (cageList.getTaskType().equals("1")) {
                    System.out.println(DeviceList.get(5));
                    if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);
                        ClearGlassId("DB101.10.1");
                    } else if (storageCagez.getGlassId() == B01glassid) {
                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
                    }
                    if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);
                        ClearGlassId("DB101.10.2");
                    } else if (storageCagez.getGlassId() == B02glassid) {
                    }
                    if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);
                        ClearGlassId("DB101.10.3");
                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
                    }
                }else if (cageList.getTaskType().equals("2")) {
                    if(cageList.getGlassId().equals(A02glassid1)&&DeviceList.get(5)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), 2);
                        ClearGlassId("DB101.10.1");
                    }
                    if(cageList.getGlassId().equals(B01glassid)&&DeviceList.get(2)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), 2);
                        ClearGlassId("DB101.10.2");
                    }
                    if(cageList.getGlassId().equals(B02glassid)&&DeviceList.get(3)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), 2);
                        ClearGlassId("DB101.10.3");
                    }
                }
            }
            // List<StorageCage> storageCages = homeMapper.selectinout(3);
            // for (StorageCage storageCage : storageCages) {
            //     List<StorageCage> storageCagess = homeMapper.SelectStoragesGlassById(storageCage.getGlassId());
            //     for (StorageCage storageCagez : storageCagess) {
            //         if (storageCagez.getState().equals("2")) {// 调拨进片
            //             outSliceServive.StopTask(storageCagez.getGlassId(), 0);
            //         } else {// 出片
            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
            //         }
            //         // 判断出片任务位置并清除对应玻璃id
            //         if (storageCagez.getGlassId() == A02glassid1&&DeviceList.get(5)==0) {
            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
            //             ClearGlassId("DB101.10.1");
            //         } else if (storageCagez.getGlassId() == B01glassid&&DeviceList.get(2)==0) {
            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
            //             ClearGlassId("DB101.10.2");
            //         } else if (storageCagez.getGlassId() == B02glassid&&DeviceList.get(3)==0) {
            //             ClearGlassId("DB101.10.3");
            //             outSliceServive.StopTask(storageCagez.getGlassId(), types);
            //         }
            //     }
            // }
        }
    }
    //手动完成任务
    // 手动完成任务
    public void UpdateTask(Integer types, Integer shelfrack, String glassid) {
        if (types == 0) {// 完成进片
            spianService.overtask(glassid);
        } else if (types == 1) {// 完成出片
            spianService.overtask(glassid);
        }
        }
        // else if (types == 2) {// 终止进片任务
        //     outSliceServive.StopTask(glassid, 0);
        //     // 发送终止进片任务信号
        // outSliceServive.StopTask(glassid, 0);
        // // 发送终止进片任务信号
        // } else {// 终止出片任务
        //     outSliceServive.StopTask(glassid, 1);
        // outSliceServive.StopTask(glassid, 1);
        // }
    }
    //判断任务类型后清除对应玻璃id
    // 判断任务类型后清除对应玻璃id
    public Result ClearGlassId(String position, String glassid) {
        Map<String, Object> map = new HashMap<>();
        if (S7control.getinstance().CheckConnected() == true) {
            // 判断进出还是出片任务
            Short type = homeMapper.SelectTaskByGlassId(glassid);
            if (type == 0) {
                // 进片
                outSliceServive.StopTask(glassid, 0);
            } else if (type == 1) {
                // 出片
                outSliceServive.StopTask(glassid, 1);
            } else {
                // 调拨
                outSliceServive.StopTask(glassid, 0);
                outSliceServive.StopTask(glassid, 1);
            if (type != null) {
                if (type == 0) {
                    // 进片
                    outSliceServive.StopTask(glassid, 0);
                } else if (type == 1) {
                    // 出片
                    outSliceServive.StopTask(glassid, 1);
                } else {
                    // 调拨
                    outSliceServive.StopTask(glassid, 0);
                    outSliceServive.StopTask(glassid, 1);
                }
            }
            ClearGlassId(position);
            map.put("message", "200");
@@ -113,7 +156,7 @@
        return Result.success(map);
    }
    //清除玻璃id
    // 清除玻璃id
    public Result ClearGlassId(String position) {
        Map<String, Object> map = new HashMap<>();
        if (S7control.getinstance().CheckConnected() == true) {