wu
2024-01-18 65bed7f78be75f0ba279885de647d76bc91d9336
Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
15个文件已修改
570 ■■■■■ 已修改文件
CanadaMes-ui/src/api/home.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/layout/index.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 106 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/WebSocketServer.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 30 ●●●● 补丁 | 查看 | 原始文档 | 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 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/SpianMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/OutSliceServive.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | 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) {s
    return request({
        url: '/home/SwitchScanMethod?Scanmethod='+scanmethod,
        method: 'post',
        data:""
    })
}
CanadaMes-ui/src/lang/locales/en-US.json
@@ -303,7 +303,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 +349,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
@@ -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
@@ -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> -->
@@ -392,7 +391,7 @@
                <div class="glass A01" style="top: 290px;left: 289px;position: absolute;"
                    @click="ClearGlassId('DB101.10.1,5')">A01.2:{{ ShowGlassIdList(5) }}</div>
                <div class="glass A02" style="top: 310px;left: 300px;position: absolute;"
                <div class="glass A02" style="top: 310px;left: 289px;position: absolute;"
                    @click="ClearGlassId('DB101.10.2,6')">A02:{{ ShowGlassIdList(6) }}</div>
                <div class="glass D03" style="top: 137px;left: 42px;position: absolute;"
@@ -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="14" :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="glassid1"></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,12 +693,12 @@
                    <!-- <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>
@@ -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,8 @@
            isQueueWarning: false,
            CurrentFrame: [],
            DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            GlassIdList: []
            GlassIdList: [],
            Scanningmethod: true
        };
    },
    created() {
@@ -1016,6 +1026,16 @@
                    this.tasklist1 = obj.tasklist1[0];
                    this.tasklist2 = obj.tasklist2[0];
                    this.alarm = obj.alarmmg[0];
                    //获取当前扫码方式
                    if (obj.Scanningmethod != null) {
                        if (obj.Scanningmethod == 0) {
                            this.Scanningmethod = true;
                        }
                        else {
                            this.Scanningmethod = false;
                        }
                    }
                    //查询当前铝框信息
                    this.CurrentFrame = obj.CurrentFrame;
                    //获取设备状态
@@ -1155,14 +1175,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 +1318,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,7 +2039,7 @@
        //清除玻璃id
        ClearGlassId(position, num) {
            if (this.ClearGlassID == false) {
                if (this.DeviceList[position] != null) {
                if (this.DeviceList[position] == 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'),
@@ -2056,8 +2078,34 @@
                }
            });
        },
        //软急停
        SoftEmergencyStop() {
            SoftEmergencyStop.then(res => {
            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(){
            var Scanmethod;
            if(this.Scanningmethod == true){
                this.Scanmethod = 1;
            }else{
                this.Scanmethod = 0;
            }
            SwitchScanMethod(Scanmethod).then(res => {
                if (res.data.message == 200) {
                    this.$message.success(this.$t('Operation successful'));
                }
springboot-vue3/src/main/java/com/example/springboot/component/PlcHold.java
@@ -41,6 +41,7 @@
      // // TODO Auto-generated catch block
      // e.printStackTrace();
      // }
      // 出片任务////////////////////////////////
      List<Short> outlist = S7control.getinstance().ReadWord("DB106.20", 1); // 出片车状态
      List<Short> outlist1 = S7control.getinstance().ReadWord("DB105.18", 1); // 出片任务是否启动
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,9 +119,44 @@
            Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
            jsonObject.append("CurrentFrame", CurrentFrame);
            // 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);
            //             } catch (SQLException e) {
            //                 // TODO Auto-generated catch block
            //                 position = "0";
            //                 e.printStackTrace();
            //             }
            //             Short send;
            //             if (position == "0") {
            //                 send = 0;
            //             } else {
            //                 send = 1;
            //             }
            //             S7control.getinstance().WriteWord("铝框翻转发送地址", (short) send);
            //         }
            //     }
            // } catch (Exception e) {
            //     // TODO: handle exception
            // }
            if (S7control.getinstance().CheckConnected() == true) {
                // 获取当前扫码方式
                List<Short> Scanningmethod = S7control.getinstance().ReadWord("DB103.255", 1);
                jsonObject.append("Scanningmethod", Scanningmethod);
                // 获取D01-D06,A01,A02,B01,B02状态
                List<Short> DeviceList = S7control.getinstance().ReadWord("DB103.0", 10);
                jsonObject.append("DeviceList", DeviceList);
@@ -173,52 +208,28 @@
                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);
                        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){
                            if (north_glass_buffer1.getstorageCage() == null) {
                                break;
                            }
                            num++;
                        }
                        if(num==north_glass_buffer1s.size()){
                        if (num == north_glass_buffer1s.size()) {
                            north_Glass_Buffer1Service.AddOutSliceS(Plchome.FrameNo);
                        }else{
                            Plchome.AluminumFrame=north_glass_buffer1s;
                        } else {
                            Plchome.AluminumFrame = north_glass_buffer1s;
                        }
                    } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
                if(AluminumFrame!=null){
                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);
@@ -276,29 +287,6 @@
                // }
            }
            // 铝框线交互
            // //铝框id请求字
            // List<Short> framerequest = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
            // if(framerequest!=null){
            // //铝框id
            // String franmeno= spianService.queGlassid("铝框id地址", 14).toString();
            // String position;
            // try {
            // position=dbserve.SelectPositionByFrameBarcode(franmeno);
            // } catch (SQLException e) {
            // // TODO Auto-generated catch block
            // position="0";
            // e.printStackTrace();
            // }
            // Short send;
            // if(position=="0"){
            // send=0;
            // }else{
            // send=1;
            // }
            // S7control.getinstance().WriteWord("铝框翻转发送地址", (short)send);
            // }
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
            boolean dbconnected = false;
@@ -322,64 +310,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/config/AppRunnerConfig.java
@@ -20,27 +20,27 @@
        new PlcHold().start();
        new Plclog().start();
//         new Plchome().start();
    //     new Plchome().start();
//         new Plcalarm().start();
    //     new Plcalarm().start();
//         new Plcsign().start();
    //     new Plcsign().start();
//         new Plcstate().start();
//         new PlcPositioning1().start();
    //     new Plcstate().start();
    //     new PlcPositioning1().start();
//         new PlcParameter2().start();
    //     new PlcParameter2().start();
//         new PLCAutomaticParameterSetting().start();
    //     new PLCAutomaticParameterSetting().start();
//         new PlcManualonePosition().start();
//         new PlcManualonePosition2().start();
//         new PlcServoManualone().start();
//         new PLCManualJog().start();
//         //new Plclog().start();
    //     new PlcManualonePosition().start();
    //     new PlcManualonePosition2().start();
    //     new PlcServoManualone().start();
    //     new PLCManualJog().start();
    //     //new Plclog().start();
//         new PlcInteractionState().start();
// new PlcParameter1Review().start();
       // new PLCAutomaticParameterSettingReview().start();
    //     new PlcInteractionState().start();
    //     new PlcParameter1Review().start();
    //    new PLCAutomaticParameterSettingReview().start();
    }
}
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.256");
    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(Short scansmethod) {
    S7control.getinstance().WriteWord("DB103.255", 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=2 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);
  //根据玻璃完成出片任务
@@ -200,7 +204,7 @@
  void UpdateOutSliceGlass(String glassid);
  //查询未完成的任务
  @Select("select * from storage_task where task_state=0 and task_type=#{task_type}")
  @Select("select * from storage_task where task_state!=2 and task_type=#{task_type}")
  List<StorageTask> SelectTaskByState(int task_type);
  //修改出片队列铝框状态
@@ -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
@@ -18,8 +18,8 @@
    @Select("select a.cage,FrameBarcode,COUNT(if(a.order_id=#{orderids},a.order_id,null))as orderid,b.shu,c.shu2,a.cell,min(a.state)as state1,max(a.state)as state2,disabled,FrameBarcode from storage_cage a left join (select COUNT(*)shu,cage from storage_cage  where order_id=#{orderids} GROUP BY cage)as b on a.cage=b.cage left join(select cage ,COUNT(glass_id)as shu2 from storage_cage GROUP BY cage)c  on a.cage=c.cage where (order_id=#{orderids} or ''='') GROUP BY cage,cell HAVING state1=0 ORDER BY (FrameBarcode=#{Fbarcode} or ''='') desc,shu desc,shu2,state2 asc,cage asc;")
    List<StorageCage> selectAll(String orderids,String Fbarcode);
    //优先判断一次是否有同铝框的空位
    @Select("select *,min(state) state1 from storage_cage  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{FrameBarcode} LIMIT 1;")
    List<StorageCage> selectAllFbarcode(String Fbarcode);
    @Select("select *,min(state) state1 from storage_cage where width>=(#{width}+#{width2})  GROUP BY cage,cell HAVING state1=0 and  FrameBarcode=#{Fbarcode} ORDER BY width desc LIMIT 1;")
    List<StorageCage> selectAllFbarcode(String Fbarcode,double width,double width2);
    // 获取判断该格子是否需要把外片推入内片位置
    @Select("select state from storage_cage where  cage=#{cage} and cell=#{cell} and tier=1;")
    int selectcell(int cage, int cell);
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/SpianService.java
@@ -19,7 +19,7 @@
    // @GetMapping("/all")
    public Short selectAll(String glassid) {
        int cage1;
        int cage1=0;
        int cells;
        int ids;
        int prcid;
@@ -33,12 +33,7 @@
        if (glasslist == null) {
            return (300);
        }
        //判断是否还有进片任务未完成的
        int cagestate=spianMapper.SelectCageState(2);
        //有进片任务未完成时返回不进片
        if(cagestate>0){
            return (300);
        }
        double widths = glasslist.getglasslengthmm();
        String orderids = glasslist.getordernumber();
        String FrameBarcode = glasslist.getFrameBarcode();
@@ -54,7 +49,10 @@
        // String orderid="A001";
        // 获取订单相关度最高的笼子排序
        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode);
        List<StorageCage> storageCage = spianMapper.selectAllFbarcode(FrameBarcode,widths,400);
        //判断铝框指定空格是否需要间隔空间
        if (storageCage.size() == 0) {
            storageCage = spianMapper.selectAll(orderids, FrameBarcode);
        }
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -31,79 +31,120 @@
        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!=null) {
                cageLists.add(cageList2.get(0));
            }
            for (StorageTask cageList : cageLists) {
                if (cageList.getTaskType().equals("1")) {
                    if(cageList.getGlassId() ==A02glassid1&&DeviceList.get(5)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);
                        ClearGlassId("DB101.10.1");
                    } else if (storageCagez.getGlassId() == B01glassid) {
                        outSliceServive.StopTask(storageCagez.getGlassId(), types);
                    }
                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), types);
                        ClearGlassId("DB101.10.2");
                    } else if (storageCagez.getGlassId() == B02glassid) {
                    }
                    else if(cageList.getGlassId() ==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() ==A02glassid1&&DeviceList.get(5)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), 2);
                        ClearGlassId("DB101.10.1");
                    }
                    else if(cageList.getGlassId() ==B01glassid&&DeviceList.get(2)==0){
                        outSliceServive.StopTask(cageList.getGlassId(), 2);
                        ClearGlassId("DB101.10.2");
                    }
                    else if(cageList.getGlassId() ==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 +154,7 @@
        return Result.success(map);
    }
    //清除玻璃id
    // 清除玻璃id
    public Result ClearGlassId(String position) {
        Map<String, Object> map = new HashMap<>();
        if (S7control.getinstance().CheckConnected() == true) {