wu
2024-01-24 12ae82141c1d6ed1a55922aae128ccfefb5b35dd
Merge branch 'master' of http://10.153.19.25:10101/r/CanadaMes

# Conflicts:
# springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java
# springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
# springboot-vue3/src/main/java/com/example/springboot/config/AppRunnerConfig.java
30个文件已修改
2个文件已添加
1557 ■■■■ 已修改文件
Alarm.json 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/AutomaticParameterSetting.json 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/configuration/InteractionState.json 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Action.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/InteractionState.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Parameter1.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Parameter2.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Positioning1.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/ServoManualone.vue 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Servomanual.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Sign.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/State.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/alarm.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/home/index.vue 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/InitUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/component/S7controlLK.java 456 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/resources/JsonFile/PlcParameter.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/resources/JsonFile/PlcSign.json 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/resources/JsonFile/PlcState.json 272 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/resources/config.properties 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Alarm.json
@@ -497,11 +497,132 @@
      "type": "3",
      "page": "1"
    }
    ,{
      "name": "B02.SR right in pos error",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 servo turn  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 servo turn  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 servo travel  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 servo travel  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "B01 servo travel  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "B02 servo travel  homed",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "resetDelay",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 travel Negative limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 travel Positive limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 turn up limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A01 turn down limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 travel Negative limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 travel Positive limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 turn up limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    } ,{
      "name": "A02 turn down limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    },{
      "name": "B01 travel Negative limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    },{
      "name": "B01 travel Positive limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    },{
      "name": "B02 travel Negative limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    },{
      "name": "B02 travel Positive limit",
      "value": "1",
      "state": "1",
      "type": "3",
      "page": "1"
    }
  ],
  "address": [
    {
      "name": "DB104.0.0",
      "count": 71
      "count": 91
    }
  ]
}
CanadaMes-ui/src/configuration/AutomaticParameterSetting.json
@@ -140,17 +140,7 @@
          
        }
      },
  {
    "name": "最高速度",
    "read": 33,
    "sending": 0,
    "type": "0",
    "unit": "m/min",
    "count":3,
    "value":0,
    "min": 0,
    "max": 60
  },
  {
    "name": "高速线速度",
    "read": 11,
@@ -192,17 +182,7 @@
        
      }
    },
{
  "name": "最高速度",
  "read": 33,
  "sending": 0,
  "type": "0",
  "unit": "m/min",
  "count":3,
  "value":0,
  "min": 0,
  "max": 60
},
{
  "name": "高速线速度",
  "read": 11,
@@ -242,17 +222,7 @@
      
    }
  },
{
"name": "最高速度",
"read": 33,
"sending": 0,
"type": "0",
"unit": "m/min",
"count":3,
"value":0,
"min": 0,
"max": 60
},
{
"name": "高速线速度",
"read": 11,
CanadaMes-ui/src/configuration/InteractionState.json
@@ -280,6 +280,16 @@
            "value":"",
            "min":0,
        "max":9999
          },
          {
            "name": "出片车请求",
            "read": 22,
            "sending": 0,
            "unit": "mm",
            "type": "0",
            "value":"",
            "min":0,
        "max":9999
          }
     
      
CanadaMes-ui/src/views/Electrical/Action.vue
@@ -4,8 +4,8 @@
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/ServoManualone" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
CanadaMes-ui/src/views/Electrical/AutomaticParameterSetting.vue
@@ -3,8 +3,8 @@
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
CanadaMes-ui/src/views/Electrical/InteractionState.vue
@@ -8,13 +8,13 @@
        active-class="blue-button"
        >{{ $t("Alarm") }}</router-link
      >
      <router-link
      <!-- <router-link
        to="/Electrical/State"
        tag="el-button"
        type="text"
        active-class="blue-button"
        >{{ $t("State") }}</router-link
      >
      > -->
      <!-- <router-link
        to="/Electrical/Action"
        tag="el-button"
CanadaMes-ui/src/views/Electrical/ManualonePosition.vue
@@ -3,8 +3,8 @@
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
@@ -641,18 +641,49 @@
              }
              for (let i = 0; i < jsonData2.length; i++) {
                let arr4 = jsonData2[i];
                for (let j = 0; j < arr4.length; j++) {
                  let obj4 = arr4[j];
                  if (obj4.button && (obj4.button.name.includes("启动") || obj4.button.name.includes("Start"))) {
                    obj4.button.value = obj.qidong[0][i];
                    // console.log(obj2.button.value)
                  }
                }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("启动") || obj4.button.name.includes("Start"))) {
              //       obj4.button.value = obj.qidong[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              }
              // }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("复位") || obj4.button.name.includes("Reast"))) {
              //       obj4.button.value = obj.fuwei[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              // }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("回零") || obj4.button.name.includes("Home"))) {
              //       obj4.button.value = obj.huiling[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              // }
              for (let i = 2; i < jsonData2.length; i++) {
                let arr2 = jsonData2[i];
                for (let j = 2; j < arr2.length; j++) {
CanadaMes-ui/src/views/Electrical/ManualonePosition2.vue
@@ -476,18 +476,62 @@
              }
              //启动
              for (let i = 0; i < jsonData2.length; i++) {
                let arr4 = jsonData2[i];
                for (let j = 0; j < arr4.length; j++) {
                  let obj4 = arr4[j];
                  if (obj4.button && (obj4.button.name.includes("启动") || obj4.button.name.includes("Start"))) {
                    obj4.button.value = obj.qidong[0][i];
                    // console.log(obj2.button.value)
                  }
                }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("启动") || obj4.button.name.includes("Start"))) {
              //       obj4.button.value = obj.qidong[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              }
              // }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("启动") || obj4.button.name.includes("Start"))) {
              //       obj4.button.value = obj.qidong[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              // }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("复位") || obj4.button.name.includes("Reast"))) {
              //       obj4.button.value = obj.fuwei[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              // }
              // for (let i = 0; i < jsonData2.length; i++) {
              //   let arr4 = jsonData2[i];
              //   for (let j = 0; j < arr4.length; j++) {
              //     let obj4 = arr4[j];
              //     if (obj4.button && (obj4.button.name.includes("回零") || obj4.button.name.includes("Home"))) {
              //       obj4.button.value = obj.huiling[0][i];
              //       // console.log(obj2.button.value)
              //     }
              //   }
              // }
              //改变未回零文字
for (let i = 0; i < jsonData2.length; i++) {
CanadaMes-ui/src/views/Electrical/Parameter1.vue
@@ -78,6 +78,9 @@
import LanguageMixin from '../../lang/LanguageMixin'
import data from '../../configuration/parameter1'
import { throttle } from 'lodash';
// import {
// SelectPermissionByUserName, currentUsername
// } from "../../api/home";
let socket;
export default {
  name: "Parameter1",
CanadaMes-ui/src/views/Electrical/Parameter2.vue
@@ -8,13 +8,13 @@
        active-class="blue-button"
        >{{ $t("Alarm") }}</router-link
      >
      <router-link
      <!-- <router-link
        to="/Electrical/State"
        tag="el-button"
        type="text"
        active-class="blue-button"
        >{{ $t("State") }}</router-link
      >
      > -->
      <!-- <router-link
        to="/Electrical/Action"
        tag="el-button"
CanadaMes-ui/src/views/Electrical/Positioning1.vue
@@ -8,13 +8,13 @@
        active-class="blue-button"
        >{{ $t("Alarm") }}</router-link
      >
      <router-link
      <!-- <router-link
        to="/Electrical/State"
        tag="el-button"
        type="text"
        active-class="blue-button"
        >{{ $t("State") }}</router-link
      >
      > -->
      <!-- <router-link
        to="/Electrical/Action"
        tag="el-button"
CanadaMes-ui/src/views/Electrical/ServoManualone.vue
@@ -8,13 +8,13 @@
        active-class="blue-button"
        >{{ $t("Alarm") }}</router-link
      >
      <router-link
      <!-- <router-link
        to="/Electrical/State"
        tag="el-button"
        type="text"
        active-class="blue-button"
        >{{ $t("State") }}</router-link
      >
      > -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
        }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
@@ -787,34 +787,34 @@
            }
            // 复位更新
            for (let i = 0; i < jsonData2.length; i++) {
              let arr = jsonData2[i];
              for (let j = 0; j < arr.length; j++) {
                let obj2 = arr[j];
                if (
                  obj2.button &&
                  (obj2.button.name === "复位" || obj2.button.name === "Reset")
                ) {
                  obj2.button.value = obj.fuwei[0][i];
                  //  console.log(obj2.button.value)
                }
              }
            }
            // for (let i = 0; i < jsonData2.length; i++) {
            //   let arr = jsonData2[i];
            //   for (let j = 0; j < arr.length; j++) {
            //     let obj2 = arr[j];
            //     if (
            //       obj2.button &&
            //       (obj2.button.name === "复位" || obj2.button.name === "Reset")
            //     ) {
            //       obj2.button.value = obj.fuwei[0][i];
            //       //  console.log(obj2.button.value)
            //     }
            //   }
            // }
            for (let i = 0; i < jsonData2.length; i++) {
              let arr = jsonData2[i];
              for (let j = 0; j < arr.length; j++) {
                let obj2 = arr[j];
                if (
                  obj2.button &&
                  (obj2.button.name === "回零" || obj2.button.name === "Home")
                ) {
                  obj2.button.value = obj.huiling[0][i];
                  //  console.log(obj2.button.value)
                }
              }
            }
            // for (let i = 0; i < jsonData2.length; i++) {
            //   let arr = jsonData2[i];
            //   for (let j = 0; j < arr.length; j++) {
            //     let obj2 = arr[j];
            //     if (
            //       obj2.button &&
            //       (obj2.button.name === "回零" || obj2.button.name === "Home")
            //     ) {
            //       obj2.button.value = obj.huiling[0][i];
            //       //  console.log(obj2.button.value)
            //     }
            //   }
            // }
            
CanadaMes-ui/src/views/Electrical/Servomanual.vue
@@ -3,8 +3,8 @@
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
CanadaMes-ui/src/views/Electrical/Sign.vue
@@ -5,8 +5,8 @@
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
CanadaMes-ui/src/views/Electrical/State.vue
@@ -5,8 +5,8 @@
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm')
      }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action')
      }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter')
CanadaMes-ui/src/views/Electrical/alarm.vue
@@ -4,7 +4,7 @@
    <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb">
      <router-link to="/Electrical/alarm" tag="el-button" type="text" active-class="blue-button">{{ $t('Alarm') }}</router-link>
      <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link>
      <!-- <router-link to="/Electrical/State" tag="el-button" type="text" active-class="blue-button">{{ $t('State') }}</router-link> -->
      <!-- <router-link to="/Electrical/Action" tag="el-button" type="text" active-class="blue-button">{{ $t('Action') }}</router-link> -->
      <!-- <router-link to="/Electrical/Parameter" tag="el-button" type="text" active-class="blue-button">{{ $t('Parameter') }}</router-link> -->
    <router-link to="/Electrical/Sign" tag="el-button" type="text" active-class="blue-button">{{ $t('Sign') }}</router-link>
CanadaMes-ui/src/views/home/index.vue
@@ -1011,7 +1011,7 @@
            reset: false,
            isQueueWarning: false,
            CurrentFrame: [],
            DeviceList: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            DeviceList: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
            GlassIdList: [],
            Scanningmethod: true,
            CurrrentGlassId: ""
@@ -1045,12 +1045,14 @@
                    //console.log("收到数据====" + msg.data);
                    let obj = JSON.parse(msg.data);
                    if (obj.params != null) {
                        this.car1 = 145 + 8.15 * Math.abs(obj.params[0][0] - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
                        this.car2 = 210 + 8.15 * Math.abs(obj.params[0][1] - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
                        var zhi1=obj.params[0][0];
                        var zhi2=obj.params[0][1];
                        this.car1 = 145 + 8.15 * Math.abs(zhi1 - this.carlist[0]['start']) / Math.abs(this.carlist[0]['end'] - this.carlist[0]['start']) * 100;
                        this.car2 = 210 + 8.15 * Math.abs(zhi2 - this.carlist[1]['start']) / Math.abs(this.carlist[1]['end'] - this.carlist[1]['start']) * 100;
                        // 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;
                    }
                    this.tableData = obj.tableData[0];
                    this.cagelist1 = obj.cagelist1[0];
                    this.cagelist2 = obj.cagelist2[0];
@@ -1072,10 +1074,11 @@
                    //查询当前铝框信息
                    this.CurrentFrame = obj.CurrentFrame;
                    //获取设备状态
                    if (obj.DeviceList != null) {
                        this.DeviceList = obj.DeviceList[0];
                    }
                    // if (obj.DeviceList != null) {
                    //     this.DeviceList = obj.DeviceList[0];
                    // }
                    //获取设备上的玻璃id
                    if (obj.GlassIdList != null) {
                        this.GlassIdList = obj.GlassIdList[0];
springboot-vue3/src/main/java/com/example/springboot/component/ExcelToJsonConverter.java
@@ -12,9 +12,11 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
public class ExcelToJsonConverter {
    public static void main(String[] args) {
        String excelFilePath = "JsonFile/state.xlsx";
        String sheetName = "Sheet1";
@@ -27,13 +29,15 @@
        try (Workbook workbook = new HSSFWorkbook(new FileInputStream(excelFilePath))) {
            Sheet sheet = workbook.getSheet(sheetName);
            List<JSONObject> jsonList = new ArrayList<>();
            List<LinkedHashMap<String, Object>> jsonList = new ArrayList<>();
            Iterator<Row> rowIterator = sheet.iterator();
            // Skip the header row
            if (rowIterator.hasNext()) {
                rowIterator.next();
            }
            int plcAddressLength = 0; // 记录所有 addressLenght 的和
            while (rowIterator.hasNext()) {
                Row row = rowIterator.next();
@@ -48,17 +52,33 @@
                String addressIndex = extractAddressIndex(address);
                JSONObject jsonObject = new JSONObject();
                LinkedHashMap<String, Object> jsonObject = new LinkedHashMap<>();
                jsonObject.put("codeId", name);
                jsonObject.put("addressIndex", addressIndex);
                int addressLength = 0;
                if (address.contains("~")) {
                    addressLength = 14;
                } else {
                    addressLength = 2;
                }
                jsonObject.put("addressLenght", String.valueOf(addressLength));
                jsonObject.put("unit", unit);
                plcAddressLength += addressLength;
                jsonList.add(jsonObject);
            }
            LinkedHashMap<String, Object> resultObject = new LinkedHashMap<>();
            resultObject.put("plcAddressBegin", "DB100.0");
            resultObject.put("plcAddressLenght", String.valueOf(plcAddressLength));
            resultObject.put("dataType", "word");
            resultObject.put("parameteInfor", jsonList);
            Gson gson = new Gson();
            String jsonOutput = gson.toJson(jsonList);
            String jsonOutput = gson.toJson(resultObject);
            try (FileWriter fileWriter = new FileWriter(outputFilePath)) {
                fileWriter.write(jsonOutput);
@@ -81,6 +101,4 @@
        }
        return "";
    }
}
}
springboot-vue3/src/main/java/com/example/springboot/component/InitUtil.java
@@ -41,7 +41,7 @@
                String codeid = parameterObj.getStr("codeId");
                plcParameterInfo.setCodeId(codeid);
                plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex")));
                plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio")));
                //plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio")));
                plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght")));
                plcParameterInfo.setUnit(parameterObj.getStr("unit"));
                plcParameterObject.addPlcParameter(plcParameterInfo);
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview.java
@@ -26,9 +26,9 @@
        this.storageCageService = storageCageService;
        this.plcParameterObject = new PlcParameterObject();
        this.plcBitObject = new PlcBitObject();
        // String jsonFilePath = "JsonFile/PlcParameter.json";
        // String jsonFilePath = "/JsonFile/PlcParameter.json";
        // InitUtil.initword(jsonFilePath); // 初始化 PlcParameterObject
        // String jsonFilePath2 = "JsonFile/PlcSign.json";
        // String jsonFilePath2 = "/JsonFile/PlcSign.json";
        // InitUtil.initbit(jsonFilePath2); // 初始化 PlcSign
@@ -49,18 +49,22 @@
                e.printStackTrace();
            }
            byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
            //byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
            plcParameterObject.setPlcParameterList(getplcvlues);
            List<String> addresses = new ArrayList<>();
            addresses.add("A01turnAngle1");
            addresses.add("A01turnAngle2");
            addresses.add("A01turnAngle3");
            addresses.add("A01turnAngle4");
            addresses.add("A02turnAngle2");
            addresses.add("A02turnAngle3");
            addresses.add("A02turnAngle4");
            addresses.add("Minimumglasslength");
//            List<String> addresses = new ArrayList<>();
//            addresses.add("A01turnAngle1");
//            addresses.add("A01turnAngle2");
//            addresses.add("A01turnAngle3");
//            addresses.add("A01turnAngle4");
//            addresses.add("A02turnAngle2");
//            addresses.add("A02turnAngle3");
//            addresses.add("A02turnAngle4");
//            addresses.add("Minimumglasslength");
            //Auto.addresses=DB100.0,DB100.2,DB100.4,DB100.6,DB100.26,DB100.28,DB100.30,DB100.32,DB100.34,DB100.36,DB100.38,DB100.40
@@ -73,7 +77,6 @@
            Autoaddresses.add("A01A02conveyorVelocity(AutoFAST)");
            Autoaddresses.add("A01A02conveyorVelocity(AutoSLOW)");
            Autoaddresses.add("B01B02conveyorVelocity(Manual)");
            Autoaddresses.add("B01B02conveyorVelocity(Max)");
            Autoaddresses.add("B01B02conveyorVelocity(AutoFAST)");
            Autoaddresses.add("B01B02conveyorVelocity(AutoSLOW)");
@@ -109,13 +112,13 @@
            // new short[]{1,1, 1, 1, 1, 1, 2, 33, 2,3, 4, 5}
            // new short[]{0,0, 0, 0, 0, 0, 0, 0, 0, 0}
//System.out.println(plcParameterObject.getPlcParameterValues(addresses));
            jsonObject.append("params",  plcParameterObject.getPlcParameterValues(addresses));
            jsonObject.append("dache1", plcParameterObject.getPlcParameter("A01A02TRAVELPOSVelocityAUTO").getValue());
            jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("B01B02TRAVELPOSVelocityAUTO").getValue());
            jsonObject.append("fanzhuan", plcParameterObject.getPlcParameter("A01A02TURNPOSVelocityAUTO").getValue());
            jsonObject.append("params2", plcParameterObject.getPlcParameterValues(Autoaddresses));
            jsonObject.append("fanzhuan2", plcParameterObject.getPlcParameter("A01A02TURNJOGVelocity").getValue());
            jsonObject.append("xiaoche2",  plcParameterObject.getPlcParameter("B01B02TRAVELJOGVelocity").getValue());
          //  jsonObject.append("params",  plcParameterObject.getPlcParameterValues(addresses));
//            jsonObject.append("dache1", plcParameterObject.getPlcParameter("A01A02TRAVELPOSVelocityAUTO").getValue());
//            jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("B01B02TRAVELPOSVelocityAUTO").getValue());
//            jsonObject.append("fanzhuan", plcParameterObject.getPlcParameter("A01A02TURNPOSVelocityAUTO").getValue());
//            jsonObject.append("params2", plcParameterObject.getPlcParameterValues(Autoaddresses));
//            jsonObject.append("fanzhuan2", plcParameterObject.getPlcParameter("A01A02TURNJOGVelocity").getValue());
//            jsonObject.append("xiaoche2",  plcParameterObject.getPlcParameter("B01B02TRAVELJOGVelocity").getValue());
            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("AutomaticParameterSetting");
//            if (sendwServer != null) {
springboot-vue3/src/main/java/com/example/springboot/component/PLCAutomaticParameterSettingReview2.java
@@ -45,48 +45,49 @@
                e.printStackTrace();
            }
            String jsonFilePath = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcMes.json").getPath();
            // String jsonFilePath2 =
            // PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json")
            // .getPath();
            // String jsonFilePath4 =
            // PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json")
            // .getPath();
            // System.out.println(jsonFilePath4);
            String jsonFilePath = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcParameter.json").getPath();
            String jsonFilePath2 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json").getPath();
            String jsonFilePath4 = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json").getPath();
           //System.out.println(jsonFilePath4);
            // 调用initword方法
            PlcParameterObject plcParameterObject = initUtil.initword(jsonFilePath);
            // PlcParameterObject plcStateObject = initUtil.initword(jsonFilePath4);
          PlcParameterObject plcParameterObject = initUtil.initword(jsonFilePath);
            PlcParameterObject plcStateObject = initUtil.initword(jsonFilePath4);
            // 调用initbit方法
            // PlcBitObject plcBitObject = initUtil.initbit(jsonFilePath2);
            // readAndUpdateBitValues(plcBitObject);
            readAndUpdateWordValues(plcParameterObject);
            // readAndUpdateWordValues(plcStateObject);
            int index = plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddressIndex();
            System.out.println(index);
            plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index);
            System.out.println(plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index));
            // S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index),
            // (short) 100);
            List<String> addresses = new ArrayList<>();
            addresses.add("conveyorVelocity(AutoFAST)");
            addresses.add("A02ID");
            System.out.println(plcParameterObject.getPlcParameterValues(addresses));
            PlcBitObject plcBitObject = initUtil.initbit(jsonFilePath2);
            readAndUpdateBitValues(plcBitObject);
          readAndUpdateWordValues(plcParameterObject);
            readAndUpdateWordValues(plcStateObject);
           // int index = plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddressIndex();
         //   System.out.println(index);
           // plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index);
            // System.out.println(plcParameterObject.getPlcParameter("A01A02conveyorVelocity(Max)").getAddress(index));
            // S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index), (short) 100);
     List<String> addresses = new ArrayList<>();
      addresses.add("conveyorVelocity(AutoFAST)");
      addresses.add("A02ID");
System.out.println(plcParameterObject.getPlcParameterValues(addresses));
            List<String> addresses2 = new ArrayList<>();
            addresses2.add("conveyorVelocity(AutoSLOW)");
            addresses2.add("D01.SRdec");
            // System.out.println(plcBitObject.getPlcBitValues(addresses2));
            // int index2 = plcBitObject.getPlcBit("DO1id").getAddressIndex();
            // System.out.println(index2);
            // plcBitObject.getPlcBit("DO1id").getAddress(index2);
            // System.out.println(plcBitObject.getPlcBit("DO1id").getAddress(index2));
            System.out.println(plcBitObject.getPlcBitValues(addresses2));
            int index2 = plcBitObject.getPlcBit("DO1id").getAddressIndex();
            System.out.println(index2);
            plcBitObject.getPlcBit("DO1id").getAddress(index2);
            System.out.println(plcBitObject.getPlcBit("DO1id").getAddress(index2));
            List<String> addresses3 = new ArrayList<>();
            addresses3.add("A02ID1");
            addresses3.add("A01CurrentGrid");
            System.out.println(plcStateObject.getPlcParameterValues(addresses3));
        }
    }
}
springboot-vue3/src/main/java/com/example/springboot/component/PlcParameter1Review.java
@@ -93,20 +93,26 @@
      } catch (InterruptedException e) {
        e.printStackTrace();
      }
     // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
     byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
      byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
      //byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
      plcParameterObject.setPlcParameterList(getplcvlues);
    //  int index = plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddressIndex();
     int index = plcParameterObject.getPlcParameter("A01ID").getAddressIndex();
      System.out.println(index);
      plcParameterObject.getPlcParameter("A01ID").getAddress(index);
      System.out.println(plcParameterObject.getPlcParameter("A01ID").getAddress(index));
     // S7control.getinstance().WriteWord(plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getAddress(index), (short) 100);
      List<String> addresses = new ArrayList<>();
      addresses.add("A01A02TURNPOSVelocityAUTO");
//      addresses.add("conveyorVelocity(AutoSLOW)");
//      addresses.add("conveyorVelocity(Manual)");
      addresses.add("conveyorVelocity(AutoFAST)");
      addresses.add("A01ID");
     //addresses.add("conveyorVelocity(AutoSLOW)");
//      addresses.add("A01A02TURNJOGVelocity");
//      addresses.add("A01A02TRAVELJOGVelocity");
//     addresses.add("A01A02TRAVELJOGVelocity");
      System.out.println(plcParameterObject.getPlcParameterValues(addresses));
@@ -116,7 +122,8 @@
      jsonObject.append("params", plcParameterObject.getPlcParameterValues(addresses));
      jsonObject.append("fanzhuan", plcParameterObject.getPlcParameter("conveyorVelocity(AutoFAST)").getValue());
      jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("").getValue());
     // jsonObject.append("xiaoche", plcParameterObject.getPlcParameter("").getValue());
      ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("Parameter1");
      if (sendwServer != null) {
@@ -125,6 +132,7 @@
          webserver.sendMessage(jsonObject.toString());
          if (webserver != null) {
            List<String> messages = webserver.getMessages();
springboot-vue3/src/main/java/com/example/springboot/component/Plcalarm.java
@@ -82,12 +82,12 @@
        e.printStackTrace();
      }
//      this.readValue();
//      String PlcAddress = this.name;
//      Integer Plccount = this.count;
      this.readValue();
      String PlcAddress = this.name;
      Integer Plccount = this.count;
      // 根据地址读取PCL数据
      List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", 71);
      List<Boolean> plclist = S7control.getinstance().ReadBits("DB104.0.0", Plccount);
//      List<Boolean> plclist = S7control.getinstance().ReadBits(PlcAddress, Plccount);
      // System.out.println(plclist);
      // Boolean[] values = { false, false, true, false, true, false, true, false,
@@ -117,7 +117,8 @@
            }
            // 将Intlist转换为数组
            // System.out.println(Intlist);
//             System.out.println(Intlist);
//     System.out.println(Intlist.toArray().length);
            Integer[] shuzu1 = Intlist.toArray(new Integer[0]);
            // 定义的报警内容数组,获取json返回的集合
springboot-vue3/src/main/java/com/example/springboot/component/Plchome.java
@@ -54,21 +54,19 @@
    @Override
    public void run() {
        while (this != null) {
            JSONObject jsonObject = new JSONObject();
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            JSONObject jsonObject = new JSONObject();
            // 注入mapper
                // 注入mapper
            homeMapper = WebSocketServer.applicationContext.getBean(HomeMapper.class);
            spianMapper = WebSocketServer.applicationContext.getBean(SpianMapper.class);
            spianService = WebSocketServer.applicationContext.getBean(SpianService.class);
            outSliceServive = WebSocketServer.applicationContext.getBean(OutSliceServive.class);
            north_Glass_Buffer1Service = WebSocketServer.applicationContext.getBean(North_Glass_Buffer1Service.class);
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
            // 笼子使用情况
            List<StorageCage> tableData = homeMapper.selectAll();
            jsonObject.append("tableData", tableData);
@@ -119,41 +117,46 @@
            Out_slice CurrentFrame = outSliceServive.SelectCurrentFrame();
            jsonObject.append("CurrentFrame", CurrentFrame);
            // List<Short> listd17 = S7control.getinstance().ReadWord("DB17.0",10);
            // String id=spianService.queGlassid("DB17.10", 14).toString();
            //
            // String E01id = new String( S7controlLK.getinstance().ReadByte("DB17.0",16));
            // String J01id = new String( S7controlLK.getinstance().ReadByte("DB17.22",14));
            // 铝框线交互
            // try {
            //     if (CurrentFrame != null) {
            //         spianService.outmesid(CurrentFrame.getBarCode(), "DB17.0");
            //     }
            //     List<Short> framerequests = S7control.getinstance().ReadWord("铝框id请求字地址", 1);
            //     for (Short framerequest : framerequests) {
            //         if (framerequest == 1) {
            //             // 铝框id
            //             String franmeno = spianService.queGlassid("DB17.10", 14).toString();
            //             String position;
            //             try {
            //                 position = dbserve.SelectPositionByFrameBarcode(franmeno);
            //             } catch (SQLException e) {
            //                 // TODO Auto-generated catch block
            //                 position = "0";
            //                 e.printStackTrace();
            //             }
            //             Short send;
            //             if (position == "0") {
            //                 send = 0;
            //             } else {
            //                 send = 1;
            //             }
            //             S7control.getinstance().WriteWord("铝框翻转发送地址", (short) send);
            //         }
            //     }
            // } catch (Exception e) {
            //     // TODO: handle exception
            // }
            if (CurrentFrame != null) {
                S7controlLK.getinstance().writeStrings(CurrentFrame.getBarCode(),"DB17.0");
            }
            String E01id=S7controlLK.getinstance().readStrings("DB17.0");
            String J01id=S7controlLK.getinstance().readStrings("DB17.22");
            List<Short> liststates=S7controlLK.getinstance().ReadWord("DB17.38", 1);
            List<Short> liststate=S7controlLK.getinstance().ReadWord("DB17.20", 1);
            Short framerequest = liststate.get(0);
                if (framerequest == 1) {
                    // 铝框id
                    String position;
                    try {
                        position = dbserve.SelectPositionByFrameBarcode(J01id);
                    } catch (SQLException e) {
                        // TODO Auto-generated catch block
                        position = "0";
                        e.printStackTrace();
                    }
                    Short send;
                    if (position.equals("0")) {
                        send = 0;
                    } else {
                        send = 1;
                    }
                    S7controlLK.getinstance().WriteWord("DB17.38", (short) send);
                }
            if (S7control.getinstance().CheckConnected() == true) {
                // 获取当前扫码方式
@@ -211,7 +214,6 @@
                    if (inglassInfo.size() > 0) {
                        jsonObject.append("loadglassheight", inglassInfo.get(0) * 70);
                    }
                }
                // // 获取铝框idDB106.DBW64,添加到出片队列
                // String frameno="X21763329601FB";
@@ -268,8 +270,13 @@
                }
            }
            storageCageService = WebSocketServer.applicationContext.getBean(StorageCageService.class);
            dbserve = WebSocketServer.applicationContext.getBean(JdbcConnections.class);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            boolean dbconnected = false;
            try {
                dbserve.getConn();
springboot-vue3/src/main/java/com/example/springboot/component/S7controlLK.java
New file
@@ -0,0 +1,456 @@
package com.example.springboot.component;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.charset.StandardCharsets;
import java.sql.Time;
import java.util.ArrayList;
import java.util.List;
import com.github.xingshuangs.iot.protocol.s7.enums.EPlcType;
import com.github.xingshuangs.iot.protocol.s7.service.MultiAddressWrite;
import com.github.xingshuangs.iot.protocol.s7.service.S7PLC;
import com.google.common.primitives.Bytes;
import org.apache.ibatis.jdbc.Null;
public class S7controlLK {
    S7PLC s7PLC; // PLC通讯类实例
    private EPlcType plcType = EPlcType.S1500; // 西门子PLC类型
    private String ip = "192.168.10.101"; // plc ip地址
    private int port = 102; // plc 端口号
    private static volatile S7controlLK instance = null;
    private S7controlLK() {
        if (s7PLC == null)
            s7PLC = new S7PLC(plcType, ip, port, 0, 0);
    }
    // 单例模式 获取类的唯一实例
    public static S7controlLK getinstance() {
        if (instance == null) {
            synchronized (S7controlLK.class) {
                if (instance == null)
                    instance = new S7controlLK();
            }
        }
        return instance;
    }
    /**
     * 关闭西门子s7通讯连接
     */
    public void CloseS7client() {
        if (s7PLC == null)
            s7PLC.close();
        s7PLC.checkConnected();
    }
    /**
     * s7通讯连接状态
     */
    public boolean CheckConnected() {
        return s7PLC.checkConnected();
    }
    /**
     * 按指定的地址 写入一个word
     *
     * @param address 地址
     * @param data    word的值
     */
    public void WriteWord(String address, short data) {
        if (s7PLC == null) {
            return;
        }
        s7PLC.writeInt16(address, data);
    }
    /**
     * 从某地址连续 写入多个word
     *
     * @param address 地址
     * @param datas   word的值
     */
    public void WriteWord(String address, List<Short> datas) {
        if (s7PLC == null)
            return;
        // s7PLC.write(address, data);
        List<String> addresslist = GetAddressList(address, datas.size(), 16);
        MultiAddressWrite addressWrite = new MultiAddressWrite();
        for (int i = 0; i < datas.size(); i++) {
            addressWrite.addInt16(addresslist.get(i), datas.get(i));
        }
        s7PLC.writeMultiData(addressWrite);
    }
    /**
     * 按指定的地址 写入多个word
     *
     * @param address 地址
     * @param datas   word的值
     */
    /**
     * 按指定的地址 写入一个Bit
     *
     * @param address 地址
     * @param data    Bit的值
     */
    public void WriteBit(String address, Boolean data) {
        if (s7PLC == null)
            return;
        s7PLC.writeBoolean(address, data);
    }
    /**
     * 按指定的地址 写入多个bit
     *
     * @param address 地址
     * @param datas   bit的值
     */
    public void WriteBit(List<String> address, List<Boolean> datas) {
        if (s7PLC == null)
            return;
        // s7PLC.write(address, data);
        MultiAddressWrite addressWrite = new MultiAddressWrite();
        for (int i = 0; i < address.size(); i++) {
            addressWrite.addBoolean(address.get(i), datas.get(i));
        }
        s7PLC.writeMultiData(addressWrite);
    }
    /**
     * 从某地址连续 写入多个bit
     *
     * @param address 地址
     * @param datas   word的值
     */
    public void WriteBit(String address, List<Boolean> datas) {
        if (s7PLC == null)
            return;
        // s7PLC.write(address, data);
        List<String> addresslist = GetAddressList(address, datas.size(), 1);
        MultiAddressWrite addressWrite = new MultiAddressWrite();
        for (int i = 0; i < datas.size(); i++) {
            addressWrite.addBoolean(addresslist.get(i), datas.get(i));
        }
        s7PLC.writeMultiData(addressWrite);
    }
    /**
     * 按指定的地址 写入多个byte
     *
     * @param address 地址
     * @param datas   byte的值
     */
    public void WriteByte(String address, byte[] datas) {
        if (s7PLC == null)
            return;
        // s7PLC.write(address, data);
        s7PLC.writeByte(address, datas);
    }
    /**
     * 按指定的地址 读取word结果集
     *
     * @param address 地址
     * @return 结果
     */
    public List<Short> ReadWord(List<String> address) {
        if (s7PLC == null)
            return null;
        try {
            return s7PLC.readInt16(address);
        } catch (Exception e) {
            System.out.println("读取 " + address + " 失败:" + e.getMessage());
            return null;
        }
    }
    private int getIndexFromAddress(String address) {
        // 可以解析出地址中的数字部分,并转换为整数
        return 0;
    }
    private String getAddressFromIndex(int index) {
        // 整数转换为地址格式的字符串
        return "";
    }
    /**
     * 按指定的地址 读取word结果集
     *
     * @param address 地址
     * @param count   连续读多少个word
     * @return 结果
     */
    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);
        } catch (Exception e) {
            System.out.println("读取 " + address + " 失败:" + e.getMessage());
            return null;
        }
    }
    /**
     * 按指定的地址 读取byte结果集
     *
     * @param address 地址
     * @param count   连续读多少个byte
     * @return 结果
     */
    public byte[] ReadByte(String address, int count) {
        if (s7PLC == null)
            return null;
        // List<String> addresslist = GetAddressList(address, count, 16);
        try {
            return s7PLC.readByte(address, count);
        } catch (Exception e) {
            // 处理异常
            System.out.println("读取 " + address + " 失败:" + e.getMessage());
            return null;
        }
    }
    /**
     * 按指定的地址 按bit位 0 flase 1 true 读取结果
     *
     * @param addresslist 地址集
     * @return Boolean结果
     */
    public List<Boolean> ReadBits(List<String> addresslist) {
        if (s7PLC == null)
            return null;
        return s7PLC.readBoolean(addresslist);
    }
    // 读取不连续地址bit
    public List<Boolean> readBits(List<String> addressList) {
        if (s7PLC == null || addressList.isEmpty()) {
            return null;
        }
        List<Boolean> values = new ArrayList<>();
        for (String address : addressList) {
            try {
                boolean value = s7PLC.readBoolean(address);
                values.add(value);
            } catch (Exception e) {
                // 处理异常
                System.out.println("读取 " + address + " 失败:" + e.getMessage());
            }
        }
        return values;
    }
    // 读取String
    public List<String> readStrings(List<String> addressList) {
        if (s7PLC == null) {
            return null;
        }
        List<String> result = new ArrayList<>();
        for (String address : addressList) {
            try {
                byte[] bytes = s7PLC.readByte(address, 14);
                if (bytes != null) {
                    String str = new String(bytes, StandardCharsets.UTF_8);
                    result.add(str);
                }
            } catch (Exception e) {
                System.out.println("读取 " + address + " 失败:" + e.getMessage());
                result.add(null);
            }
        }
        return result;
    }
    public List<String> readStringsandword(List<String> addressList) {
        if (s7PLC == null) {
            return null;
        }
        List<String> result = new ArrayList<>();
        for (String address : addressList) {
            try {
                if (address.contains("-")) {
                    address = address.substring(0, address.indexOf("-"));
                    byte[] bytes = s7PLC.readByte(address, 14);
                    if (bytes != null) {
                        String str = new String(bytes, StandardCharsets.UTF_8);
                        result.add(str);
                    }
                } else {
                    Short value = s7PLC.readInt16(address);
                    result.add(value.toString());
                }
            } catch (Exception e) {
                System.out.println("读取 " + address + " 失败:" + e.getMessage());
                result.add(null);
            }
        }
        return result;
    }
    // 不连续地址写入Word
    public void WriteWord(List<String> address, List<Short> datas) {
        if (s7PLC == null)
            return;
        for (int i = 0; i < address.size(); i++) {
            String addr = address.get(i);
            short data = datas.get(i);
            if (addr.contains("-")) {
                outmesid(String.valueOf(data), addr); // 单独处理带破折号的地址
            } else {
                s7PLC.writeInt16(addr, data); // 将数据写入单个地址
            }
        }
    }
    // 字符串写入
    public void outmesid(String data, String addr) {
        // System.out.println("outmesid: " + data);
        List<Byte> glassidlist = new ArrayList<>();
        String[] parts = addr.split("-");
        if (parts.length == 2) {
            addr = parts[0]; // 只保留 "-" 前面的部分
        }
        for (char iditem : data.toCharArray()) {
            glassidlist.add(Byte.valueOf(String.valueOf(iditem)));
        }
        byte[] bytes = Bytes.toArray(glassidlist);
        S7controlLK.getinstance().WriteByte(addr, bytes);
    }
    // 读取不连续word
    public List<Short> readWords(List<String> addresses) {
        if (s7PLC == null) {
            return null;
        }
        List<Short> data = new ArrayList<>();
        for (String address : addresses) {
            try {
                // 单个地址
                Short value = s7PLC.readInt16(address);
                data.add(value);
            } catch (Exception e) {
                System.out.println("读取 " + address + " 失败:" + e.getMessage());
            }
        }
        return data;
    }
    // 读取时间
    public Long readtime(String address) {
        if (s7PLC == null)
            return null;
        try {
            return s7PLC.readTime(address);
        } catch (Exception e) {
            System.out.println("读取 " + address + " 失败:" + e.getMessage());
            return null;
        }
    }
    public void writetime(String address, long datas) {
        if (s7PLC == null)
            return;
        s7PLC.writeTime(address, datas); // 将数据写入单个地址
    }
    private int extractAddressNumber(String address) {
        String numberStr = address.replaceAll("\\D+", ""); // 使用正则表达式提取数字部分
        return Integer.parseInt(numberStr);
    }
    /**
     * 从指定的地址开始 连续按bit位读取
     *
     * @param address 地址
     * @param count   长度
     * @return Boolean结果
     */
    public List<Boolean> ReadBits(String address, int count) {
        if (s7PLC == null)
            return null;
        List<String> addresslist = GetAddressList(address, count, 1);
        try {
            return s7PLC.readBoolean(addresslist);
        } catch (Exception e) {
            System.out.println("读取 " + address + " 失败:" + e.getMessage());
            return null;
        }
    };
    private List<String> GetAddressList(String address, int count, int addedbit) {
        List<String> addresslist = new ArrayList<String>();
        String[] stringdatas = address.trim().split("\\.");
        if (stringdatas.length < 2 || !address.startsWith("DB"))
            return null;
        int dbwindex = 0;
        int bitindex = 0;
        if (stringdatas.length == 2) {
            dbwindex = Integer.parseInt(stringdatas[1]);
        } else if (stringdatas.length == 3) {
            dbwindex = Integer.parseInt(stringdatas[1]);
            bitindex = Integer.parseInt(stringdatas[2]);
        } else
            return null;
        addresslist.add(address);
        for (int i = 0; i < count - 1; i++) {
            int bitcurrent = bitindex + addedbit;
            if (bitcurrent > 7) {
                dbwindex += bitcurrent / 8;
                bitindex = 0;
            } else
                bitindex = bitcurrent;
            String endstr = stringdatas.length == 3 ? "." + bitindex : "";
            addresslist.add(stringdatas[0] + "." + dbwindex + endstr);
        }
        return addresslist;
    }
    public void writeStrings(String data, String addr) {
        // List<Byte> glassidlist = new ArrayList<>();
        String[] parts = addr.split("-");
        if (parts.length == 2) {
            addr = parts[0];
        }
        s7PLC.writeString(addr, data);
    }
    public String readStrings(String addr) {
        return s7PLC.readString(addr);
    }
}
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcBitObject.java
@@ -2,7 +2,9 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class PlcBitObject {
@@ -71,16 +73,26 @@
     * @return 获取某个参数实例
     */
    public List<Boolean> getPlcBitValues(List<String> codeids) {
        List<Boolean> arrayList = new ArrayList();
        List<Boolean> arrayList = new ArrayList<>();
        if (plcBitList != null) {
            for (PlcBitInfo plcbitInfo : plcBitList) {
                if (codeids.contains(plcbitInfo.getCodeId().toString()))
                    arrayList.add(plcbitInfo.getValue());
            Map<String, Boolean> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序
            for (PlcBitInfo plcBitInfo : plcBitList) {
                if (codeids.contains(plcBitInfo.getCodeId().toString())) {
                    resultMap.put(plcBitInfo.getCodeId().toString(), plcBitInfo.getValue());
                }
            }
            for (String codeId : codeids) { // 按照传入参数的顺序遍历
                Boolean value = resultMap.get(codeId);
                if (value != null) {
                    arrayList.add(value);
                } else {
                    arrayList.add(null); // 如果找不到对应的值,添加 null
                }
            }
        }
        return arrayList;
    }
    /**
     * 添加参数实例
     * 
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterInfo.java
@@ -101,13 +101,10 @@
        String[] stringdatas = this.startAddress.trim().split("\\.");
        if (stringdatas.length < 2 )
            return null;
        int dbwindex = 0;
        int bitindex = 0;
         if (stringdatas.length == 2) {
            dbwindex = Integer.parseInt(stringdatas[1]);
        } else
            return null;
        return stringdatas[0]+"."+dbwindex+bitindex;
        int bitindex = index;
        return stringdatas[0]+"."+bitindex;
    }
    public int getPlcAddress() {
springboot-vue3/src/main/java/com/example/springboot/entity/device/PlcParameterObject.java
@@ -1,8 +1,11 @@
package com.example.springboot.entity.device;
import java.lang.reflect.Array;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class PlcParameterObject {
@@ -73,11 +76,21 @@
     * @return 获取某个参数实例
     */
    public List<String> getPlcParameterValues(List<String> codeids) {
        List<String> arrayList = new ArrayList();
        List<String> arrayList = new ArrayList<>();
        if (plcParameterList != null) {
            Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                if (codeids.contains(plcParameterInfo.getCodeId()))
                if (codeids.contains(plcParameterInfo.getCodeId())) {
                    resultMap.put(plcParameterInfo.getCodeId(), plcParameterInfo);
                }
            }
            for (String codeId : codeids) { // 按照传入参数的顺序遍历
                PlcParameterInfo plcParameterInfo = resultMap.get(codeId);
                if (plcParameterInfo != null) {
                    arrayList.add(plcParameterInfo.getValue());
                } else {
                    arrayList.add(null); // 如果找不到对应的值,添加 null
                }
            }
        }
        return arrayList;
@@ -87,7 +100,7 @@
    /**
     * 添加参数实例
     * 
@@ -111,12 +124,21 @@
        if (plcParameterList != null) {
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                byte[] valueList = new byte[plcParameterInfo.getAddressLength()];
//                System.out.println(plcParameterInfo.getAddressLength());
                for (int i = 0; i < plcParameterInfo.getAddressLength(); i++) {
                    Array.setByte(valueList, i, plcValueArray[plcParameterInfo.getAddressIndex() + i]);
                }
                if (plcParameterInfo.getAddressLength()==2) { 
                      plcParameterInfo.setValue(String.valueOf(byte2short(valueList)));
                }
                else if (plcParameterInfo.getAddressLength()==14) {
                    plcParameterInfo.setValue((byteToHexString(valueList)));
                }
                else
                {
                    String valuestr = new String(valueList);
@@ -152,5 +174,11 @@
       return l;
   }
    public static String byteToHexString(byte[] bytes) {
        String str = new String(bytes, StandardCharsets.UTF_8);
        return str;
    }
}
springboot-vue3/src/main/resources/JsonFile/PlcParameter.json
@@ -1,6 +1,6 @@
{
   "plcAddressBegin":"DB100.0",
   "plcAddressLenght":"86",
   "plcAddressLenght":"198",
   "dataType":"word",
   "parameteInfor":[
      {
springboot-vue3/src/main/resources/JsonFile/PlcSign.json
@@ -1,47 +1,47 @@
{
   "plcAddressBegin":"DB100.0.0",
   "plcAddressLenght":"20",
   "dataType":"bit",
   "parameteInfor":[
      {
         "codeId": "D01.SRdec",
         "addressIndex":"0"
      },
      {
          "codeId": "conveyorVelocity(AutoSLOW)",
          "addressIndex":"1"
       },
       {
          "codeId": "conveyorVelocity(Manual)",
          "addressIndex":"2"
       },
       {
          "codeId": "A01A02TURNJOGVelocity",
          "addressIndex":"3"
       },
       {
          "codeId": "A01A02TRAVELJOGVelocity",
          "addressIndex":"4"
       },
       {
          "codeId": "B01B02TRAVELJOGVelocity",
          "addressIndex":"5"
       },
       {
          "codeId": "A01A02TURNPOSVelocityAUTO",
          "addressIndex":"12"
       },
       {
          "codeId": "A01A02TURNPOSVelocitymanual",
          "addressIndex":"14"
       },
       {
          "codeId": "A01A02TRAVELPOSVelocityAUTO",
          "addressIndex":"16"
       },
       {
         "codeId": "DO1id",
         "addressIndex":"18"
      }
  "plcAddressBegin":"DB100.0.0",
  "plcAddressLenght":"11",
  "dataType":"bit",
  "parameteInfor":[
    {
      "codeId": "D01.SRdec",
      "addressIndex":"0"
    },
    {
      "codeId": "conveyorVelocity(AutoSLOW)",
      "addressIndex":"1"
    },
    {
      "codeId": "conveyorVelocity(Manual)",
      "addressIndex":"2"
    },
    {
      "codeId": "A01A02TURNJOGVelocity",
      "addressIndex":"3"
    },
    {
      "codeId": "A01A02TRAVELJOGVelocity",
      "addressIndex":"4"
    },
    {
      "codeId": "B01B02TRAVELJOGVelocity",
      "addressIndex":"5"
    },
    {
      "codeId": "A01A02TURNPOSVelocityAUTO",
      "addressIndex":"7"
    },
    {
      "codeId": "A01A02TURNPOSVelocitymanual",
      "addressIndex":"8"
    },
    {
      "codeId": "A01A02TRAVELPOSVelocityAUTO",
      "addressIndex":"9"
    },
    {
      "codeId": "DO1id",
      "addressIndex":"10"
    }
  ]
}
springboot-vue3/src/main/resources/JsonFile/PlcState.json
New file
@@ -0,0 +1,272 @@
{
  "plcAddressBegin": "DB103.0",
  "plcAddressLenght": "256",
  "dataType": "word",
  "parameteInfor": [
    {
      "codeId": "D01.State",
      "addressIndex": "0",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D02.State",
      "addressIndex": "2",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B01.State",
      "addressIndex": "4",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B02.State",
      "addressIndex": "6",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01.State",
      "addressIndex": "8",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02.State",
      "addressIndex": "10",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D03.State",
      "addressIndex": "12",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D04.State",
      "addressIndex": "14",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D05.State",
      "addressIndex": "16",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D06.State",
      "addressIndex": "18",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01tavelActualPosition",
      "addressIndex": "20",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01turnActualangle",
      "addressIndex": "22",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02tavelActualPosition",
      "addressIndex": "24",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02turnActualangle",
      "addressIndex": "26",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B01tavelActualPosition",
      "addressIndex": "28",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B02tavelActualPosition",
      "addressIndex": "30",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01CurrentGrid",
      "addressIndex": "32",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02CurrentGrid",
      "addressIndex": "34",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B01CurrentGrid",
      "addressIndex": "36",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B01TargetGrid",
      "addressIndex": "38",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B02CurrentGrid",
      "addressIndex": "40",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B02TargetGrid",
      "addressIndex": "42",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "D01ID",
      "addressIndex": "44",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "D02ID",
      "addressIndex": "58",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "D03ID",
      "addressIndex": "72",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "D04ID",
      "addressIndex": "86",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "D05ID",
      "addressIndex": "100",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "D06ID",
      "addressIndex": "114",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "A01ID1",
      "addressIndex": "128",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "A01ID2",
      "addressIndex": "142",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "A02ID1",
      "addressIndex": "156",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "A02ID2",
      "addressIndex": "170",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "B01ID1",
      "addressIndex": "184",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "B01ID2",
      "addressIndex": "198",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "B02ID1",
      "addressIndex": "212",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "B02ID2",
      "addressIndex": "226",
      "addressLenght": "14",
      "unit": ""
    },
    {
      "codeId": "A01conveyorFaultcodes",
      "addressIndex": "240",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01turnservoFaultcodes",
      "addressIndex": "242",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A01travelservoFaultcodes",
      "addressIndex": "244",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02conveyorFaultcodes",
      "addressIndex": "246",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02turnservoFaultcodes",
      "addressIndex": "248",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "A02travelservoFaultcodes",
      "addressIndex": "250",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B01travelservoFaultcodes",
      "addressIndex": "252",
      "addressLenght": "2",
      "unit": ""
    },
    {
      "codeId": "B02travelservoFaultcodes",
      "addressIndex": "254",
      "addressLenght": "2",
      "unit": ""
    }
  ]
}
springboot-vue3/src/main/resources/config.properties
@@ -155,7 +155,7 @@
#addresses.add("DB100.36");
#addresses.add("DB100.38");
#addresses.add("DB100.40");
Auto.addresses=DB100.0,DB100.2,DB100.4,DB100.6,DB100.26,DB100.28,DB100.30,DB100.32,DB100.34,DB100.36,DB100.38,DB100.40
Auto.addresses=DB100.2,DB100.4,DB100.6,DB100.28,DB100.30,DB100.32,DB100.36,DB100.38,DB100.40
#List<String> waddresses1 = new ArrayList<>();
#waddresses1.add("DB100.0");
@@ -171,7 +171,7 @@
#waddresses1.add("DB100.38");
#waddresses1.add("DB100.40");
Auto.shusong=DB100.0,DB100.2,DB100.4,DB100.6,DB100.26,DB100.28,DB100.30,DB100.32,DB100.34,DB100.36,DB100.38,DB100.40
Auto.shusong=DB100.2,DB100.4,DB100.6,DB100.28,DB100.30,DB100.32,DB100.36,DB100.38,DB100.40
#-----PlcPositioning1-------------------------
@@ -215,7 +215,7 @@
#出片任务
PlcInteractionState.MESProductiontask=DB105.10,DB105.12,DB105.14,DB105.16,DB105.18,DB105.34-47
PlcInteractionState.PLCProductiontask=DB106.20,DB106.16,DB106.18,DB103.156-169
PlcInteractionState.PLCProductiontask=DB106.20,DB106.16,DB106.18,DB103.156-169,DB106.64
#任务信息
PlcInteractionState.MEStaskinformation=DB105.48,DB105.50,DB105.48,DB105.50,DB106.42,DB106.48