wu
2024-03-25 202ca0f62257d108e95ca2e5912b86cf7b407906
Merge branch 'master' of http://10.153.19.25:10101/r/Albania_Mes

# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
# springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
19个文件已修改
1个文件已删除
1237 ■■■■ 已修改文件
.vscode/settings.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/api/home.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/views/home/index.vue 231 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/MyGenerator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java 403 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java 173 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/resources/application.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
.vscode/settings.json
@@ -1,5 +1,6 @@
{
    "java.configuration.updateBuildConfiguration": "interactive",
    "java.debug.settings.onBuildFailureProceed": true,
    "java.compile.nullAnalysis.mode": "automatic"
    "java.compile.nullAnalysis.mode": "automatic",
    "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
Albania_Mes-ui/src/api/home.js
@@ -350,4 +350,31 @@
        method: 'post',
        data
    })
}
//人工拿走AnewMeasure
export function ManualTake(data) {
    return request({
        url: '/home/ManualTake',
        method: 'post',
        data
    })
}
//重新测量
export function AnewMeasure(data) {
    return request({
        url: '/home/AnewMeasure',
        method: 'post',
        data
    })
}
export function importData(data) {
    return request({
        url: '/home/importData',
        method: 'post',
        data
    })
}
Albania_Mes-ui/src/views/home/index.vue
@@ -5,8 +5,8 @@
}
.occupy {
    height: 100%;
    width: 20%;
    height: 50%;
    width: 45%;
    background-color: white;
    margin: 0px 8px 0px 8px;
    border: 1px #EBEEF5 solid;
@@ -74,6 +74,7 @@
    max-width: 57%;
    background-size: 1050px 1400px;
    margin-top: -280px;
    overflow: hidden;
    /* width: 1660px;
    max-width: 100vw;
    background-size: 1660px 560px; */
@@ -82,17 +83,14 @@
}
.blocks-img {
    height: 88px;
    line-height: 90px;
    color: white;
    height: 900px;
    max-width: 100vw;
    background-repeat: no-repeat;
    background-attachment: local;
    width: 32px;
    width: 1200px;
    position: absolute;
    background-image: url('../../img/bigcar01.png');
    background-size: 40px 87px;
    /* background-size: 46px 94px; */
    background-image: url(/img/car.c2f92670.png);
    background-size: 800px 1200px;
}
.blocks-img2 {
@@ -237,80 +235,90 @@
    height: 15px;
    position: absolute;
}
/*
*/
#fileinput .container {
  width: 800px;
  margin: 0 auto;
    width: 800px;
    margin: 0 auto;
}
#fileinput .header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
#fileinput table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid;
    width: 100%;
    border-collapse: collapse;
    border: 1px solid;
}
#fileinput tr,
#fileinput th,
#fileinput td {
  border: 1px solid #000;
  padding: 5px;
    border: 1px solid #000;
    padding: 5px;
}
#fileinput button {
  border: none;
  padding: 5px;
  background-color: #00a297;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  margin: 0 5px;
    border: none;
    padding: 5px;
    background-color: #00a297;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    margin: 0 5px;
}
#fileinput tr:nth-child(2n) {
  background-color: #dcdcdc;
    background-color: #dcdcdc;
}
#fileinput .hide {
  display: none;
    display: none;
}
#fileinput .c1 {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 2;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 2;
}
#fileinput .c2 {
  background-color: white;
  position: fixed;
  width: 400px;
  height: 300px;
  top: 50%;
  left: 50%;
  z-index: 3;
  margin-top: -150px;
  margin-left: -200px;
    background-color: white;
    position: fixed;
    width: 400px;
    height: 300px;
    top: 50%;
    left: 50%;
    z-index: 3;
    margin-top: -150px;
    margin-left: -200px;
}
.cells {
    height: 100%;
}
</style>
<template>
    <el-container>
        <!-- <el-header style="padding: 10px;"></el-header> -->
        <el-main>
            <div class="box" @click="dialogFormVisible2 = true">
            <el-dialog :visible.sync="dialogFormVisible2" :title="$t('Alarm Information')">
                <el-table :data="this.alarm" border style="width: 100%;font-size: 25px;">
                    <el-table-column prop="id" :label="$t('id')"></el-table-column>
                    <el-table-column prop="content" :label="$t('content')"></el-table-column>
                    <el-table-column prop="timeons" :label="$t('timeon')"></el-table-column>
                </el-table>
            </el-dialog>
            <div class="box" @click="dialogFormVisible2 = true" style="z-index: 999;">
                <div class="text">
                    <!-- Alarm: -->
                    {{ this.text }}
@@ -336,22 +344,68 @@
                    {{ $t('Task queue') }}</el-button>
            </div>
            <div style="display: flex;align-items: center;">
            <div style="display: flex;align-items: center;overflow: hidden;">
                <div class="blocks" style="position: relative;width: 100%;">
                    <div class="blocks-img" :style="'z-index:99;left:150px;top:555px;'">
                    </div>
                    <div
                        :style="'position: absolute;z-index:99;left:271px;top:987px;width:210px;height:38px;background-color:' + ShowDeviceList(0) + ';'">
                    </div>
                    <div
                        :style="'position: absolute;z-index:99;left:553px;top:956px;width:110px;height:74px;background-color:' + ShowDeviceList(0) + ';'">
                    </div>
                    <div
                        :style="'position: absolute;z-index:99;left:800px;top:450px;width:115px;height:30px;background-color:' + ShowDeviceList(0) + ';'">
                    </div>
                    <div
                        :style="'position: absolute;z-index:99;left:800px;top:675px;width:115px;height:30px;background-color:' + ShowDeviceList(0) + ';'">
                    </div>
                    <div :style="'position: absolute;z-index:1000;left:740px;top:507px;width:230px;height:114px;'">
                        <div v-for="item in cagelist4" :key="item['id']"
                            :style="'display:flex;height:4.55px;position: relative;'">
                            <div class="cells" v-for="(num) in item['number']" :key="num" :style="'width: ' + (item['glassWidth'] * 0.046) + 'px;background-color:' + ShowCellList(1) + ';position: absolute;left:' +
                ((item['glassWidth'] * 0.046 * (num - 1)) + ((num - 1) * 5)) + 'px;'">
                            </div>
                        </div>
                    </div>
                    <div :style="'position: absolute;z-index:1000;left:740px;top:730px;width:230px;height:90px;'">
                        <div v-for="item in cagelist3" :key="item['id']"
                            :style="'display:flex;height:2.25px;position: relative;'">
                            <div class="cells" v-for="(num) in item['number']" :key="num" :style="'width: ' + (item['glassWidth'] * 0.046) + 'px;background-color:' + ShowCellList(1) + ';position: absolute;left:' +
                ((item['glassWidth'] * 0.046 * (num - 1)) + ((num - 1) * 5)) + 'px;'">
                            </div>
                        </div>
                    </div>
                    <div :style="'position: absolute;z-index:1000;left:740px;top:830px;width:230px;height:90px;'">
                        <div v-for="item in cagelist2" :key="item['id']"
                            :style="'display:flex;height:2.25px;position: relative;'">
                            <div class="cells" v-for="(num) in item['number']" :key="num" :style="'width: ' + (item['glassWidth'] * 0.046) + 'px;background-color:' + ShowCellList(1) + ';position: absolute;left:' +
                ((item['glassWidth'] * 0.046 * (num - 1)) + ((num - 1) * 5)) + 'px;'">
                            </div>
                        </div>
                    </div>
                    <div :style="'position: absolute;z-index:1000;left:740px;top:930px;width:230px;height:90px;'">
                        <div v-for="item in cagelist1" :key="item['id']"
                            :style="'display:flex;height:2.25px;position: relative;'">
                            <div class="cells" v-for="(num) in item['number']" :key="num" :style="'width: ' + (item['glassWidth'] * 0.046) + 'px;background-color:' + ShowCellList(1) + ';position: absolute;left:' +
                ((item['glassWidth'] * 0.046 * (num - 1)) + ((num - 1) * 5)) + 'px;'">
                            </div>
                        </div>
                    </div>
                </div>
                <div>
                    <div style="padding: 10px;display: flex;height:100px;">
                    <div style="padding: 10px;display: flex;height: 300px;flex-wrap: wrap;">
                        <div v-for="item in tableData" :key="item['cageno']" class="occupy">
                            <el-col style="text-align:left;font-weight: bold;">#{{ item['cage'] }}</el-col>
                            <el-col
                                style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
                                <span class="biao">{{ $t('Usage') }}</span><span class="zhi">{{ item['cell'] }}%</span>
                                style="text-align:left;display:flex;justify-content: space-between;align-items: center;height: 70px;">
                                <span class="biao">{{ $t('Usage') }}</span><span class="zhi">{{ item['width'] }}%</span>
                            </el-col>
                            <hr style="width:80%;margin: 0 auto;" />
                            <el-col
                                style="text-align:left;display:flex;justify-content: space-between;align-items: center;">
                                <span class="biao">{{ $t('Space (Pieces)') }}</span><span class="zhi">{{ item['state']
                                <span class="biao">{{ $t('Space (Pieces)') }}</span><span class="zhi">{{ item['cell']
                                    }}</span>
                            </el-col>
                        </div>
@@ -397,7 +451,7 @@
            <div id="fileinput" class="container">
                <div class="header">
                    <div class="btn">
                        <button @click="AllAdd">保存</button>
                        <el-button type="primary" @click="importData()">保存</el-button>
                    </div>
                    <div class="inp">
                        <input type="file" id="uploadExcel" multiple @change="Change" />
@@ -440,7 +494,7 @@
                            <td>{{ item.films }}</td>
                            <td>{{ item.quantity }}</td>
                            <td>{{ item.tier }}</td>
                            <td>{{ item.matching}}</td>
                            <td>{{ item.matching }}</td>
                            <td>{{ item.glasstype }}</td>
                            <td>{{ item.productname }}</td>
                        </tr>
@@ -457,7 +511,9 @@
                    <el-button type="primary" @click="ManualMatching()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">人工匹配</el-button>
                    <el-button type="primary" @click="ManualTake()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">人工匹配</el-button>
                        style="z-index: 999;">人工拿走</el-button>
                    <el-button type="primary" @click="AnewMeasure()" :disabled="SoftEmergencyStopState"
                        style="z-index: 999;">重新测量</el-button>
                </div>
                <!--显示-->
                <div style="width:1000px;height: 720px;border: 2px solid #d1d1d1;margin: auto auto;">
@@ -597,11 +653,11 @@
<script>
import {
    home, home2, SelectCageInfo,
    home, SelectCageInfo,
    Disabled, SelectPermissionByUserName, currentUsername, CompleteQueue,
    isAllowReorderings,
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue
    UpdateStroageCageByCell, FinishTask, SelectGlassInfo, StorageCageAddGlass, ClaimTasks, ModeChange, UpdateQueue,importData,ManualTake,AnewMeasure
} from "../../api/home";
@@ -704,7 +760,7 @@
            reset: false,
            isQueueWarning: false,
            CurrentFrame: [],
            DeviceList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            DeviceList: [1, 1, 1, 1],
            GlassIdList: [],
            Scanningmethod: true,
            CurrrentGlassId: "",
@@ -760,7 +816,10 @@
                        // this.car1 = 210 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                        // this.car2 = 300 + 11.25 * (obj.params[0][1]-this.carlist[1]['start'])/(this.carlist[1]['end']-this.carlist[1]['start'])*100;
                    }
                    // 获取设备状态
                    if (obj.DeviceList != null) {
                        this.DeviceList = obj.DeviceList[0];
                    }
                    this.tableData = obj.tableData[0];
                    this.cagelist1 = obj.cagelist1[0];
                    this.cagelist2 = obj.cagelist2[0];
@@ -848,13 +907,6 @@
            SelectCageInfo("").then(res => {
                this.cageinfo = res.data.cageinfo;
                this.currentPages = 1;
            });
            //加载理片笼玻璃数据
            home2().then(res => {
                this.cagelist1 = res.data.list1;
                this.cagelist2 = res.data.list2;
                this.cagelist3 = res.data.list3;
                this.cagelist4 = res.data.list4;
            });
        },
        //添加理片笼玻璃
@@ -978,6 +1030,15 @@
                }
            }
        },
        //获取设备显示状态
        ShowCellList(num) {
            if (num == null) {
                return "";
            } else if (num > 0) {
                return "gray";
                // return "rgba(0,0,0,1)";
            }
        },
        //获取设备玻璃id
        ShowGlassIdList(num) {
            if (this.GlassIdList != null && this.GlassIdList.length > 0) {
@@ -991,7 +1052,21 @@
        },
        //人工拿走
        ManualTake() {
            let s="123";
            ManualTake(s).then(res => {
                if (res.data.message == 200) {
                    console.log(res.data.message);
                }
            })
        },
        //重新测量
        AnewMeasure() {
            let s="123";
            AnewMeasure(s).then(res => {
                if (res.data.message == 200) {
                    console.log(res.data.message);
                }
            })
        },
        Change(event) {
            // 获取到文件夹
@@ -1005,9 +1080,9 @@
                let _this = this //把data里的数据赋值给新的变量
                // wb:wordbook 工作表  
                reader.addEventListener("load", function (e) {
                    var data = e.target.result; //读取成功后result中的数据
                    var wb = XLSX.read(data, { type: "binary" });
                    var wb = XLSX.read(data, { type: "binary" });
                    let sheetName = wb.SheetNames[0]; //是获取Sheets中第一个Sheet的名字
                    let sheets = wb.Sheets[sheetName];
                    let dataList2 = JSON.stringify(XLSX.utils.sheet_to_json(sheets));
@@ -1020,17 +1095,21 @@
            }
        },
        Add() {
        },
        Hide() {
        },
        AllAdd() {
            //添加数据进后台
            console.log(this.dataList);
        importData() {
            //let tbdata=JSON.stringify(this.dataList);
            let tbdata=this.dataList;
            console.log(tbdata);
            importData(tbdata).then(res => {
                if (res.data.message == 200) {
                    //this.$message.success(this.$t('Operation successful'));
                }
            });
        },
        del() {
            this.StorageCageAdd = true;
        }
springboot-vue3/src/main/java/MyGenerator.java
@@ -18,7 +18,7 @@
public class MyGenerator {
    /** 数据源配置*/
    private static final String jdbc = "jdbc:mysql://10.153.19.150:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai";
    private static final String jdbc = "jdbc:mysql://192.168.10.99:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai";
    private static final String driverName = "com.mysql.cj.jdbc.Driver";
    private static final String username = "root";
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutoMes.java
@@ -81,18 +81,18 @@
            // readAndUpdateWordValues(PlcframeObject);
            
            // readAndUpdateWordValues(plcStateObject);
            int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex();
            // System.out.println(index);
            PlcMesObject.getPlcParameter("AddStart").getAddress(index);
            // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index));
            List<String> addresses = new ArrayList<>();
            addresses.add("FeedID");
            addresses.add("AddStart");
            // System.out.println(addresses);
            // System.out.println(PlcMesObject.getPlcParameterValues(addresses));
            List<String> addresses2 = new ArrayList<>();
            addresses2.add("FeedID");
            addresses2.add("FeedCarStatus");
            // int index = PlcMesObject.getPlcParameter("AddStart").getAddressIndex();
            // // System.out.println(index);
            // PlcMesObject.getPlcParameter("AddStart").getAddress(index);
            // // System.out.println(PlcMesObject.getPlcParameter("AddStart").getAddress(index));
            // List<String> addresses = new ArrayList<>();
            // addresses.add("FeedID");
            // addresses.add("AddStart");
            // // System.out.println(addresses);
            // // System.out.println(PlcMesObject.getPlcParameterValues(addresses));
            // List<String> addresses2 = new ArrayList<>();
            // addresses2.add("FeedID");
            // addresses2.add("FeedCarStatus");
            //System.out.println(PlcReadObject.getPlcParameterValues(addresses2));
springboot-vue3/src/main/java/com/example/springboot/component/PlcHoldNew.java
@@ -1,17 +1,25 @@
package com.example.springboot.component;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import com.example.springboot.service.JdbcConnections;
import com.example.springboot.service.SpianServiceNew;
import com.example.springboot.service.StorageCageService;
import com.example.springboot.entity.north_glass_buffer1;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.AlarmMapper;
import com.example.springboot.mapper.AlbaniaMapper;
import com.example.springboot.mapper.SpianMapper;
public class PlcHoldNew extends Thread {
  private AlarmMapper alarmMapper;
  @Autowired
  private JdbcConnections jdbcConnections;
  private AlbaniaMapper albaniaMapper;
  private SpianServiceNew spianService;
  private StorageCageService storageCageService;
  int aaa;
  @Override
@@ -25,16 +33,14 @@
        // \\ TODO Auto-generated catch block
        e.printStackTrace();
      }
      //S7control.getinstance().ReadWord("DB14.0", 1);
      // if (S7control.getinstance().CheckConnected() == false) {
      spianService = WebSocketServer.applicationContext.getBean(SpianServiceNew.class);
      albaniaMapper = WebSocketServer.applicationContext.getBean(AlbaniaMapper.class);
      spianService.selectAll(albaniaMapper.SelectGlass());
      //spianService.selectAll(albaniaMapper.SelectGlass());
      //读取DB14区文件
      PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      
      String ExportTOMES1=plcmes.getPlcParameter("ExportTOMES1").getValue();//出片请求一线
      String ExportToMES2=plcmes.getPlcParameter("ExportToMES2").getValue();//出片请求二线
      String PLCToMES=plcmes.getPlcParameter("PLCToMES").getValue();//进片请求
@@ -43,42 +49,42 @@
  
      
      //一号线请求
      if (ExportTOMES1.equals("1") == true&&B01State.equals("0")==true) {
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        spianService.selectout(1);
      }
      //二线号请求时
      if (ExportToMES2.equals("1") == true&&B01State.equals("0")==true) {
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        spianService.selectout(2);
      }
      // if (ExportTOMES1.equals("1") == true&&B01State.equals("0")==true) {
      //   //将运输车状态改为忙碌
      //   S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
      //   spianService.selectout(1);
      // }
      // //二线号请求时
      // if (ExportToMES2.equals("1") == true&&B01State.equals("0")==true) {
      //   //将运输车状态改为忙碌
      //   S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
      //   spianService.selectout(2);
      // }
      //进片请求时
      if(PLCToMES!=null && B01State!=null){
      if(PLCToMES.equals("1")==true&&B01State.equals("0")==true){
        //将运输车状态改为忙碌
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        //S7control.getinstance().WriteWord(plcmes.getPlcParameter("B01report").getAddress(), (short) 1);
        
        spianService.selectAll(albaniaMapper.SelectGlass());
      }
      //任务完成时
      if(TastState.equals("1")==true){
        
        //完成确认字
        for(int i=1;i<7;i++){
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//依次获取任务ID
            int tastid=albaniaMapper.SelectTaskId(Glassid.substring(0,14));
          String Tastover=plcmes.getPlcParameter("IDStatus"+i).getValue();//依次获取任务类型
          String Glassid=plcmes.getPlcParameter("MESID"+i).getValue();//依次获取任务类型
          if(Tastover.equals("1")){
            //调用完成任务 Glassid
            storageCageService.FinishTask(tastid);
            //删除queue表的数据
            albaniaMapper.DeleteQueue(Glassid.substring(0,14));
            S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStatus"+i).getAddress(), (short) 1);//完成确认字
          }
        }
      }
    }
  
      // 查询数据库
      // 推送到前端
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -77,13 +77,13 @@
                storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
                // 笼子使用情况
                List<StorageCage> tableData = homeMapper.selectAll();
                List<StorageCage> tableData = homeMapper.selectAlls();
                jsonObject.append("tableData", tableData);
                // 格理片笼格子状态
                List<StorageCage> cagelist1 = homeMapper.selectRack1();
                List<StorageCage> cagelist2 = homeMapper.selectRack2();
                List<StorageCage> cagelist3 = homeMapper.selectRack3();
                List<StorageCage> cagelist4 = homeMapper.selectRack4();
                List<StorageCage> cagelist1=storageCageService.SelectStorageCageByCage(1);
                List<StorageCage> cagelist2=storageCageService.SelectStorageCageByCage(2);
                List<StorageCage> cagelist3=storageCageService.SelectStorageCageByCage(3);
                List<StorageCage> cagelist4=storageCageService.SelectStorageCageByCage(4);
                jsonObject.append("cagelist1", cagelist1);
                jsonObject.append("cagelist2", cagelist2);
                jsonObject.append("cagelist3", cagelist3);
@@ -116,9 +116,16 @@
                //读取DB105区文件
                PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      
                //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求
                //double width=plcmes.getPlcParameter("Height").getValue();//宽
                //double height=plcmes.getPlcParameter("width").getValue();//高
                // String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求
                // String MesSend=plcmes.getPlcParameter("MESToGaStatus").getValue();//发送
                // double width=Double.valueOf(plcmes.getPlcParameter("Height").getValue());//宽
                // double height=Double.valueOf(plcmes.getPlcParameter("width").getValue());//高
                String PlcRequest=S7control.getinstance().ReadWord("DB14.26", 1).get(0)+"";
                double width=Double.parseDouble(S7control.getinstance().ReadWord("DB14.28", 1).get(0)+"");
                double height=Double.parseDouble(S7control.getinstance().ReadWord("DB14.30", 1).get(0)+"");
                String MesSend=S7control.getinstance().ReadWord("DB14.170", 1).get(0)+"";
                //获取测量的长,宽
                
                
@@ -131,15 +138,27 @@
                String PlcRequest = "1";
                double width = 402;
                double height = 402;
                // String PlcRequest = "1";
                // String MesSend = "0";
                // double width = 402;
                // double height = 402;
                
                //匹配
                if ("1".equals(PlcRequest)) {
                    GlassInfo MesureGlassinfo=HomeService.Normal(width, height, "1");
                //System.err.println(PlcRequest+","+MesSend+","+width+","+height);
                if ("0".equals(PlcRequest)) {
                    S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 0);
                }
                if ("1".equals(PlcRequest)&&"0".equals(MesSend)) {
                    boolean is=HomeService.Normal(width, height, "1");
                    if (is) {
                        // 测量成功
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 1);
                    }else{
                        // 重新测量
                        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 4);
                    }
                }
                Queue LastQueue= QueueMapper.selectLastQueue();
                // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
@@ -158,7 +177,7 @@
                List<StorageTask> StoragTaskeTaskOut = storageCageService.SelectStorageTask(1);
                jsonObject.append("StoragTaskeTaskOut", StoragTaskeTaskOut);
                //查询当前订单任务
                // //查询当前订单任务
                List<FlowCard> OrderTask = storageCageService.SelectOrderTask();
                jsonObject.append("OrderTask", OrderTask);
springboot-vue3/src/main/java/com/example/springboot/component/PlchomeNew.java
File was deleted
springboot-vue3/src/main/java/com/example/springboot/component/S7control.java
@@ -201,7 +201,6 @@
    public List<Short> ReadWord(String address, int count) {
        if (s7PLC == null)
            return null;
        List<String> addresslist = GetAddressList(address, count, 16);
        try {
            return s7PLC.readInt16(addresslist);
@@ -211,7 +210,13 @@
            return null;
        }
    }
    public byte[] Readbyte(String address, int count) {
        byte[] byt=new byte[count];
        int wordcount=((count%2==0)?count/2:count+1);
        List<Short> word=ReadWord(address,wordcount);
        return byt;
    }
    /**
     * 按指定的地址 读取byte结果集
     * 
@@ -465,7 +470,10 @@
        }
        return addresslist;
    }
    public void writeString(String addr,String data) {
        s7PLC.writeString(addr,data);
    }
    public String readStrings(String addr) {
        return s7PLC.readString(addr);
    }
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
@@ -16,30 +16,29 @@
        // TODO Auto-generated method stub
        //
        System.out.println("启动完成");
        //new PLCAutoMes().start();
        //  new PlcHold().start();
          new PlcHoldNew().start();
        new PLCAutoMes().start();
        // new PlcHold().start();
        new PlcHoldNew().start();
        //  new Plchome().start();
        //  new PlcLayout().start();
        //  new Plcalarm().start();
        //  new Plcsign().start();
        //  new Plcstate().start();
        //  new PlcPositioning1().start();
        //  new PlcParameter2().start();
        //  new PLCAutomaticParameterSetting().start();
        //new Plchome().start();
        // new PlcLayout().start();
        // new Plcalarm().start();
        // new Plcsign().start();
        // new Plcstate().start();
        // new PlcPositioning1().start();
        // new PlcParameter2().start();
        // new PLCAutomaticParameterSetting().start();
        //  new PlcManualonePosition().start();
        //  new PlcManualonePosition2().start();
        //  new PlcServoManualone().start();
        //  new PLCManualJog().start();
        //  new Plclog().start();
        // new PlcManualonePosition().start();
        // new PlcManualonePosition2().start();
        // new PlcServoManualone().start();
        // new PLCManualJog().start();
        // new Plclog().start();
        //  new PlcInteractionState().start();
        //new PlcParameter1Review().start();
        //new PLCAutomaticParameterSettingReview2().start();
        // new PlcInteractionState().start();
        // new PlcParameter1Review().start();
        // new PLCAutomaticParameterSettingReview2().start();
    // new PLCManualJogReview().start();
        // new PLCManualJogReview().start();
    }
}
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java
@@ -1,6 +1,7 @@
package com.example.springboot.controller;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -16,6 +17,11 @@
import com.example.springboot.service.OutSliceServive;
import com.example.springboot.service.SpianService;
import com.example.springboot.service.StorageCageService;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import cn.hutool.core.lang.Console;
import com.example.springboot.common.Result;
import com.example.springboot.component.Plchome;
@@ -482,10 +488,25 @@
  public Result ModeChange(String flowcard,Integer method) {
    return storageCageService.ModeChange(flowcard,method);
  }
   //添加玻璃信息到测量信息
   @PostMapping("/UpdateQueue")
   public Result UpdateQueue(@RequestBody GlassInfo glassInfo) {
     return storageCageService.UpdateQueue(glassInfo);
   }
    //人工拿走
    @PostMapping("/ManualTake")
    public Result ManualTake(@RequestBody String glassInfo) {
      return storageCageService.ManualTake(glassInfo);
    }
    //重新测量
    @PostMapping("/AnewMeasure")
    public Result AnewMeasure(@RequestBody String glassInfo) {
      return storageCageService.AnewMeasure(glassInfo);
    }
   //导入数据 :添加玻璃信息
   @PostMapping("/importData")
   public Result importData(@RequestBody List<Map> IportDataStr) {
     return storageCageService.AddGlassinfo(IportDataStr);
   }
}
springboot-vue3/src/main/java/com/example/springboot/entity/GlassInfo.java
@@ -20,6 +20,7 @@
  private Double thickness;// 厚
  private Integer number;// 数量
  private Integer finishnumber;// 完成数量
  private Integer sumtier;// 完成数量
  private Integer measurenumber;// 测量完成数量
  private Integer cageno;//笼内数量
}
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java
@@ -112,8 +112,8 @@
        }
        if (addressLength == 14 ) {
            int wordindex = index;
            int newIndex = wordindex + 13;
            return stringdatas[0] + "." + wordindex +"-" + newIndex;
            //int newIndex = wordindex + 13;
            return stringdatas[0] + "." + wordindex ;
        }
        return null;
    }
springboot-vue3/src/main/java/com/example/springboot/entity/glassinfo.java
@@ -20,6 +20,7 @@
  private Double thickness;// 厚
  private Integer number;// 数量
  private Integer finishnumber;// 完成数量
  private Integer sumtier;// 完成数量
  private Integer measurenumber;// 测量完成数量
  private Integer cageno;//笼内数量
}
springboot-vue3/src/main/java/com/example/springboot/mapper/HomeMapper.java
@@ -14,12 +14,16 @@
import com.example.springboot.entity.RolePermission;
import java.util.List;
import java.util.Map;
@Mapper
public interface HomeMapper {
  //查询每个笼子的使用情况
  // 查询每个笼子的使用情况
  @Select("select cage,round(100-(21-sum(if(state>0,1,state)))/21*100) as cell,21-sum(if(state>0,1,state)) as state from (select cage,cell,max(state) as state from storage_cage group by cage,cell) as cages group by cage")
  List<StorageCage> selectAll();
  @Select("Select cage,sum(case when number=0 or number is null then 1 else 0 end) as cell,100-sum(case when number=0 or number is null then 1 else 0 end)/count(id)*100 as width from storage_cage group by cage")
  List<StorageCage> selectAlls();
  // 查询10-6笼内层格子状态
  @Select("SELECT cage,state,ifnull(glasswidth/2750*2,0) as glasswidth from storage_cage where cage>5 and tier=2 order by cage desc,cell desc")
@@ -36,8 +40,6 @@
  // 查询5-1笼外层格子状态
  @Select("SELECT case when tier=1 then cage else 0 end as cage,case when tier=1 then state else 0 end as state,sum(case when tier=1 then glasswidth/2750*2 else 0 end) as glasswidth,sum(case when tier=2 then glasswidth/2750*2 else 0 end) as width  from storage_cage where cage<=5  group by cage,cell order by cage desc,cell desc")
  List<StorageCage> selectRack4();
  // 根据任务类型查询当前正在出片,进片的玻璃信息
  @Select("select * from storage_cage where state=#{task_type}")
@@ -61,17 +63,17 @@
  // 手动完成任务
  @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);
  void UpdateTask(@Param("task_type") Integer task_type, String glassid);
  // 手动完成进片任务修改笼子数据
  @Update("update storage_cage set state=1 where glass_id=#{glassid} and state=2")
  void UpdateCageTask1(@Param("glassid") String glassid);
  //获取报警信息
  // 获取报警信息
  @Select("select id,content,timeon as timeons,endTime from alarmmg where endTime is null")
  List<alarmmg> SelectAlarmmgInfo();
  //获取理片笼内玻璃信息
  // 获取理片笼内玻璃信息
  @Select("select * from storage_cage where position(#{cage} in ifnull(glass_id,\"\"))")
  List<StorageCage> SelectCageInfo(String cage);
@@ -79,11 +81,11 @@
  @Update("update storage_cage set state=0,glass_id=null,order_id=null,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,listid=null,boxid=null,FrameBarcode=null where glass_id=#{glassid}")
  void DeleteByGlassID(String glassid);
  //查询小车位置
  // 查询小车位置
  @Select("select * from car_position")
  List<CarPosition> Loadcarlist();
  //查询操作密码
  // 查询操作密码
  @Select("select dianqimima from user where id=1")
  String SelectPassword();
@@ -91,93 +93,95 @@
  // @Select("select * from storage_cage where glass_id=#{glassid}")
  // StorageCage SelectGlassInfo(String glassid);
  //根据玻璃id查询理片笼信息
  // 根据玻璃id查询理片笼信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  List<StorageCage> SelectStorageInfoByGlassId(String glassid);
  //查询玻璃信息
//  @Select("select * from glass where glassid=#{glassid}")
  // 查询玻璃信息
  // @Select("select * from glass where glassid=#{glassid}")
  @Select("SELECT ordernumber,listnumber,boxnumber,barcode,glasslength,glassheight,glasslength_mm,glassheight_mm FROM north_glass_buffer1 where barcode=#{barcode}")
  north_glass_buffer1 SelectGlassByGlassID(String barcode);
  //启用/禁用理片笼格子
  // 启用/禁用理片笼格子
  @Update("update storage_cage set disabled=#{disabled} where cage=#{cage} and cell=#{cell}")
  void Disabled(short cage, short cell, short disabled);
  //理片笼新增玻璃
  // 理片笼新增玻璃
  @Update("update storage_cage set state=1,glass_id=#{glass.glassId},order_id=#{glass.orderId},glasswidth=#{glass.glasswidth},glassheight=#{glass.glassheight},glasswidthmm=#{glass.glasswidthmm},glassheightmm=#{glass.glassheightmm},listid=#{glass.listId},boxid=#{glass.boxId} where cage=#{cage} and cell=#{cell} and tier=#{tier}")
  void Inglassid(Queue glass, short cage, short cell, short tier);
  //查询理片笼中是否有此玻璃
  // 查询理片笼中是否有此玻璃
  @Select("select count(*) from storage_cage where glass_id=#{glassId}")
  short SelectStorageByGlassId(String glassId);
  //根据订单查询玻璃信息
  // 根据订单查询玻璃信息
  @Select("select * from north_glass_buffer1 where position(#{orderid} in ordernumber)")
  List<north_glass_buffer1> SelectGlass(String orderid);
  //获取上片队列信息
  // 获取上片队列信息
  @Select("select * from queue where id=#{id}")
  Queue GetQueueInfo(int id);
  //手动添加扫码位玻璃
  // 手动添加扫码位玻璃
  @Update("update queue set glassid=#{queue.glassId},orderid=#{queue.orderId},listId=#{queue.listId},boxId=#{queue.boxId},glasswidth=#{queue.glasswidth},glassheight=#{queue.glassheight},glasswidthmm=#{queue.glasswidthmm},glassheightmm=#{queue.glassheightmm},state=1 where id=#{id}")
  void InsertQueueGlassId(Queue queue,Short id);
  void InsertQueueGlassId(Queue queue, Short id);
  //确认扫码位玻璃信息
  // 确认扫码位玻璃信息
  @Update("update queue set state=1 where id=1")
  void UpdateQueueState();
  //手动添加扫码位玻璃
  // 手动添加扫码位玻璃
  @Update("update queue set glassid=null,orderid=null,listid=null,boxid=null,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,state=0 where id=#{id}")
  void DeleteQueueGlass(String id);
  //查询此订单在理片笼里的玻璃数
  // 查询此订单在理片笼里的玻璃数
  @Select("select count(*) from storage_cage where order_id=#{orderid}")
  Short SelectGlassNo(String orderid);
  //根据玻璃id从客户表查询数据
  // 根据玻璃id从客户表查询数据
  @Select("select * from north_glass_buffer1 where barcode=#{glassid}")
  north_glass_buffer1 SelectBoxNo(String glassid);
  //查询出片队列信息
  // 查询出片队列信息
  @Select("select * from out_slice order by sequence")
  List<Out_slice> SelectProductionqueue();
  //根据玻璃id查询笼内玻璃信息
  // 根据玻璃id查询笼内玻璃信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  StorageCage SelectStorageGlassById(String glassid);
  //根据玻璃id查询笼内玻璃信息
  // 根据玻璃id查询笼内玻璃信息
  @Select("select * from storage_cage where glass_id=#{glassid}")
  List<StorageCage> SelectStoragesGlassById(String glassid);
  // //根据玻璃id删除出片队列玻璃
  // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0 or state=1 or state=2)")
  // @Update("update out_slice set state=4 where barcode=#{FrameNo} and (state=0
  // or state=1 or state=2)")
  // void DeleteProductionQueueGlass(String id);
  //根据铝框id查询对应玻璃信息
  // 根据铝框id查询对应玻璃信息
  @Select("select * from north_glass_buffer1 where FrameBarcode=#{FrameBarcode}")
  List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
  //根据玻璃id查询出片队列信息
  // 根据玻璃id查询出片队列信息
  @Select("select * from out_slice where glassid=#{getbarcode}")
  Out_slice SelectQueueByglassid(String getbarcode);
  //添加出片队列
  // 添加出片队列
  @Insert("INSERT INTO out_slice( `glassId`, `barcode`, `glasswidth`, `glassheight`, `state`, `flip`, `sequence`, `time` ,`position` ,`orderid` ,`listid` ,`boxid` ,`glasswidthmm` ,`glassheightmm` ,`framewidthmm` ,`frameheightmm` ,`framestate` ) VALUES ( #{glassid}, #{FrameNo}, #{glasslengthMm}, #{glassheightMm}, #{state}, #{flip}, #{sequence}, now(), #{position}, #{orderid}, #{listid}, #{boxid}, #{glasswidth}, #{glassheight}, #{framewidthmm}, #{frameheightmm}, 0);")
  void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm, int sequence, String position, Short state,String orderid, String listid, String boxid, String glasswidth, String glassheight,String framewidthmm,String frameheightmm);
  void AddOutSliceS(String glassid, String flip, String FrameNo, String glasslengthMm, String glassheightMm,
      int sequence, String position, Short state, String orderid, String listid, String boxid, String glasswidth,
      String glassheight, String framewidthmm, String frameheightmm);
  //出片队列调序
  // 出片队列调序
  @Update("update out_slice set sequence=#{sequence} where glassid=#{glassId}")
  void UpdateOutSliceSequence(String glassId,int sequence);
  void UpdateOutSliceSequence(String glassId, int sequence);
  //查询出片队列最大顺序
  // 查询出片队列最大顺序
  @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 or permission_id=39)")
  List<RolePermission> SelectPermissionByUserName(String username);
@@ -185,85 +189,84 @@
  // @Update("update out_slice set state=2 where id=#{id}")
  // void CompleteQueue(String id);
  //根据玻璃完成出片任务
  // 根据玻璃完成出片任务
  @Update("update out_slice set state=2 where glassid=#{glassid}")
  void CompleteQueueByGlassId(String glassid);
  //查询铝框id对应玻璃完成数量
  // 查询铝框id对应玻璃完成数量
  @Select("select count(*) from out_slice where barcode=#{frameid} and state!=4")
  Short SelectCountByFrameNo(String frameid);
  //删除已完成的任务
  // 删除已完成的任务
  @Delete("delete from out_slice where Barcode=#{frameid}")
  void CompleteQueueByFrameNo(String frameid);
  //查询笼内格子剩余宽度
  // 查询笼内格子剩余宽度
  @Select("Select width from storage_cage where cage=#{cage} and cell=#{cell} limit 1")
  Double SelectCageWidth(short cage, short cell);
  //修改出片队列玻璃状态为缺失
  // 修改出片队列玻璃状态为缺失
  @Update("update out_slice set state=3 where glassId=#{glassid} and state<3")
  void UpdateOutSliceGlass(String glassid);
  //查询未完成的任务
  // 查询未完成的任务
  @Select("select * from storage_task where task_state=0 and task_type=#{task_type}")
  List<StorageTask> SelectTaskByState(int task_type);
  //修改出片队列铝框状态
  // 修改出片队列铝框状态
  @Update("update out_slice set framestate=1 where barcode=#{frameno}")
  void FrameStateUpdate(String frameno);
  //查询当前铝框信息
  // 查询当前铝框信息
  @Select("select * from out_slice where framestate=0 order by id limit 1")
  Out_slice SelectCurrentFrame();
  //根据玻璃id查询任务信息
  // 根据玻璃id查询任务信息
  @Select("select task_type from storage_task where glass_id=#{glassid} and task_state!=1")
  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);
  //获取铝框有没有正在出片的玻璃
  // 获取铝框有没有正在出片的玻璃
  @Select("select count(*) from out_slice where barcode=#{frameNo} and state=1")
  Short SelectOutingQueueCount(String frameNo);
  //查询理片笼内信息
  // 查询理片笼内信息
  @Select("select * from storage_cage")
  List<StorageCage> SelectStorageCageInfo();
  //删除格子内玻璃信息
  // 删除格子内玻璃信息
  @Update("update storage_cage set width=5000,glasswidth=null,glassheight=null,glasswidthmm=null,glassheightmm=null,thickness=null,glasstype=null,number=null where cell=#{cell}")
  void DeleteStroageCageByCell(Integer cell);
  //修改格子玻璃数量
  // 修改格子玻璃数量
  @Update("update storage_cage set number=ifnull(number,0)+#{num} where cell=#{cell}")
  void updateStroageCageByCell(Integer cell, Integer num);
  //计算格子内剩余宽度
  // 计算格子内剩余宽度
  @Update("update storage_cage set width=5000-(glasswidth+100)*number where cell=#{cell}")
  void UpdateStroageCageWidthByCell(Integer cell);
  //根据任务类型获取任务
  // 根据任务类型获取任务
  @Select("select * from storage_task where task_type=#{task_type} and task_state=0")
  List<StorageTask> SelectStorageTask(int task_type);
  //根据id任务
  // 根据id任务
  @Select("select * from storage_task where id=#{id}")
  StorageTask SelectStorageTaskById(int id);
  //根据格子查询玻璃信息
  // 根据格子查询玻璃信息
  @Select("select * from storage_cage where cell=#{cell}")
  StorageCage SelectStorageByCell(String cell);
  //手动完成任务
  // 手动完成任务
  @Select("update storage_task set task_state=1 where id=1429")
  void FinishTask(Integer id);
  @Select("select gi.* from glassinfo gi inner join flowcard fc on gi.flowcard=fc.flowcard where fc.state!=2 and position(#{width} in gi.width) and position(#{height} in gi.height) and position(#{thickness} in gi.thickness) and position(#{films} in gi.films) group by gi.id")
  List<GlassInfo> SelectGlassInfo(String width,String height,String thickness,String films);
  List<GlassInfo> SelectGlassInfo(String width, String height, String thickness, String films);
  @Update("update storage_cage set glasstype=#{glassInfo.glasstype},glasswidth=#{glassInfo.width},glassheight=#{glassInfo.height},thickness=#{glassInfo.thickness},films=#{glassInfo.films},number=0 where cell=#{cell}")
  void StorageCageAddGlass(String cell, GlassInfo glassInfo);
@@ -281,10 +284,32 @@
  void ModeChange(String flowcard, int method);
  @Update("update queue set flowcard=#{flowcard},glasswidth=#{width},glassheight=#{height},glasstype=#{glasstype},state=1 where state<=0")
  void UpdateQueue(String flowcard,double width,double height,Integer glasstype);
  void UpdateQueue(String flowcard, double width, double height, Integer glasstype);
  @Update("update glassinfo set finishnumber=finishnumber+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
  @Update("update glassinfo set finishnumber=ifnull(finishnumber,0)+1 where flowcard=#{flowcard} and mateid=#{mateid} and tier=#{geTier}")
  void AddGlassNo(String flowcard, Integer mateid, Integer geTier);
  // 添加出片队列
  @Insert("INSERT INTO glassinfo (`flowcard`, `glasstype`, `mateid`, `glassid`, `tier`, `films`, `width`, `height`, `thickness`, `number`, `finishnumber`, `sumtier`, `measurenumber`)"
      +
      " VALUES (#{flowcard}, #{glasstype}, #{mateid}, #{glassid}, #{tier}, #{films}, #{width}, #{height}, #{thickness}, #{number}, 0, #{sumtier}, 0)")
  void AddGlassinfo(String flowcard, Integer glasstype, Integer mateid, String glassid, Integer tier, String films,
      Double width, Double height, Double thickness, Integer number, Integer sumtier);
  // 最大玻璃类型
  @Select("select max(glasstype)+1 from glassinfo")
  Integer SelectMaxType();
  // 查询全部玻璃类型
  @Select("select CONCAT(IFNULL(width,''),'_',IFNULL(height,''),'_',IFNULL(thickness,''),'_',IFNULL(films,'')) as type,glasstype from glassinfo GROUP BY width,height,thickness,films")
  List<Map> SelectType();
  // 查询总层数
  @Select("SELECT CONCAT(IFNULL(flowcard,''),'_',IFNULL(mateid,'')),count(*) as tiersum FROM `glassinfo` group by flowcard,mateid")
  List<Map> Selecttiersum();
  // 查询笼内玻璃信息
  @Select("select * from storage_cage where cage=#{cage} order by id desc")
  List<StorageCage> SelectStorageCageByCage(Integer cage);
}
springboot-vue3/src/main/java/com/example/springboot/mapper/QueueMapper.java
@@ -38,4 +38,7 @@
                        "values (null,null,null,null,null,null,#{glasswidthmm},#{glassheightmm},null,#{state},NOW())")
    void insertMatchFailure(@Param("glasswidthmm") double glasswidthmm, @Param("glassheightmm") double glassheightmm,@Param("state") int state);
    @Delete("delete from queue where state<=0")
    void DeleteErrorQueue();
}
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
@@ -63,11 +63,11 @@
    }
    // 匹配逻辑
    public GlassInfo Normal(double width, double height, String line) {
    public boolean Normal(double width, double height, String line) {
        List<Queue> ErrowQueues= QueueMapper.selectErrorQueues();
        if (ErrowQueues.size()>0) {
            //System.out.println("有匹配失败数据未去除");
            return new GlassInfo();
            return false;
        }
        List<GlassInfo> Result = NormalGlassInfo(width, height, "1");
        if (Result.size() == 1) {
@@ -77,7 +77,7 @@
            GlassInfoMapper.updatemeasurenumber(GlassInfo.getId());
            System.out.println("匹配成功");
            System.out.println(GlassInfo.getGlassid());
            return GlassInfo;
            return true;
        } else if (Result.size() > 1) {
            // 匹配失败 匹配到多条符合的数据 添加数据
            QueueMapper.insertMatchFailure(width, height, 0);
@@ -88,7 +88,7 @@
            QueueMapper.insertMatchFailure(width, height, -1);
            System.out.println("未找到符合的数据");
        }
        return new GlassInfo();
        return false;
    }
    // Execl表格 传入文件路径
springboot-vue3/src/main/java/com/example/springboot/service/SpianServiceNew.java
@@ -40,6 +40,8 @@
    //如果有同类型时直接增加
    if(cageid!=Integer.MIN_VALUE){
        //发送plc任务
        Mestast(glassid, 1001, cageid, 1,"MESID1");
        //任务发送字
        //Mestast(glassid,1001,cageid,1);
        
    }else{ 
@@ -52,7 +54,7 @@
        }
        //当返回的格子号为空时,返回400笼子已满
        if(cageid!=Integer.MIN_VALUE){
            Mestast(glassid,1001,cageid,1);
            Mestast(glassid,1001,cageid,1,"MESID1");
            //发送plc任务
            
        }else{
@@ -84,7 +86,7 @@
   
                    StorageCage glass= albaniaMapper.SelectCageGlass(glasstype);
                    //发送配片数据
                    Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0);
                    Mestast(glassmate.getGlasstype()+"i", glass.getId(),2002, 0,"MESID1");
                    albaniaMapper.AddFinishNumber(flowcard, mateid, tier);
                    albaniaMapper.Inserttask(1, 0, glass.getId(), 2002, glassmate.getGlassid()+i, glasstype,glass.getFlowcard(),mateid,tier);
                    if(tier==sumid){
@@ -111,8 +113,12 @@
            glassidlist.add((byte) iditem);
        }
        byte[] bytes = Bytes.toArray(glassidlist);
        //writeString
        System.out.println("outmesidbytes:" + bytes.length);
        S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(),bytes);
        System.out.println(plcmes.getPlcParameter(address).getAddress());
        System.out.println();
        //S7control.getinstance().WriteByte(plcmes.getPlcParameter(address).getAddress(),bytes);
        //S7control.getinstance().WriteByte(address, bytes);// 派发出片id
    }
@@ -150,8 +156,9 @@
    }
    //下发理片任务
    public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC) {
        outmesid(glassid, "MESID1");//下发玻璃id
    public void Mestast(String glassid,int MESToPLCStart1,int MESToPLCTarget1,int MESToPLC,String address) {
        //outmesid(glassid, "MESID1");//下发玻璃id
        S7control.getinstance().writeString(plcmes.getPlcParameter(address).getAddress(),glassid);
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart1").getAddress(), (short) MESToPLCStart1);//起始位置
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget1").getAddress(), (short) MESToPLCTarget1);//目标位置
        if(MESToPLC!=0){
springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java
@@ -5,11 +5,13 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.example.springboot.common.Result;
import com.example.springboot.component.PLCAutoMes;
import com.example.springboot.component.Plchome;
import com.example.springboot.component.S7control;
import com.example.springboot.entity.FlowCard;
@@ -17,7 +19,10 @@
import com.example.springboot.entity.Queue;
import com.example.springboot.entity.StorageCage;
import com.example.springboot.entity.StorageTask;
import com.example.springboot.entity.device.PlcParameterObject;
import com.example.springboot.mapper.HomeMapper;
import com.example.springboot.mapper.QueueMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
@Service
public class StorageCageService {
@@ -26,6 +31,9 @@
    @Autowired
    private OutSliceServive outSliceServive;
    @Autowired
    private QueueMapper QueueMapper;
    @Autowired
    private SpianService spianService;
@@ -236,83 +244,176 @@
        return storageTasks;
    }
    //手动完成任务
    // 手动完成任务
    public Result FinishTask(Integer id) {
        StorageTask storageTask = homeMapper.SelectStorageTaskById(id);//获取任务信息
        homeMapper.FinishTask(storageTask.getId());//完成任务
        if(storageTask.getTaskType().equals("0")){
            UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()),1);//玻璃数量+1
        }else{
        StorageTask storageTask = homeMapper.SelectStorageTaskById(id);// 获取任务信息
        homeMapper.FinishTask(storageTask.getId());// 完成任务
        if (storageTask.getTaskType().equals("0")) {
            UpdateStroageCageByCell(Integer.parseInt(storageTask.getLoadrack()), 1);// 玻璃数量+1
        } else {
            StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getShelfRack());
            if(storageCage.getNumber()>1){
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()),-1);//玻璃数量-1
            }else{
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()),0);//清除格内信息
            if (storageCage.getNumber() > 1) {
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), -1);// 玻璃数量-1
            } else {
                UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 清除格内信息
            }
            homeMapper.AddGlassNo(storageTask.getFlowcard(),storageTask.getMateid(),storageTask.geTier());//添加出片完成数量
            homeMapper.AddGlassNo(storageTask.getFlowcard(), storageTask.getMateid(), storageTask.geTier());// 添加出片完成数量
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    //查询玻璃信息
    public Result SelectGlassInfo(String width,String height,String thickness,String films) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width,height,thickness,films);
    // 查询玻璃信息
    public Result SelectGlassInfo(String width, String height, String thickness, String films) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films);
        Map<String, Object> map = new HashMap<>();
        map.put("StorageCageAddInfo", glassInfoList);
        return Result.success(map);
    }
    //添加玻璃到格子内
    public Result StorageCageAddGlass(String cell,GlassInfo glassInfo) {
        homeMapper.StorageCageAddGlass(cell,glassInfo);
        UpdateStroageCageByCell(Integer.parseInt(cell),1);
    // 添加玻璃到格子内
    public Result StorageCageAddGlass(String cell, GlassInfo glassInfo) {
        homeMapper.StorageCageAddGlass(cell, glassInfo);
        UpdateStroageCageByCell(Integer.parseInt(cell), 1);
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    //查询订单任务
    // 查询订单任务
    public List<FlowCard> SelectOrderTask() {
        List<FlowCard> OrderTask=homeMapper.SelectOrderTask();
        for (FlowCard flowcard : OrderTask) {
            flowcard.setglassinfo(homeMapper.SelectOrderView(flowcard.getFlowcard()));
        }
        List<FlowCard> OrderTask = homeMapper.SelectOrderTask();
        // for (FlowCard flowcard : OrderTask) {
        //     flowcard.setglassinfo(homeMapper.SelectOrderView(flowcard.getFlowcard()));
        // }
        return OrderTask;
    }
    //开始任务
    // 开始任务
    public Result ClaimTasks(String flowcard, Integer state) {
        if(state==1){
            homeMapper.ClaimTasks(flowcard,0);
        }else{
            homeMapper.ClaimTasks(flowcard,1);
        if (state == 1) {
            homeMapper.ClaimTasks(flowcard, 0);
        } else {
            homeMapper.ClaimTasks(flowcard, 1);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    //任务模式修改
    // 任务模式修改
    public Result ModeChange(String flowcard, Integer method) {
        if(method==1){
            homeMapper.ModeChange(flowcard,0);
        }else{
            homeMapper.ModeChange(flowcard,1);
        if (method == 1) {
            homeMapper.ModeChange(flowcard, 0);
        } else {
            homeMapper.ModeChange(flowcard, 1);
        }
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    //修改测量信息
    // 修改测量信息
    public Result UpdateQueue(GlassInfo glassInfo) {
        homeMapper.UpdateQueue(glassInfo.getFlowcard(),glassInfo.getWidth(),glassInfo.getHeight(),glassInfo.getGlasstype());
        homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(),
                glassInfo.getGlasstype());
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    public List<StorageCage> SelectStorageCageByCage(int cage) {
        return homeMapper.SelectStorageCageByCage(cage);
    }
    // 人工拿走
    public Result ManualTake(String glassInfo) {
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 移除
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 3);
        //删除数据
        QueueMapper.DeleteErrorQueue();
        // plcmes.getPlcParameter("GaToMES").setValue("3");
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    // 重新测量
    public Result AnewMeasure(String glassInfo) {
        // 读取DB105区文件
        PlcParameterObject plcmes = PLCAutoMes.PlcMesObject;
        // 重新测量
        S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(),(short) 2);
        //删除数据
        QueueMapper.DeleteErrorQueue();
        // plcmes.getPlcParameter("GaToMES").setValue("2");
        Map<String, Object> map = new HashMap<>();
        map.put("message", "200");
        return Result.success(map);
    }
    // 添加小片信息
    public Result AddGlassinfo(List<Map> IportDataStr) {
        // 筛选处理数据 1.去除无用数据 2.计算配片ID 3.计算ID 4. 计算总层数
        List<Map> TypeDatas = homeMapper.SelectType();
        Map<String, String> TypeData = new HashMap<String, String>();// 得到处理完后所有的类型
        Map<String, Integer> groupby=new HashMap<String, Integer>(); // 得到处理完后所有总层数;
        List<Map> RemoveErrorData = IportDataStr.stream()
                .filter(item -> (item.get("order") != null && item.get("glasstype") != null && item.get("tier") != null
                        &&
                        item.get("films") != null && item.get("base") != null && item.get("height") != null
                        && item.get("thickness") != null && item.get("quantity") != null&& item.get("matching") != null))
                .collect(Collectors.toList());
        TypeDatas.forEach(item -> {
            TypeData.put(item.get("type").toString(), item.get("glasstype").toString());
        });
        RemoveErrorData.forEach(item -> {
            String key=item.get("order").toString()+"_"+item.get("matching").toString();
            if (groupby.get(key)!=null) {
                Integer Tiers=groupby.get(key)+1;
                groupby.put(key, Tiers);
            }else{
                groupby.put(key, 1);
            }
        });
        System.out.println(RemoveErrorData.size());
        // 处理完成 添加数据库
        for (Map map : RemoveErrorData) {
            String key = map.get("base").toString() + "_" + map.get("height").toString() + "_"
                       + map.get("thickness").toString() + "_" + map.get("films").toString();
            String tierkey = map.get("order").toString() + "_" + map.get("matching").toString();
            String value = TypeData.get(key);
            Integer glasstype;
            if (TypeData.get(key) == null) {
                glasstype = homeMapper.SelectMaxType();
            } else {
                glasstype = Integer.valueOf(value);
            }
            homeMapper.AddGlassinfo(map.get("order").toString(), glasstype,
                    Integer.parseInt(map.get("glasstype").toString()) // 需要计算 配片ID
                    , glasstype+"" // 需要计算 玻璃ID
                    , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(),
                    Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()),
                    Double.parseDouble(map.get("thickness").toString()),
                    Integer.parseInt(map.get("quantity").toString()),groupby.get(tierkey));// 需要计算总层数
        }
        Map<String, Object> ResultCode = new HashMap<>();
        ResultCode.put("message", "200");
        return Result.success(ResultCode);
    }
}
springboot-vue3/src/main/resources/application.properties
@@ -6,7 +6,7 @@
#\u6570\u636E\u5E93\u9A71\u52A8
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#\u6570\u636E\u5E93\u8FDE\u63A5\u5730\u5740
spring.datasource.url=jdbc:mysql://10.153.19.150:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
spring.datasource.url=jdbc:mysql://localhost:3306/albania?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
#\u6570\u636E\u5E93\u7528\u6237\u540D
spring.datasource.username=root
#\u6570\u636E\u5E93\u7528\u6237\u5BC6\u7801