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个文件已删除
929 ■■■■■ 已修改文件
.vscode/settings.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/api/home.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Albania_Mes-ui/src/views/home/index.vue 149 ●●●● 补丁 | 查看 | 原始文档 | 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 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 45 ●●●● 补丁 | 查看 | 原始文档 | 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 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/HomeController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | 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 41 ●●●● 补丁 | 查看 | 原始文档 | 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 111 ●●●●● 补丁 | 查看 | 原始文档 | 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
@@ -351,3 +351,30 @@
        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,6 +235,7 @@
    height: 15px;
    position: absolute;
}
/*
*/
@@ -304,13 +303,22 @@
  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" />
@@ -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) {
            // 获取到文件夹
@@ -1022,12 +1097,16 @@
        Add() {
            
        },
        Hide() {
        importData() {
            
        },
        AllAdd() {
            //添加数据进后台
            console.log(this.dataList);
            //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() {
            
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
@@ -26,11 +34,9 @@
        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;
      
@@ -43,21 +49,22 @@
  
      
      //一号线请求
      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());
      }
@@ -68,17 +75,16 @@
        
        //完成确认字
        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);
@@ -117,8 +117,15 @@
                PlcParameterObject plcmes=PLCAutoMes.PlcMesObject;
      
                //String PlcRequest=plcmes.getPlcParameter("GaToMES").getValue();//请求
                //double width=plcmes.getPlcParameter("Height").getValue();//宽
                //double height=plcmes.getPlcParameter("width").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,14 +138,26 @@
                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();
@@ -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,6 +470,9 @@
        }
        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,10 +16,9 @@
        // TODO Auto-generated method stub
        //
        System.out.println("启动完成");
        //new PLCAutoMes().start();
        new PLCAutoMes().start();
        //  new PlcHold().start();
          new PlcHoldNew().start();
        //  new Plchome().start();
        //  new PlcLayout().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;
@@ -488,4 +494,19 @@
   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}")
@@ -152,15 +154,14 @@
  @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查询对应玻璃信息
  @Select("select * from north_glass_buffer1 where FrameBarcode=#{FrameBarcode}")
  List<north_glass_buffer1> SelectAluminumFrameInfoById(String FrameBarcode);
  //根据玻璃id查询出片队列信息
  @Select("select * from out_slice where glassid=#{getbarcode}")
@@ -168,7 +169,9 @@
  //添加出片队列
  @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}")
@@ -177,6 +180,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 or permission_id=39)")
  List<RolePermission> SelectPermissionByUserName(String username);
@@ -228,7 +232,6 @@
  //获取铝框有没有正在出片的玻璃
  @Select("select count(*) from out_slice where barcode=#{frameNo} and state=1")
  Short SelectOutingQueueCount(String frameNo);
  //查询理片笼内信息
  @Select("select * from storage_cage")
@@ -283,8 +286,30 @@
  @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);
  @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;
@@ -256,7 +264,6 @@
        return Result.success(map);
    }
    //查询玻璃信息
    public Result SelectGlassInfo(String width,String height,String thickness,String films) {
        List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width,height,thickness,films);
@@ -277,9 +284,9 @@
    //查询订单任务
    public List<FlowCard> SelectOrderTask() {
        List<FlowCard> OrderTask=homeMapper.SelectOrderTask();
        for (FlowCard flowcard : OrderTask) {
            flowcard.setglassinfo(homeMapper.SelectOrderView(flowcard.getFlowcard()));
        }
        // for (FlowCard flowcard : OrderTask) {
        //     flowcard.setglassinfo(homeMapper.SelectOrderView(flowcard.getFlowcard()));
        // }
        return OrderTask;
    }
@@ -309,10 +316,104 @@
    //修改测量信息
    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