zhoushihao
2024-04-11 a9e5e23e75ddb7ce03e992cc68efcdf8cc0975da
Merge remote-tracking branch 'origin/master'

# Conflicts:
# hangzhoumesParent/gateway/src/main/resources/application.yml
# hangzhoumesParent/moduleService/CacheGlassModule/src/main/resources/application.yml
# hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
17个文件已修改
25个文件已添加
4516 ■■■■■ 已修改文件
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue 345 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/PLCAutoMes.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plchome.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/AppRunnerConfig.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcBitInfo.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcBitObject.java 142 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcParameterInfo.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcParameterObject.java 205 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassInfo.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/mapper/DownGlassInfoMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstation.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/mapper/DownWorkstationMapper.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownGlassLogic.java 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/Configuration.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/ExcelToJsonConverter.java 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/InitUtil.java 128 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/TokenTools.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/WebSocketServer.java 164 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/mapper/GlassInfoMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/service/GlassInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/GlassInfoServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcAlarm.json 371 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcMes.json 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcParameter.json 610 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcRead.json 195 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcSign.json 460 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcState.json 285 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcTest.json 378 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/Plcframe.json 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/alarm.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/sign.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/test.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/UnLoadGlass/loadmachinerack.vue
@@ -1,51 +1,209 @@
<script setup>
import {Search} from "@element-plus/icons-vue";
import {reactive} from "vue";
import {reactive,  onMounted} from "vue";
import {useRouter} from "vue-router"
const router = useRouter()
const dialogFormVisiblea = ref(false)
import { ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import Landingindication from "./Landingindication.vue";
import Landingindicationtwo from "./Landingindicationtwo.vue";
import unloadrequest from "@/utils/unloadrequest";
const dialogFormVisiblea = ref(false)
const tableData = [
  {
    id: '1',
    long: '1005',
    wide: '183.6',
    thick: '1991',
    state: '未启用',
  },
  {
    id: '2',
    long: '105',
    wide: '183',
    thick: '191',
    state: '未启用'
  },
  {
    id: '3',
    long: '105',
    wide: '183',
    thick: '191',
    state: '未启用'
  },
  {
    id: '4',
    long: '105',
    wide: '183',
    thick: '191',
    state: '未启用'
  },
  {
    id: '5',
    long: '105',
    wide: '183',
    thick: '191',
    state: '未启用'
  },
]
const dialogFormVisiblea2 = ref(false)
const tableData = reactive([]);
let socket;
const initWebSocket = (token) =>{ //初始化we
let viewname = "unloadglass";
if (typeof WebSocket === "undefined") {
  console.log("您的浏览器不支持WebSocket");
} else {
  let socketUrl = "ws://" + "localhost"+":88" + "/api/unLoadGlass/api/talk/" + viewname;
  if (socket != null) {
    socket.close();
    socket = null;
  }
  // 开启一个websocket服务
  socket = new WebSocket(socketUrl);
  // 打开事件
  socket.onopen = function () {
    console.log("websocket已打开");
  };
socket.onmessage = (msg) => {
if (!msg.data) {
return; // 如果收到空数据,则直接返回,不执行后续逻辑
}
    let obj = JSON.parse(msg.data);
      console.log('收到消息:', obj.data);
  }
  }
  }
// 数据
const loading = ref(false);
// 弹框显示控制
const dialogFormVisible = ref(false);
// 表单数据
const workstationId = ref('');
const flowCardId = ref('');
const flowCardOptions = ref([]);
// 方法
const handleSelectionChange = () => {
  // 处理表格行选择事件
};
const handleBindRack = (row) => {
  workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名
  // 发起接口请求获取流程卡号
    fetchFlowCardId();
  dialogFormVisiblea.value = true; // 打开绑定架子对话框
};
//获取流程卡号
const fetchFlowCardId = async () => {
  try {
    const response = await unloadrequest.get('/api/downWorkstation/getflowCardId');
    console.log(response)
    if (response.code === 200) {
      flowCardOptions.value = response.data.map(item => ({ flowcard_id: item.flowcard_id }));
    } else {
      ElMessage.error(response.msg);
    }
  } catch (error) {
    console.error(error);
  }
};
//确认
const handleConfirm = async () => {
  try {
    const response = await unloadrequest.post('/api/downWorkstation/updateFlowCardId', {
      workstationId: workstationId.value,
      flowCardId: flowCardId.value
    });
    console.log(response)
    if (response.code == 200) {
      // 绑定成功,处理逻辑
      console.log('绑定成功');
      ElMessage.success(response.message);
      dialogFormVisiblea.value = false;
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
    }
  } catch (error) {
    // 处理错误
    console.error(error);
  }
};
const handleBindRack2 = (row) => {
  workstationId.value = row.workstationId; // 假设rackNumber是架号字段的属性名
  dialogFormVisiblea2.value = true; // 打开绑定架子对话框
};
//清除内容
const handleclear = async () => {
    try {
        const response = await unloadrequest.post('/api/downWorkstation/clear', {
            workstationId: workstationId.value,
        });
        console.log(response);
        if (response.code === 200) {
            // 清除成功的逻辑
            console.log('清除成功');
            ElMessage.success(response.message);
            dialogFormVisiblea2.value = false;
        } else if (response.code === 400) {
            // 清除失败的逻辑
            console.log('清除失败');
            console.log(response.message); // 打印服务器返回的错误信息
            ElMessage.error(response.message);
            dialogFormVisiblea2.value = false;
        }
    } catch (error) {
        // console.log(error);
         ElMessage.error("清除失败");
            dialogFormVisiblea2.value = false;
    }
};
// 发送获取表格数据的请求
const fetchTableData = async () => {
  try {
    // 发送获取表格数据的请求,并等待响应
    const response = await unloadrequest.get('/api/downWorkstation/getone');
    // 检查响应状态
    if (response.code === 200) {
      // 更新表格数据
      console.log('成功获取表格数据:', response.data);
      tableData.splice(0, tableData.length, ...response.data);
    } else {
      // 请求失败,显示错误消息
      ElMessage.error(response.msg);
    }
  } catch (error) {
    // 处理请求失败的情况
    ElMessage.error('获取表格数据失败,请重试');
  }
};
initWebSocket();
onMounted(fetchTableData);
//setInterval(fetchTableData, 2000)
const open = () => {
  ElMessageBox.confirm(
    '是否删除该条信息?',
@@ -83,17 +241,6 @@
  }
}
const dialogForm = () => {
  ElMessageBox.confirm(
    '是否清空该条信息?',
    '提示',
    {
      confirmButtonText: '是',
      cancelButtonText: '取消',
      type: 'warning',
    }
  )
}
const gridOptions = reactive({
  border:  "full",//表格加边框
  keepSource: true,//保持源数据
@@ -132,6 +279,10 @@
  ],
})
</script>
<template>
@@ -141,50 +292,80 @@
        <el-table height="100%" ref="table" 
        @selection-change="handleSelectionChange"
        :data="tableData" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="id" align="center" label="下片位" min-width="80" />
          <el-table-column prop="long" align="center" label="架号" min-width="120" />
          <el-table-column prop="wide" align="center" label="流程卡号" min-width="120" />
          <el-table-column prop="wide" align="center" label="总数量" min-width="120" />
          <el-table-column prop="wide" align="center" label="已落架数量" min-width="120" />
          <el-table-column prop="state" align="center" label="启用状态" min-width="120" />
          <el-table-column prop="workstationId" align="center" label="下片位" min-width="80" />
          <el-table-column prop="workstationId" align="center" label="架号" min-width="120" />
          <el-table-column prop="flowCardId" align="center" label="流程卡号" min-width="120" />
          <el-table-column prop="totalquantity" align="center" label="总数量" min-width="120" />
          <el-table-column prop="racksnumber" align="center" label="已落架数量" min-width="120" />
          <el-table-column prop="work_state" align="center" label="状态" min-width="120" />
          <el-table-column prop="deviceId" align="center" label="设备号" min-width="120" />
          <el-table-column prop="enableState" align="center" label="启用状态" min-width="120" />
          <el-table-column fixed="right" label="操作" align="center" width="200">
            <template #default>
              <el-button size="mini" type="text" plain v-show="state !== '已启用' " @click="dialogFormVisiblea = true">绑定架子</el-button>
              <el-button size="mini" type="text" plain   @click="dialogForm">清空</el-button>
            </template>
            <template #default="scope">
            <el-button size="mini" type="text" plain v-show="scope.row.enableState !== '已启用' " @click="handleBindRack(scope.row)">绑定架子</el-button>
            <el-button size="mini" type="text" plain  @click="handleBindRack2(scope.row)">清空</el-button>
          </template>
        </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
  <div style="display: flex;">
  <div id="main-body">
      <Landingindication></Landingindication>
    </div>
    </div>
    <el-dialog v-model="dialogFormVisiblea" top="21vh" width="30%" title="绑定架子" >
    <div style="margin-left: 50px;margin-top: 10px;margin-bottom: 10px;">
            <el-form  size="mini" label-width="150px">
      <el-form  label-width="100px" label-position="right">
              <el-form-item label="架号:" :required="true" style="width: 18vw">
                <el-input  autocomplete="off"/>
              </el-form-item>
              <el-form-item label="流程卡号:" :required="true" style="width: 18vw;">
                <el-input autocomplete="off" />
              </el-form-item>
        </el-form>
            </el-form>
          </div>
      <el-form  size="mini" label-width="150px">
        <el-form  label-width="100px" label-position="right">
          <el-form-item label="架号:" :required="true" style="width: 18vw">
            <el-input v-model="workstationId" autocomplete="off"/>
          </el-form-item>
          <el-form-item label="流程卡号:" :required="true" style="width: 18vw;">
          <el-select v-model="flowCardId" placeholder="请选择流程卡号">
            <el-option v-for="item in flowCardOptions" :key="item.flowcard_id" :label="item.flowcard_id" :value="item.flowcard_id" />
          </el-select>
        </el-form-item>
      </el-form>
      </el-form>
    </div>
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="dialogFormVisiblea = false">
        <el-button type="primary" @click="handleConfirm">
          确认
        </el-button>
        <el-button @click="dialogFormVisiblea = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
  <el-dialog v-model="dialogFormVisiblea2" top="21vh" width="30%" title="清除架子玻璃" >
    <template #footer>
      <div id="dialog-footer">
        <el-button type="primary" @click="handleclear">
          确认
        </el-button>
        <el-button @click="dialogFormVisiblea2 = false">取消</el-button>
      </div>
    </template>
  </el-dialog>
    <!-- workstationId: '1',
    workstationId: '1005',
    flowCardId: '183.6',
    totalquantity: '1991',
    racksnumber:"1",
    work_state: '待识别', -->
  </div>
  <div style="display: flex;">
  <div id="main-body">
      <Landingindication></Landingindication>
    </div>
  <div id="main-bodya">
    <Landingindicationtwo></Landingindicationtwo>
    </div></div>
</template>
<style scoped>
@@ -208,7 +389,11 @@
  height: 450px;
}
#main-body{
  margin-top: -20px;
  margin-left: 300px;
}
#main-bodya{
  margin-top: -10px;
  margin-left: 450px;
  margin-left: 100px;
}
</style>
hangzhoumesParent/moduleService/CacheVerticalGlassModule/pom.xml
@@ -2,18 +2,18 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>moduleService</artifactId>
        <groupId>com.mes</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>moduleService</artifactId>
    <groupId>com.mes</groupId>
    <version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
    <artifactId>cacheVerticalGlass</artifactId>
<artifactId>cacheVerticalGlass</artifactId>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
<properties>
    <maven.compiler.source>8</maven.compiler.source>
    <maven.compiler.target>8</maven.compiler.target>
</properties>
</project>
hangzhoumesParent/moduleService/UnLoadGlassModule/pom.xml
@@ -10,6 +10,18 @@
    <modelVersion>4.0.0</modelVersion>
    <artifactId>unLoadGlass</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.9.0</version>
        </dependency>
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
            <version>3.5.2</version>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/UnLoadGlassApplication.java
@@ -1,9 +1,11 @@
package com.mes;
import com.mes.tools.WebSocketServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
/**
 * @Author : zhoush
@@ -14,7 +16,13 @@
@EnableDiscoveryClient
@MapperScan(basePackages = "com.mes.*.mapper")
public class UnLoadGlassApplication {
    public static void main(String[] args) {
        SpringApplication.run(UnLoadGlassApplication.class, args);
        SpringApplication springApplication = new SpringApplication(UnLoadGlassApplication.class);
        ConfigurableApplicationContext applicationContext = springApplication.run(args);
        WebSocketServer.setApplicationContext(applicationContext);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/PLCAutoMes.java
New file
@@ -0,0 +1,91 @@
package com.mes.common;
import com.mes.device.PlcParameterObject;
import com.mes.tools.InitUtil;
import org.springframework.context.annotation.Configuration;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static com.mes.tools.InitUtil.readAndUpdateWordValues;
public class PLCAutoMes extends Thread {
    // 用于存储应用程序的配置信息
    private Configuration config;
    private static InitUtil initUtil;
    // 单例实例
    private static PLCAutoMes instance;
    private static String PlcMes = PLCAutoMes.class.getResource("/JsonFile/PlcMes.json").getPath();
    private static String PlcRead = PLCAutoMes.class.getResource("/JsonFile/PlcRead.json").getPath();
    private static String Plcframe = PLCAutoMes.class.getResource("/JsonFile/Plcframe.json").getPath();
//    private static String PlcParameter = PLCAutomaticParameterSettingReview2.class
//            .getResource("/JsonFile/PlcParameter.json").getPath();
//    private static String PlcSign = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcSign.json")
//            .getPath();
//    private static String PlcState = PLCAutomaticParameterSettingReview2.class.getResource("/JsonFile/PlcState.json")
//            .getPath();
    private static String PlcAlarm = PLCAutoMes.class.getResource("/JsonFile/PlcAlarm.json").getPath();
   // private static String PlcTest = PLCAutoMes.class.getResource("/JsonFile/PlcTest.json").getPath();
    // 调用initword方法
//
   // public static PlcBitObject plcPlcAlarm = initUtil.initbit(PlcAlarm);
    public static PlcParameterObject PlcMesObject = initUtil.initword(PlcMes);
    public static PlcParameterObject PlcReadObject = initUtil.initword(PlcRead);
    public static PlcParameterObject PlcframeObject = initUtil.initword(Plcframe);
    // 私有构造函数
    public PLCAutoMes() throws IOException {
        initUtil = new InitUtil();
    }
    // 获取单例实例
    public static synchronized PLCAutoMes getInstance() throws IOException {
        if (instance == null) {
            instance = new PLCAutoMes();
        }
        return instance;
    }
    @Override
    public void run() {
        while (this != null) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            // System.out.println(jsonFilePath);
          // readAndUpdateWordValues(PlcReadObject);
            readAndUpdateWordValues(PlcMesObject);
//      readAndUpdateWordValues(PlcframeObject);
            // 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");
         //   System.out.println(PlcReadObject.getPlcParameterValues(addresses2));
        }
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/common/Plchome.java
New file
@@ -0,0 +1,62 @@
package com.mes.common;
import cn.hutool.json.JSONObject;
import com.mes.downworkstation.service.DownGlassLogic;
import com.mes.tools.WebSocketServer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.function.Supplier;
@Component
public class Plchome extends Thread {
    private int i = 1;
    private static final Logger log = LogManager.getLogger(Plchome.class);
    private final Supplier<DownGlassLogic> plcServiceSupplier;
    public Plchome() {
        this.plcServiceSupplier = () -> WebSocketServer.applicationContext.getBean(DownGlassLogic.class);
    }
    @Override
    public void run() {
        while (!Thread.currentThread().isInterrupted()) {
            try {
                i++;
                Thread.sleep(100);
                DownGlassLogic plcService = plcServiceSupplier.get();
               // plcService.performPlcActions();
                //plcService.unloadpush();
                //当下片任务表状态为1时候将数据插入到下片玻璃信息表
                plcService.insertdownglassinfo();
                //当机械手任务表中状态为1 更新已经落架数量,并且把下片任务表的那条记录删掉 工位表流程卡绑定了架子
                plcService.downWorkstation();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                e.printStackTrace();
            }
            JSONObject jsonObject = new JSONObject();
            // System.out.println(arraylist6);
            jsonObject.append("data", 1);
            ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("unloadglass");
            if (sendwServer != null) {
                for (WebSocketServer webserver : sendwServer) {
                    webserver.sendMessage(jsonObject.toString());
                    log.info("准备向 WebSocket 服务器发送消息: {}", jsonObject.toString());
                }}
        }
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/config/AppRunnerConfig.java
New file
@@ -0,0 +1,29 @@
package com.mes.config;
import com.mes.common.PLCAutoMes;
import com.mes.common.Plchome;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
@Component
@Order(1)
public class AppRunnerConfig implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        // TODO Auto-generated method stub
        //
        System.out.println("启动完成");
       new PLCAutoMes().start();
    new Plchome().start();
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcBitInfo.java
New file
@@ -0,0 +1,75 @@
package com.mes.device;
public  class PlcBitInfo {
        public PlcBitInfo(String startAddress) {
            this.startAddress = startAddress;
        }
        private String startAddress;
        // 参数标识
        private String codeId;
        // 参数名称
        private String name;
        // 读取 参数值
        private Boolean value;
        // 参数地址
        private int addressIndex;
        public String getCodeId() {
            return this.codeId;
        }
        public void setCodeId(String codeId) {
            this.codeId = codeId;
        }
        public String getName() {
            return this.name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public Boolean getValue() {
            return this.value;
        }
        public void setValue(Boolean value) {
            this.value = value;
        }
        public int getAddressIndex() {
            return this.addressIndex;
        }
         /**
     * 获取地址
     *
     * @param index 索引地址
     */
        public String getAddress(int index) {
            String[] stringdatas = this.startAddress.trim().split("\\.");
            if (stringdatas.length < 2 )
                return null;
            int dbwindex = 0;
            int bitindex = 0;
             if (stringdatas.length == 3) {
                dbwindex = Integer.parseInt(stringdatas[1]);
                bitindex = Integer.parseInt(stringdatas[2]);
            } else
                return null;
              dbwindex+=index/8;
              bitindex+=index%8;
            return stringdatas[0]+"."+dbwindex+"."+bitindex;
        }
    public void setAddressIndex(int addressindex) {
            this.addressIndex = addressindex;
        }
    }
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcBitObject.java
New file
@@ -0,0 +1,142 @@
package com.mes.device;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class PlcBitObject {
    // 该模块数据类型,数据起始位置
    private String plcAddressBegin;
    // 数据地址长度:第一参数到最后一个参数的长度
    private int plcAddressLength;
    private ArrayList<PlcBitInfo> plcBitList;
    /**
     * @return 数据区开始地址
     */
    public String getPlcAddressBegin() {
        return plcAddressBegin;
    }
    /**
     * @param plcAddressBegin 设置数据区开始地址
     */
    public void setPlcAddressBegin(String plcAddressBegin) {
        this.plcAddressBegin = plcAddressBegin;
    }
    /**
     * @return 数据区 读取所有数据所需的长度(以byte类型为基准)
     */
    public int getPlcAddressLength() {
        return plcAddressLength;
    }
    /**
     * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准)
     */
    public void setPlcAddressLength(int plcAddressLength) {
        this.plcAddressLength = plcAddressLength;
    }
    /**
     * @return 获取参数实例集合
     */
    public ArrayList<PlcBitInfo> getBitList() {
        return plcBitList;
    }
    /**
     * 根据参数标识 获取某个参数实例
     *
     * @param codeid 参数标识
     * @return 获取某个参数实例
     */
    public PlcBitInfo getPlcBit(String codeid) {
        if (plcBitList != null) {
            for (PlcBitInfo plcbitInfo : plcBitList) {
                if (plcbitInfo.getCodeId().equals(codeid))
                    return plcbitInfo;
            }
            return null;
        } else
            return null;
    }
    /**
     * 根据参数标识 获取某个参数实例
     *
     * @param codeid 参数标识
     * @return 获取某个参数实例
     */
    public List<Boolean> getPlcBitValues(List<String> codeids) {
        List<Boolean> arrayList = new ArrayList<>();
        if (plcBitList != null) {
            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;
    }
    public List<String> getAddressListByCodeId(List<String> codeIdList) {
        List<String> addressList = new ArrayList<>();
        for (String codeId : codeIdList) {
            for (PlcBitInfo plcBitInfo : plcBitList) {
                if (plcBitInfo.getCodeId().equals(codeId)) {
                    int index = plcBitInfo.getAddressIndex();
                    String address = plcBitInfo.getAddress(index);
                    if (address != null) {
                        addressList.add(address);
                    }
                }
            }
        }
        return addressList;
    }
    /**
     * 添加参数实例
     *
     * @param param 参数实例
     */
    public void addPlcBit(PlcBitInfo param) {
        if (plcBitList != null)
            plcBitList.add(param);
        else {
            plcBitList = new ArrayList<PlcBitInfo>();
            plcBitList.add(param);
        }
    }
    /**
     * 根据PLC返回的数据 给参数实例赋值
     *
     * @param plcValueArray PLC读取回来的byte类型数据集合
     */
    public void setPlcBitList(List<Boolean> plcValueArray) {
        if (plcBitList != null) {
            for (PlcBitInfo plcbitInfo : plcBitList) {
                plcbitInfo.setValue(plcValueArray.get(plcbitInfo.getAddressIndex()));
            }
        }
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcParameterInfo.java
New file
@@ -0,0 +1,128 @@
package com.mes.device;
public  class PlcParameterInfo {
      public PlcParameterInfo(String startAddress) {
        this.startAddress = startAddress;
      }
        private String startAddress;
        // 参数标识
        private String codeId;
        // 参数名称
        private String name;
        // 读取 参数值
        private String value;
        // // 写入 参数值
        // private String writeValue;
        // 参数单位
        private String unit;
        // 参数值转换系数
        private int ratio;
        // 参数地址
        private int addressIndex;
        // 参数地址位长度
        private int addressLength;
        public String getCodeId() {
            return this.codeId;
        }
        public void setCodeId(String codeId) {
            this.codeId = codeId;
        }
        public String getName() {
            return this.name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return this.value;
        }
        public void setValue(String value) {
            this.value = value;
        }
        // public String getWriteValue() {
        //     return this.writeValue;
        // }
        // public void setWriteValue(String writeValue) {
        //     this.writeValue = writeValue;
        // }
        public String getUnit() {
            return this.unit;
        }
        public void setUnit(String unit) {
            this.unit = unit;
        }
        public int getAddressIndex() {
            return this.addressIndex;
        }
        public void setAddressIndex(int addressindex) {
            this.addressIndex = addressindex;
        }
        public int getAddressLength() {
            return this.addressLength;
        }
        public void setAddressLength(int addresslength) {
            this.addressLength = addresslength;
        }
        public int getRatio() {
            return this.ratio;
        }
        public void setRatio(int ratio) {
            this.ratio = ratio;
        }
           /**
     * 获取地址
     *
     * @param index 索引地址
     */
    public String getAddress(int index) {
        String[] stringdatas = this.startAddress.trim().split("\\.");
        int addressLength=this.addressLength;
        if (addressLength < 2 ){
            return null;
        }
        if (addressLength == 2 ) {
            int wordindex = index;
            return stringdatas[0] + "." + wordindex;
        }
        if (addressLength == 14 ) {
            int wordindex = index;
            int newIndex = wordindex + 13;
            return stringdatas[0] + "." + wordindex +"-" + newIndex;
        }
        return null;
    }
    public int getPlcAddress() {
        return addressIndex;
    }
    public String getAddress() {
        return getAddress(this.addressIndex);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/device/PlcParameterObject.java
New file
@@ -0,0 +1,205 @@
package com.mes.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 {
    // 该模块数据类型,数据起始位置
    private String plcAddressBegin;
    // 数据地址长度:第一参数到最后一个参数的长度
    private int plcAddressLength;
    private ArrayList<PlcParameterInfo> plcParameterList;
    /**
     * @return 数据区开始地址
     */
    public String getPlcAddressBegin() {
        return plcAddressBegin;
    }
    /**
     * @param plcAddressBegin 设置数据区开始地址
     */
    public void setPlcAddressBegin(String plcAddressBegin) {
        this.plcAddressBegin = plcAddressBegin;
    }
    /**
     * @return 数据区 读取所有数据所需的长度(以byte类型为基准)
     */
    public int getPlcAddressLength() {
        return plcAddressLength;
    }
    /**
     * @return 设置:数据区 读取所有数据所需的长度(以byte类型为基准)
     */
    public void setPlcAddressLength(int plcAddressLength) {
        this.plcAddressLength = plcAddressLength;
    }
    /**
     * @return 获取参数实例集合
     */
    public ArrayList<PlcParameterInfo> getPlcParameterList() {
        return plcParameterList;
    }
    /**
     * 根据参数标识 获取某个参数实例
     *
     * @param codeid 参数标识
     * @return 获取某个参数实例
     */
    public PlcParameterInfo getPlcParameter(String codeid) {
        if (plcParameterList != null) {
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                if (plcParameterInfo.getCodeId().equals(codeid))
                    return plcParameterInfo;
            }
            return null;
        } else
            return null;
    }
    /**
     * 根据参数标识 获取某个参数实例
     *
     * @param codeids 参数标识
     * @return 获取某个参数实例
     */
    public List<String> getPlcParameterValues(List<String> codeids) {
        List<String> arrayList = new ArrayList<>();
        if (plcParameterList != null) {
            Map<String, PlcParameterInfo> resultMap = new LinkedHashMap<>(); // 使用 LinkedHashMap 保留插入顺序
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                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;
    }
    public List<String> getAddressListByCodeId(List<String> codeIdList) {
        List<String> addressList = new ArrayList<>();
        for (String codeId : codeIdList) {
            for (PlcParameterInfo plcParameterInfo : plcParameterList) {
                if (plcParameterInfo.getCodeId().equals(codeId)) {
                    int index = plcParameterInfo.getAddressIndex();
                    String address = plcParameterInfo.getAddress(index);
                    if (address != null) {
                        addressList.add(address);
                    }
                }
            }
        }
        return addressList;
    }
    /**
     * 添加参数实例
     *
     * @param param 参数实例
     */
    public void addPlcParameter(PlcParameterInfo param) {
        if (plcParameterList != null)
            plcParameterList.add(param);
        else {
            plcParameterList = new ArrayList<PlcParameterInfo>();
            plcParameterList.add(param);
        }
    }
    /**
     * 根据PLC返回的数据 给参数实例赋值
     *
     * @param plcValueArray PLC读取回来的byte类型数据集合
     */
    public void setPlcParameterList(byte[] plcValueArray) {
        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);
                    plcParameterInfo.setValue(valuestr);
                }
            }
        }
    }
     /**
     * short类型转byte[]
     *
     * @param s short类型值
     */
    public static byte[] short2byte(short s){
        byte[] b = new byte[2];
        for(int i = 0; i < 2; i++){
            int offset = 16 - (i+1)*8; //因为byte占4个字节,所以要计算偏移量
            b[i] = (byte)((s >> offset)&0xff); //把16位分为2个8位进行分别存储
        }
        return b;
   }
     /**
     * byte[]类型转short
     *
     * @param b byte[]类型值
     */
   public static short byte2short(byte[] b){
       short l = 0;
       for (int i = 0; i < 2; i++) {
           l<<=8; //<<=和我们的 +=是一样的,意思就是 l = l << 8
           l |= (b[i] & 0xff); //和上面也是一样的  l = l | (b[i]&0xff)
       }
       return l;
   }
    public static String byteToHexString(byte[] bytes) {
        String str = new String(bytes, StandardCharsets.UTF_8);
        return str;
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/entity/DownGlassInfo.java
@@ -3,6 +3,7 @@
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.stereotype.Component;
/**
 * <p>
@@ -13,6 +14,7 @@
 * @since 2024-03-27
 */
@Data
@Component
@EqualsAndHashCode(callSuper = false)
public class DownGlassInfo implements Serializable {
@@ -21,7 +23,7 @@
    /**
     * 下片玻璃信息表id
     */
      private Integer id;
      private int id;
    /**
     * 流程卡号
@@ -49,4 +51,7 @@
    private Double thickness;
    private int Filmsid;
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/mapper/DownGlassInfoMapper.java
@@ -2,15 +2,20 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.downglassinfo.entity.DownGlassInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
import java.util.List;
@Repository
public interface DownGlassInfoMapper extends BaseMapper<DownGlassInfo> {
    // 查询下片任务表中状态为1的下片信息
    List<DownGlassInfo> selectunloadingtaskstate();
    void updateTaskStateToZero(@Param("flowCardId") String flowCardId);
    Integer getMaxSequenceByFlowCardId(@Param("flowCardId") String flowCardId);
    void deletetask(@Param("flowCardId") String flowCardId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/DownGlassInfoService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.downglassinfo.entity.DownGlassInfo;
import org.springframework.beans.factory.annotation.Autowired;
/**
 * <p>
@@ -13,4 +14,6 @@
 */
public interface DownGlassInfoService extends IService<DownGlassInfo> {
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downglassinfo/service/impl/DownGlassInfoServiceImpl.java
@@ -17,4 +17,6 @@
@Service
public class DownGlassInfoServiceImpl extends ServiceImpl<DownGlassInfoMapper, DownGlassInfo> implements DownGlassInfoService {
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -1,9 +1,17 @@
package com.mes.downworkstation.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.uppattenusage.service.GlassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -13,9 +21,116 @@
 * @author zhoush
 * @since 2024-03-27
 */
@RestController
@RequestMapping("/downWorkstation")
@RequestMapping("/api/downWorkstation")
public class DownWorkstationController {
    @Autowired
    private DownWorkstationService downWorkstationService;
    @Autowired
    private GlassInfoService glassInfoService;
    @GetMapping("/getone")
    public ResponseEntity<?> getOneDownWorkstations() {
        try {
            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations();
            // 构建符合预期格式的响应数据
            Map<String, Object> responseData = new HashMap<>();
            responseData.put("code", 200);
            responseData.put("msg", "成功");
            responseData.put("data", data);
            // 返回 ResponseEntity 对象,包含响应数据和状态码
            return ResponseEntity.ok(responseData);
        } catch (Exception e) {
            e.printStackTrace();
            // 如果出现异常,返回错误信息
            Map<String, Object> errorResponse = new HashMap<>();
            errorResponse.put("code", 500);
            errorResponse.put("msg", "服务器内部错误");
            return ResponseEntity.status(500).body(errorResponse);
        }
    }
    @GetMapping("/gettwo")
    public List<DownWorkstation> gettwoDownWorkstations() {
        return downWorkstationService.gettwoDownWorkstations();
    }
    @GetMapping("/getflowCardId")
    public ResponseEntity<Map<String, Object>> getflowCardId() {
        Map<String, Object> responseData = new HashMap<>();
        try {
            List<Map<String, Object>> data = downWorkstationService.getflowCardId();
            responseData.put("code", 200);
            responseData.put("msg", "成功");
            responseData.put("data", data);
            return ResponseEntity.ok(responseData);
        } catch (Exception e) {
            responseData.put("code", 500);
            responseData.put("msg", "失败");
            responseData.put("data", null);
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
        }
    }
    @PostMapping("/updateFlowCardId")
    public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody Map<String, Object> requestData) {
        // 从 requestData 中获取传入的 flowCardId
        String flowCardId = (String) requestData.get("flowCardId");
        int workstationId = (int) requestData.get("workstationId");
        // 查询对应 flowCardId 的玻璃信息总数量
        int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId);
        // 更新 down_workstation 表中的总数量
        glassInfoService.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId);
        // 构建响应数据
        Map<String, Object> responseData = new HashMap<>();
        responseData.put("message", "updated successfully");
        responseData.put("code", 200);
        // 返回处理结果
        return ResponseEntity.ok(responseData);
    }
    @PostMapping("/clear")
    public ResponseEntity<Map<String, Object>> clearWorkstationInfo(@RequestBody Map<String, Object> requestData) {
        // 调用 DownWorkstationService 中的方法清除指定工位ID的信息
        int workstationId = (int) requestData.get("workstationId");
        int totalWorkstations = downWorkstationService.getTotalQuantity(workstationId);
        int downWorkstations = downWorkstationService.getRacksNumber(workstationId);
        if (downWorkstations == totalWorkstations) {
            downWorkstationService.clearFlowCardId(workstationId);
            Map<String, Object> responseData = new HashMap<>();
            responseData.put("message", "cleared successfully");
            responseData.put("code", 200);
            // 返回处理结果
            return ResponseEntity.ok(responseData);
        }
        else {
            // 如果总数量和落架数量不一致,返回错误响应
            Map<String, Object> errorResponse = new HashMap<>();
            errorResponse.put("message", "Total workstations count does not match down workstations count.");
            errorResponse.put("code", 400);
            return ResponseEntity.badRequest().body(errorResponse);
        }
        // 构建响应数据
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/entity/DownWorkstation.java
@@ -52,4 +52,7 @@
    private Integer workState;
    private Integer Racksnumber;
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/mapper/DownWorkstationMapper.java
@@ -1,7 +1,16 @@
package com.mes.downworkstation.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downworkstation.entity.DownWorkstation;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -11,6 +20,65 @@
 * @author zhoush
 * @since 2024-03-27
 */
@Mapper
@Repository
@InterceptorIgnore(tenantLine = "true")
@DS("hangzhoumes") // 指定使用 hangzhoumes 数据源
public interface DownWorkstationMapper extends BaseMapper<DownWorkstation> {
//查询工位表和任务表中状态为1的流程卡号和已落架数量
    @Select("SELECT dwt.flow_card_id,dw.id,dw.racks_number FROM down_workstation_task dwt JOIN down_workstation dw ON dwt.flow_card_id = dw.flow_card_id WHERE dwt.state = 1 LIMIT 1")
    List<DownWorkstation> selectdownWorkstationstate();
    //更新落架数量
    @Update("UPDATE down_workstation SET racks_number = #{racksNumber} " +
            "WHERE flow_card_id = #{flowCardId}")
    void  update_racks_number(@Param("flowCardId") String flowCardId,
                              @Param("racksNumber") Integer racksNumber);
    //插入机械任务表
    @Insert("INSERT INTO down_workstation_task (flow_card_id, width, height, thickness, filmsid,state) " +
            "VALUES (#{flowCardId}, #{width}, #{height}, #{thickness}, #{filmsid},1)")
    void insertdownWorkstationtask(DownGlassInfo downGlassInfo);
    //根据工位id更新实体类接收的数据
    @Update("UPDATE down_workstation SET width = #{width}, height = #{height}, flow_card_id = #{flowCardId} WHERE workstation_id = #{workstationId}")
    void updateFlowCardId(DownWorkstation downWorkstation);
    //满架拉走,清空信息
    @Update("UPDATE down_workstation SET width = null, height = null, flow_card_id = null WHERE workstation_id = #{workstationId}")
    void clearFlowCardId(DownWorkstation downWorkstation);
    @Update("UPDATE down_workstation_task SET state = 0 WHERE flow_card_id = #{flowCardId}")
    void update_task_state_to_zero(@Param("flowCardId") String flowCardId);
    @Select(" SELECT * FROM down_workstation WHERE workstation_id >= 1 AND workstation_id <= 5")
    List<DownWorkstation> getoneDownWorkstations();
    @Select(" SELECT * FROM down_workstation WHERE workstation_id >= 6 AND workstation_id <= 10")
    List<DownWorkstation> gettwoDownWorkstations();
    @Select("SELECT DISTINCT  flowcard_id from glass_info")
    @ResultType(Map.class)
    List<Map<String, Object>> getflowCardId();
    @Update("UPDATE down_workstation SET flow_card_id = NULL, total_quantity = 0, racks_number = 0 WHERE workstation_id = #{workstationId}")
    void clearFlowCardInfoByWorkstationId(@Param("workstationId") int workstationId);
    // 获取总数量
    @Select("SELECT total_quantity FROM down_workstation WHERE workstation_id = #{workstationId}")
    int getTotalQuantity(@Param("workstationId") int workstationId);
    // 获取落架数量
    @Select("SELECT racks_number FROM down_workstation WHERE workstation_id = #{workstationId}")
    int getRacksNumber(@Param("workstationId") int workstationId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownGlassLogic.java
New file
@@ -0,0 +1,156 @@
package com.mes.downworkstation.service;
import com.mes.common.PLCAutoMes;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.downglassinfo.service.DownGlassInfoService;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.device.PlcParameterObject;
import com.mes.downglassinfo.mapper.DownGlassInfoMapper;
import com.mes.downworkstation.mapper.DownWorkstationMapper;
import com.mes.tools.WebSocketServer;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Data
@Service
public class DownGlassLogic {
    @Autowired
    private DownGlassInfo downGlassInfo;
    private DownWorkstation downWorkstation;
    private DownGlassInfoMapper downGlassInfoMapper;
    private DownGlassInfoService downGlassInfoService;
    private DownWorkstationMapper downWorkstationMapper;
    PlcParameterObject plcread = PLCAutoMes.PlcReadObject;
    /**
     * // 机械手1PLC请求字
     */
    String robot1PLCrequestword = plcread.getPlcParameter("A01Position").getValue();
    /**
     * // 机械手2PLC请求字
     */
    String robot2PLCrequestword = plcread.getPlcParameter("A01Position").getValue();
    /**
     * // 玻璃id
     */
    String glassID = plcread.getPlcParameter("A01Position").getValue();
    String glasswidth = plcread.getPlcParameter("A01Position").getValue();
    String glassheight = plcread.getPlcParameter("A01Position").getValue();
    //
    String glassthickness = plcread.getPlcParameter("A01Position").getValue();
    String pLcwancheng = plcread.getPlcParameter("A01Position").getValue();
    /**
     * // 存放待处理的玻璃信息
     */
    private List<DownGlassInfo> glassList;
    /**
     * 存放玻璃放置在缓存笼中的详细信息
     */
    private List<DownStorageCageDetails> cageDetailsList;
    /**
     * //当下片任务表状态为1时候将数据插入到下片玻璃信息表
     */
    public void insertdownglassinfo() {
        downWorkstationMapper = WebSocketServer.applicationContext.getBean(DownWorkstationMapper.class);
        downGlassInfoService = WebSocketServer.applicationContext.getBean(DownGlassInfoService.class);
        downGlassInfoMapper = WebSocketServer.applicationContext.getBean(DownGlassInfoMapper.class);
        List<DownGlassInfo> taskdownGlassInf = downGlassInfoMapper.selectunloadingtaskstate();
//
        if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) {
//
            for (DownGlassInfo downGlassInfo : taskdownGlassInf) {
                // 创建新的 DownGlassInfo 对象并设置相关属性
                DownGlassInfo newdownGlassInfo = new DownGlassInfo();
                newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId());
                Integer maxSequence = downGlassInfoMapper.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId());
                // 初始化顺序字段值
                int sequence = maxSequence != null ? maxSequence + 1 : 1;
                newdownGlassInfo.setWidth(downGlassInfo.getWidth());
                newdownGlassInfo.setHeight(downGlassInfo.getHeight());
                newdownGlassInfo.setThickness(downGlassInfo.getThickness());
                newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid());
                // 设置顺序字段值
                newdownGlassInfo.setSequence(sequence);
                // 插入数据到下片玻璃信息表
                downGlassInfoMapper.insert(newdownGlassInfo);
                //插入数据到机械手任务表
                downWorkstationMapper.insertdownWorkstationtask(newdownGlassInfo);
                //更新下片任务表状态为0
                downGlassInfoMapper.updateTaskStateToZero(downGlassInfo.getFlowCardId());
                sequence++; // 递增顺序字段值
            }
        }
    }
    /**
     * //当机械手任务表中状态为1,工位表流程卡绑定了架子 更新已经落架数量,并且把下片任务表的对应记录删掉
     */
    public void downWorkstation() {
        try {
            //查询下片工位表中架子是否绑定了流程卡号 工位表和任务表中状态为1的流程卡号和已落架数量
            List<DownWorkstation> taskdownWorkstation = downWorkstationMapper.selectdownWorkstationstate();
            if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) {
                //,如果已经绑定则更新已落架数量,并且删除下片任务表中的记录
                for (DownWorkstation downWorkstation : taskdownWorkstation) {
                    //更新下片工位表中已落架数量
                    downWorkstationMapper.update_racks_number(downWorkstation.getFlowCardId(), downWorkstation.getRacksnumber() + 1);
                    //更新机械任务表中状态为0
                    downWorkstationMapper.update_task_state_to_zero(downWorkstation.getFlowCardId());
                    //删除下片任务表中的记录
                    downGlassInfoMapper.deletetask(downWorkstation.getFlowCardId());
                }
            }
        } catch (Exception e) {
            // 打印异常信息
            e.printStackTrace();
            // 或者可以进行其他异常处理,比如记录日志或者返回特定的错误信息
        }
    }
    /**
     * @param downWorkstation // 绑定流程卡号架子
     */
    public void bindingshelf(DownWorkstation downWorkstation) {
        downWorkstationMapper.updateFlowCardId(downWorkstation);
    }
    /**
     * @param downWorkstation // 满架拉走 清除流程卡信息
     */
    public void clearFlowCardId(DownWorkstation downWorkstation) {
        downWorkstationMapper.clearFlowCardId(downWorkstation);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/DownWorkstationService.java
@@ -3,6 +3,9 @@
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.downworkstation.entity.DownWorkstation;
import java.util.List;
import java.util.Map;
/**
 * <p>
 *  服务类
@@ -13,4 +16,15 @@
 */
public interface DownWorkstationService extends IService<DownWorkstation> {
    List<DownWorkstation> getoneDownWorkstations();
    List<DownWorkstation> gettwoDownWorkstations();
    List<Map<String, Object>> getflowCardId();
    int getTotalQuantity(int workstationId);
    int getRacksNumber(int workstationId);
    void clearFlowCardId(int workstationId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/service/impl/DownWorkstationServiceImpl.java
@@ -1,20 +1,50 @@
package com.mes.downworkstation.service.impl;
import com.mes.downworkstation.entity.DownWorkstation;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.mapper.DownWorkstationMapper;
import com.mes.downworkstation.service.DownWorkstationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhoush
 * @since 2024-03-27
 */
import java.util.List;
import java.util.Map;
@Service
public class DownWorkstationServiceImpl extends ServiceImpl<DownWorkstationMapper, DownWorkstation> implements DownWorkstationService {
    @Autowired
    private DownWorkstationMapper downWorkstationMapper;
    @Override
    public List<DownWorkstation> getoneDownWorkstations() {
        return downWorkstationMapper.getoneDownWorkstations();
    }
    @Override
    public List<DownWorkstation> gettwoDownWorkstations() {
        return downWorkstationMapper.gettwoDownWorkstations();
    }
    @Override
    public List<Map<String, Object>> getflowCardId() {
        return downWorkstationMapper.getflowCardId();
    }
    @Override
    public int getTotalQuantity(int workstationId) {
        Integer totalQuantity = downWorkstationMapper.getTotalQuantity(workstationId);
        return totalQuantity != null ? totalQuantity : 0;
    }
    @Override
    public int getRacksNumber(int workstationId) {
        Integer racksNumber = downWorkstationMapper.getRacksNumber(workstationId);
        return racksNumber != null ? racksNumber : 0;
    }
    @Override
    public void clearFlowCardId(int workstationId) {
        downWorkstationMapper.clearFlowCardInfoByWorkstationId(workstationId);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/Configuration.java
New file
@@ -0,0 +1,48 @@
package com.mes.tools;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
 * @author SNG-012
 *
 *  Configuration 类用于加载配置文件并提供访问配置项的方法。
 */
public class Configuration {
    /**
     * // Properties 对象,用于存储配置文件中的键值对。
     */
    private Properties properties;
    /**
     * @param fileName
     * @throws IOException
     *     // 构造函数,根据传入的文件名加载配置文件。
     */
    public Configuration(String fileName) throws IOException {
        // 使用类加载器获取资源文件的输入流。
        InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
        // 如果输入流为null,表示未找到文件,抛出FileNotFoundException。
        if (inputStream == null) {
            throw new FileNotFoundException("Property file '" + fileName + "' not found in the classpath");
        }
        // 实例化Properties对象。
        properties = new Properties();
        // 从输入流加载配置项。
        properties.load(inputStream);
    }
    /**
     * @param key
     * @return
     *     // 根据配置项的键获取其对应的值。
     */
    public String getProperty(String key) {
        return properties.getProperty(key);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/ExcelToJsonConverter.java
New file
@@ -0,0 +1,108 @@
package com.mes.tools;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileInputStream;
import java.io.FileWriter;
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 = "src/main/resources/JsonFile/alarm.xlsx";
        String sheetName = "Sheet1";
        int addressColumnIndex = 0;
        int nameColumnIndex = 1;
        //int unitColumnIndex = 2;
        String outputFilePath = "src/main/resources/JsonFile/PlcAlarm.json";
        try (Workbook workbook = new XSSFWorkbook(new FileInputStream(excelFilePath))) {
            Sheet sheet = workbook.getSheet(sheetName);
            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 的和
            int addressIndex = 0; // 自增的地址索引
            while (rowIterator.hasNext()) {
                Row row = rowIterator.next();
                Cell nameCell = row.getCell(nameColumnIndex);
                Cell addressCell = row.getCell(addressColumnIndex);
              //  Cell unitCell = row.getCell(unitColumnIndex);
                String name = nameCell.getStringCellValue();
                String address = addressCell.getStringCellValue();
               // String unit = unitCell.getStringCellValue();
              //  String addressIndex = extractAddressIndex(address);
                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);
                addressIndex++;
            }
            LinkedHashMap<String, Object> resultObject = new LinkedHashMap<>();
            resultObject.put("plcAddressBegin", "DB100.0");
            resultObject.put("plcAddressLenght", String.valueOf(plcAddressLength));
           // resultObject.put("dataType", "word");
            resultObject.put("dataType", "bit");
            resultObject.put("parameteInfor", jsonList);
            Gson gson = new Gson();
            String jsonOutput = gson.toJson(resultObject);
            try (FileWriter fileWriter = new FileWriter(outputFilePath)) {
                fileWriter.write(jsonOutput);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    private static String extractAddressIndex(String address) {
        // Assuming the address format is "DB103.DBW0" or "DB103.DBB100~DBB113"
        if (address.startsWith("DB") && address.contains(".DBW")) {
            int startIndex = address.indexOf(".DBW") + 4;
            int endIndex = address.length();
            return address.substring(startIndex, endIndex);
        } else if (address.startsWith("DB") && address.contains(".DBB")) {
            int startIndex2 = address.indexOf(".DBB") + 4;
            int endIndex2 = address.indexOf("~");
            return address.substring(startIndex2, endIndex2);
        }
        return "";
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/InitUtil.java
New file
@@ -0,0 +1,128 @@
package com.mes.tools;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.mes.device.PlcBitInfo;
import com.mes.device.PlcBitObject;
import com.mes.device.PlcParameterInfo;
import com.mes.device.PlcParameterObject;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class InitUtil {
    //初始化word
    public static PlcParameterObject initword(String jsonFilePath) {
        try {
            FileReader fileReader = new FileReader(jsonFilePath);
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            StringBuilder content = new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                content.append(line);
            }
            bufferedReader.close();
            fileReader.close();
            JSONObject jsonfileobj = new JSONObject(content.toString());
            JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor");
            PlcParameterObject plcParameterObject = new PlcParameterObject();
            plcParameterObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址
            plcParameterObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject parameterObj = jsonArray.getJSONObject(i);
                PlcParameterInfo plcParameterInfo = new PlcParameterInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例
                String codeid = parameterObj.getStr("codeId");
                plcParameterInfo.setCodeId(codeid);
                plcParameterInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex")));
                //plcParameterInfo.setRatio(Integer.valueOf(parameterObj.getStr("ratio")));
                plcParameterInfo.setAddressLength(Integer.valueOf(parameterObj.getStr("addressLenght")));
                plcParameterInfo.setUnit(parameterObj.getStr("unit"));
                plcParameterObject.addPlcParameter(plcParameterInfo);
            }
           // byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02};
           // byte[] getplcvlues = S7control.getinstance().ReadByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
           // plcParameterObject.setPlcParameterList(getplcvlues);
            return plcParameterObject;
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    //初始化bit
    public static PlcBitObject initbit(String jsonFilePath) {
        PlcBitObject plcBitObject = new PlcBitObject();
        try {
            FileReader fileReader = new FileReader(jsonFilePath);
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            StringBuilder content = new StringBuilder();
            String line;
            while ((line = bufferedReader.readLine()) != null) {
                content.append(line);
            }
            bufferedReader.close();
            fileReader.close();
            JSONObject jsonfileobj = new JSONObject(content.toString());
            JSONArray jsonArray = jsonfileobj.getJSONArray("parameteInfor");
            plcBitObject.setPlcAddressBegin(jsonfileobj.getStr("plcAddressBegin"));//设置起始位地址
            plcBitObject.setPlcAddressLength(Integer.valueOf(jsonfileobj.getStr("plcAddressLenght")));//设置地址长度
            for (int i = 0; i < jsonArray.size(); i++) {
                JSONObject parameterObj = jsonArray.getJSONObject(i);
                PlcBitInfo plcBitInfo = new PlcBitInfo(jsonfileobj.getStr("plcAddressBegin")); //参数实例
                String codeid = parameterObj.getStr("codeId");
                plcBitInfo.setCodeId(codeid);
                plcBitInfo.setAddressIndex(Integer.valueOf(parameterObj.getStr("addressIndex")));
                plcBitObject.addPlcBit(plcBitInfo);
            }
            System.out.println("");
        } catch (IOException e) {
            e.printStackTrace();
        }
           //Boolean[] values1 = { false, true, true, true, false, false, true, false,
          //  false, true ,true };
   // List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1));
//        List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength());
//        plcBitObject.setPlcBitList(getplcvlues);
        return plcBitObject;
    }
//
    public static void readAndUpdateBitValues(PlcBitObject plcBitObject) {
        Boolean[] values1 = { false, true, true, true, false, false, true, false,
          false, true ,true };
         List<Boolean> getplcvlues = new ArrayList<>(Arrays.asList(values1));
        //List<Boolean> getplcvlues = S7control.getinstance().ReadBits(plcBitObject.getPlcAddressBegin(), plcBitObject.getPlcAddressLength());
        plcBitObject.setPlcBitList(getplcvlues);
    }
    public static void readAndUpdateWordValues(PlcParameterObject plcParameterObject) {
         byte[] getplcvlues = {0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03, 0x04,0x01, 0x02, 0x03,0x03};
       // byte[] getplcvlues = MockS7PLC.getInstance().readByte(plcParameterObject.getPlcAddressBegin(), plcParameterObject.getPlcAddressLength());
        plcParameterObject.setPlcParameterList(getplcvlues);
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/TokenTools.java
New file
@@ -0,0 +1,21 @@
package com.mes.tools;
import cn.hutool.core.date.DateUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import java.util.Date;
public class TokenTools {
    /**
     * 生成token
     * @return
     */
    public  static String getToken(String userid,String sign){
        return JWT.create().withAudience(userid) // 将 user id 保存到 token 里面,作为载荷
                .withExpiresAt(DateUtil.offsetHour(new Date(), 24)) // 2小时后token过期
                .sign(Algorithm.HMAC256(sign)); // 以 password 作为 token 的密钥
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/tools/WebSocketServer.java
New file
@@ -0,0 +1,164 @@
package com.mes.tools;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.stereotype.Component;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ServerEndpoint(value = "/api/talk/{username}")
@Component("webSocketServer")
public class WebSocketServer {
    // @Autowired
    // HomeMapper homeMapper;
    public static ConfigurableApplicationContext applicationContext;
    // 解决无法注入mapper问题 //使用方法
    // homeMapper=WebSocketServer.applicationContext.getBean(HomeMapper.class);
    public static void setApplicationContext(ConfigurableApplicationContext configurableApplicationContext) {
        WebSocketServer.applicationContext = configurableApplicationContext;
    }
    private static final Logger log = LoggerFactory.getLogger(WebSocketServer.class);
    private List<String> messages;
    /**
     * 记录当前在线连接数
     */
    public static final Map<String, ArrayList<WebSocketServer>> sessionMap = new ConcurrentHashMap<>();
    String username;
    Session session;
    public WebSocketServer() {
        this.messages = new ArrayList<>();
    }
    /**
     * 连接建立成功调用的方法
     */
    @OnOpen
    public void onOpen(Session session, @PathParam("username") String username) {
        this.username = username;
        this.session = session;
        List<WebSocketServer> webSocketServers = sessionMap.get(username);
        if (webSocketServers == null) {
            ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
            arrayListwebserver.add(this);
            sessionMap.put(username, arrayListwebserver);
        } else {
            webSocketServers.add(this);
        }
        log.info("有新用户加入,username={}, 当前在线人数为:{}", username, sessionMap.get(username).size());
        // JSONObject result = new JSONObject();
        // JSONArray array = new JSONArray();
        // result.set("users", array);
        // for (Object key : sessionMap.keySet()) {
        // JSONObject jsonObject = new JSONObject();
        // jsonObject.set("username", key);
        // array.add(jsonObject);
        // }
        // sendAllMessage(JSONUtil.toJsonStr(result)); // 后台发送消息给所有的客户端
    }
    /**
     * 连接关闭调用的方法
     */
    @OnClose
    public void onClose(Session session, @PathParam("username") String username) {
        List<WebSocketServer> webSocketServers = sessionMap.get(username);
        ArrayList<WebSocketServer> arrayListwebserver = new ArrayList<WebSocketServer>();
        if (webSocketServers.size()>1) {
            for (WebSocketServer webSocketServer : webSocketServers) {
                if(webSocketServer!=this){
                    arrayListwebserver.add(webSocketServer);
                }
            }
            sessionMap.put(username, arrayListwebserver);
            log.info("移除username={}一名用户session, {}的当前在线人数为:{}", username, username, sessionMap.get(username).size());
        }else{
            sessionMap.remove(username);
            log.info("移除username={}一名用户session, {}连接关闭, 当前连接数为:{}", username, username, sessionMap.size());
        }
    }
    /**
     * 收到客户端消息后调用的方法
     * 后台收到客户端发送过来的消息
     * onMessage 是一个消息的中转站
     * 接受 浏览器端 socket.send 发送过来的 json数据
     *
     * @param message 客户端发送过来的消息
     */
    @OnMessage
    public void onMessage(String message, Session session, @PathParam("username") String username) {
        log.info("服务端收到用户username={}的消息:{}", username, message);
        JSONObject obj = JSONUtil.parseObj(message);
        String text = obj.getStr("data");
        JSONObject jsonObject = new JSONObject();
        jsonObject.set("message", text);
        this.messages.add(text);
        this.sendMessage(jsonObject.toString()); // JSONUtil.toJsonStr(jsonObject)
    }
    @OnError
    public void onError(Session session, Throwable error) {
        log.error("发生错误");
        error.printStackTrace();
    }
    /**
     * 服务端发送消息给客户端
     */
    public void sendMessage(String message) {
        try {
            // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message);
            this.session.getBasicRemote().sendText(message);
        } catch (Exception e) {
            log.error("服务端发送消息给客户端失败", e);
        }
    }
    // /**
    //  * 服务端发送消息给所有客户端
    //  */
    // public void sendAllMessage(String message) {
    //     try {
    //         for (WebSocketServer webSocketServer : sessionMap.values()) {
    //             // log.info("服务端给客户端[{}]发送消息{}", this.session.getId(), message);
    //             webSocketServer.sendMessage(message);
    //         }
    //     } catch (Exception e) {
    //         log.error("服务端发送消息给客户端失败", e);
    //     }
    // }
    public List<String> getMessages() {
        return messages;
    }
    public void clearMessages() {
        messages.clear();
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/mapper/GlassInfoMapper.java
@@ -1,7 +1,14 @@
package com.mes.uppattenusage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.downglassinfo.entity.DownGlassInfo;
import com.mes.uppattenusage.entity.GlassInfo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
 * <p>
@@ -13,4 +20,11 @@
 */
public interface GlassInfoMapper extends BaseMapper<GlassInfo> {
    @Select("SELECT COUNT(*) FROM glass_info WHERE flowcard_id = #{flowCardId}")
    int getGlassInfoCountByFlowCardId(@Param("flowCardId") String flowCardId);
    @Update("UPDATE down_workstation SET  total_quantity = #{glassInfoCount},flow_card_id=#{flowCardId} WHERE workstation_id = #{workstationId}")
    int updateFlowCardIdAndCount(@Param("flowCardId") String flowCardId, @Param("glassInfoCount") int glassInfoCount,@Param("workstationId")int workstationId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/service/GlassInfoService.java
@@ -13,4 +13,7 @@
 */
public interface GlassInfoService extends IService<GlassInfo> {
    int getGlassInfoCountByFlowCardId(String flowCardId);
    void updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId);
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/uppattenusage/service/impl/GlassInfoServiceImpl.java
@@ -4,6 +4,7 @@
import com.mes.uppattenusage.entity.GlassInfo;
import com.mes.uppattenusage.mapper.GlassInfoMapper;
import com.mes.uppattenusage.service.GlassInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@@ -17,4 +18,25 @@
@Service
public class GlassInfoServiceImpl extends ServiceImpl<GlassInfoMapper, GlassInfo> implements GlassInfoService {
    private GlassInfoMapper glassInfoMapper;
    @Autowired
    public GlassInfoServiceImpl(GlassInfoMapper glassInfoMapper) {
        this.glassInfoMapper = glassInfoMapper;
    }
    @Override
    public int getGlassInfoCountByFlowCardId(String flowCardId) {
        return glassInfoMapper.getGlassInfoCountByFlowCardId(flowCardId);
    }
    @Override
    public void updateFlowCardIdAndCount(String flowCardId, int glassInfoCount, int workstationId) {
        int rowsAffected = glassInfoMapper.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId);
        if (rowsAffected > 0) {
            System.out.println("更新架子上流程卡 ID 和数量成功");
        } else {
            System.out.println("更新架子上流程卡 ID 和数量失败");
        }
    }
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcAlarm.json
New file
@@ -0,0 +1,371 @@
{
  "plcAddressBegin": "DB104.0.0",
  "plcAddressLenght": "91",
  "dataType": "bit",
  "parameteInfor": [
    {
      "codeId": "D01VFDerror",
      "addressIndex": 0
    },
    {
      "codeId": "D02VFDerror",
      "addressIndex": 1
    },
    {
      "codeId": "D03VFDerror",
      "addressIndex": 2
    },
    {
      "codeId": "D04VFDerror",
      "addressIndex": 3
    },
    {
      "codeId": "D05VFDerror",
      "addressIndex": 4
    },
    {
      "codeId": "D06VFDerror",
      "addressIndex": 5
    },
    {
      "codeId": "B01VFDerror",
      "addressIndex": 6
    },
    {
      "codeId": "B02VFDerror",
      "addressIndex": 7
    },
    {
      "codeId": "A01VFDerror",
      "addressIndex": 8
    },
    {
      "codeId": "A02VFDerror",
      "addressIndex": 9
    },
    {
      "codeId": "A01servoturnerror",
      "addressIndex": 10
    },
    {
      "codeId": "A02servoturnerror",
      "addressIndex": 11
    },
    {
      "codeId": "A01servotravelerror",
      "addressIndex": 12
    },
    {
      "codeId": "A02servotravelerror",
      "addressIndex": 13
    },
    {
      "codeId": "B01servotravelerror",
      "addressIndex": 14
    },
    {
      "codeId": "B02servotravelerror",
      "addressIndex": 15
    },
    {
      "codeId": "D01DECerror",
      "addressIndex": 16
    },
    {
      "codeId": "D01poserror",
      "addressIndex": 17
    },
    {
      "codeId": "D02DECerror",
      "addressIndex": 18
    },
    {
      "codeId": "D02poserror",
      "addressIndex": 19
    },
    {
      "codeId": "D03DECerror",
      "addressIndex": 20
    },
    {
      "codeId": "D03poserror",
      "addressIndex": 21
    },
    {
      "codeId": "D04DECerror",
      "addressIndex": 22
    },
    {
      "codeId": "D04poserror",
      "addressIndex": 23
    },
    {
      "codeId": "D05DECerror",
      "addressIndex": 24
    },
    {
      "codeId": "D05poserror",
      "addressIndex": 25
    },
    {
      "codeId": "D06DECerror",
      "addressIndex": 26
    },
    {
      "codeId": "D06poserror",
      "addressIndex": 27
    },
    {
      "codeId": "A01DECerror",
      "addressIndex": 28
    },
    {
      "codeId": "A01poserror",
      "addressIndex": 29
    },
    {
      "codeId": "A02DECerror",
      "addressIndex": 30
    },
    {
      "codeId": "A02poserror",
      "addressIndex": 31
    },
    {
      "codeId": "B01INDECerror",
      "addressIndex": 32
    },
    {
      "codeId": "B01INposerror",
      "addressIndex": 33
    },
    {
      "codeId": "B01OUTDECerror",
      "addressIndex": 34
    },
    {
      "codeId": "B01OUTposerror",
      "addressIndex": 35
    },
    {
      "codeId": "B02INDECerror",
      "addressIndex": 36
    },
    {
      "codeId": "B02INposerror",
      "addressIndex": 37
    },
    {
      "codeId": "B02OUTDECerror",
      "addressIndex": 38
    },
    {
      "codeId": "B02OUTposerror",
      "addressIndex": 39
    },
    {
      "codeId": "D01Scanglassexceedinglimit",
      "addressIndex": 40
    },
    {
      "codeId": "emergencystopalarm",
      "addressIndex": 41
    },
    {
      "codeId": "Moreglassthanknown",
      "addressIndex": 42
    },
    {
      "codeId": "lessglassthanknown",
      "addressIndex": 43
    },
    {
      "codeId": "D01conveyortimeoutalarm",
      "addressIndex": 44
    },
    {
      "codeId": "D02conveyortimeoutalarm",
      "addressIndex": 45
    },
    {
      "codeId": "D03conveyortimeoutalarm",
      "addressIndex": 46
    },
    {
      "codeId": "D04conveyortimeoutalarm",
      "addressIndex": 47
    },
    {
      "codeId": "D05conveyortimeoutalarm",
      "addressIndex": 48
    },
    {
      "codeId": "D06conveyortimeoutalarm",
      "addressIndex": 49
    },
    {
      "codeId": "A01conveyortimeoutalarm",
      "addressIndex": 50
    },
    {
      "codeId": "A02conveyortimeoutalarm",
      "addressIndex": 51
    },
    {
      "codeId": "B01conveyortimeoutalarm",
      "addressIndex": 52
    },
    {
      "codeId": "B02conveyortimeoutalarm",
      "addressIndex": 53
    },
    {
      "codeId": "A01conveyorLeftsafetyalarm",
      "addressIndex": 54
    },
    {
      "codeId": "A01conveyorrightsafetyalarm",
      "addressIndex": 55
    },
    {
      "codeId": "A02conveyorLeftsafetyalarm",
      "addressIndex": 56
    },
    {
      "codeId": "A02conveyorrightsafetyalarm",
      "addressIndex": 57
    },
    {
      "codeId": "1#buffersafetyalarm",
      "addressIndex": 58
    },
    {
      "codeId": "2#buffersafetyalarm",
      "addressIndex": 59
    },
    {
      "codeId": "3#buffersafetyalarm",
      "addressIndex": 60
    },
    {
      "codeId": "4#buffersafetyalarm",
      "addressIndex": 61
    },
    {
      "codeId": "A01.SRrightinposerror",
      "addressIndex": 62
    },
    {
      "codeId": "A02.SRleftinposerror",
      "addressIndex": 63
    },
    {
      "codeId": "B01.SRleftinposerror",
      "addressIndex": 64
    },
    {
      "codeId": "B01.SRleftdecerror",
      "addressIndex": 65
    },
    {
      "codeId": "B01.SRrightdecerror",
      "addressIndex": 66
    },
    {
      "codeId": "B01.SRrightinposerror",
      "addressIndex": 67
    },
    {
      "codeId": "B02.SRleftinposerror",
      "addressIndex": 68
    },
    {
      "codeId": "B02.SRleftdecerror",
      "addressIndex": 69
    },
    {
      "codeId": "B02.SRrightdecerror",
      "addressIndex": 70
    },
    {
      "codeId": "B02.SRrightinposerror",
      "addressIndex": 71
    },
    {
      "codeId": "A01servoturnhomed",
      "addressIndex": 72
    },
    {
      "codeId": "A02servoturnhomed",
      "addressIndex": 73
    },
    {
      "codeId": "A01servotravelhomed",
      "addressIndex": 74
    },
    {
      "codeId": "A02servotravelhomed",
      "addressIndex": 75
    },
    {
      "codeId": "B01servotravelhomed",
      "addressIndex": 76
    },
    {
      "codeId": "B02servotravelhomed",
      "addressIndex": 77
    },
    {
      "codeId": "resetDelay",
      "addressIndex": 78
    },
    {
      "codeId": "A01travelNegativelimit",
      "addressIndex": 79
    },
    {
      "codeId": "A01travelPositivelimit",
      "addressIndex": 80
    },
    {
      "codeId": "A01turnuplimit",
      "addressIndex": 81
    },
    {
      "codeId": "A01turndownlimit",
      "addressIndex": 82
    },
    {
      "codeId": "A02travelNegativelimit",
      "addressIndex": 83
    },
    {
      "codeId": "A02travelPositivelimit",
      "addressIndex": 84
    },
    {
      "codeId": "A02turnuplimit",
      "addressIndex": 85
    },
    {
      "codeId": "A02turndownlimit",
      "addressIndex": 86
    },
    {
      "codeId": "B01travelNegativelimit",
      "addressIndex": 87
    },
    {
      "codeId": "B01travelPositivelimit",
      "addressIndex": 88
    },
    {
      "codeId": "B02travelNegativelimit",
      "addressIndex": 89
    },
    {
      "codeId": "B02travelPositivelimit",
      "addressIndex": 90
    }
  ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcMes.json
New file
@@ -0,0 +1,50 @@
{
   "plcAddressBegin":"DB105.0",
   "plcAddressLenght":"12",
   "dataType":"word",
   "parameteInfor":[
      {
         "codeId": "OutActivate",
         "addressIndex":"0",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
          "codeId": "Addgoal",
          "addressIndex":"2",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "AddLength",
          "addressIndex":"4",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "AddWidth",
          "addressIndex":"6",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "AddCount",
          "addressIndex":"8",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "OutStart",
          "addressIndex":"10",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       }
   ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcParameter.json
New file
@@ -0,0 +1,610 @@
{
   "plcAddressBegin":"DB100.0",
   "plcAddressLenght":"198",
   "dataType":"word",
   "parameteInfor":[
      {
         "codeId": "conveyorVelocity(Max)",
         "addressIndex":"0",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
          "codeId": "conveyorVelocity(AutoFAST)",
          "addressIndex":"2",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "conveyorVelocity(AutoSLOW)",
          "addressIndex":"4",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "conveyorVelocity(Manual)",
          "addressIndex":"6",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "A01A02TURNJOGVelocity",
          "addressIndex":"8",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "A01A02TRAVELJOGVelocity",
          "addressIndex":"10",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "B01B02TRAVELJOGVelocity",
          "addressIndex":"12",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "A01A02TURNPOSVelocityAUTO",
          "addressIndex":"14",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "A01TURNPOSVelocitymanual",
          "addressIndex":"16",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
         "codeId": "A01A02TRAVELPOSVelocityAUTO",
         "addressIndex":"18",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"mm/S"
      },
     {
       "codeId": "A01TRAVELPOSVelocitymanual",
       "addressIndex":"20",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm/S"
     },
     {
       "codeId": "B01B02TRAVELPOSVelocityAUTO",
       "addressIndex":"22",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm/S"
     },
     {
       "codeId": "B01TRAVELPOSVelocitymanual",
       "addressIndex":"24",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm/S"
     },
     {
       "codeId": "A01A02conveyorVelocity(Max)",
       "addressIndex":"26",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "A01A02conveyorVelocity(AutoFAST)",
       "addressIndex":"28",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "A01A02conveyorVelocity(AutoSLOW)",
       "addressIndex":"30",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "B01B02conveyorVelocity(Manual)",
       "addressIndex":"32",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "B01B02conveyorVelocity(Max)",
       "addressIndex":"34",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "B01B02conveyorVelocity(AutoFAST)",
       "addressIndex":"36",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "B01B02conveyorVelocity(AutoSLOW)",
       "addressIndex":"38",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "B01B02conveyorVelocity(Manual)",
       "addressIndex":"40",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"m/min"
     },
     {
       "codeId": "gridspacing",
       "addressIndex":"42",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01Spliceaddresssetting",
       "addressIndex":"44",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02Spliceaddresssetting",
       "addressIndex":"46",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A011#gridaddress",
       "addressIndex":"48",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0122#gridaddress",
       "addressIndex":"50",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0143#gridaddress",
       "addressIndex":"52",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0164#gridaddress",
       "addressIndex":"54",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0185#gridaddress",
       "addressIndex":"56",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01106#gridaddress",
       "addressIndex":"58",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01127#gridaddress",
       "addressIndex":"60",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01148#gridaddress",
       "addressIndex":"62",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01169#gridaddress",
       "addressIndex":"64",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01190#gridaddress",
       "addressIndex":"66",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A021#gridaddress",
       "addressIndex":"68",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0222#gridaddress",
       "addressIndex":"70",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0243#gridaddress",
       "addressIndex":"72",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0264#gridaddress",
       "addressIndex":"74",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A0285#gridaddress",
       "addressIndex":"76",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02106#gridaddress",
       "addressIndex":"78",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02127#gridaddress",
       "addressIndex":"80",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02148#gridaddress",
       "addressIndex":"82",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02169#gridaddress",
       "addressIndex":"84",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A02190#gridaddress",
       "addressIndex":"86",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B011#gridaddress",
       "addressIndex":"88",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B0122#gridaddress",
       "addressIndex":"90",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B0143#gridaddress",
       "addressIndex":"92",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B0164#gridaddress",
       "addressIndex":"94",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B0185#gridaddress",
       "addressIndex":"96",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B02106#gridaddress",
       "addressIndex":"98",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B02127#gridaddress",
       "addressIndex":"100",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B02148#gridaddress",
       "addressIndex":"102",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B02169#gridaddress",
       "addressIndex":"104",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "B02190#gridaddress",
       "addressIndex":"106",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"mm"
     },
     {
       "codeId": "A01Targetgrid(Manual)",
       "addressIndex":"108",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": " A02Targetgrid(Manual)",
       "addressIndex":"110",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "B01Targetgrid(Manual)",
       "addressIndex":"112",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "B02Targetgrid(Manual)",
       "addressIndex":"114",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "A01turnTargetAngle(Manual)",
       "addressIndex":"116",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A02turnTargetAngle(Manual)",
       "addressIndex":"118",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A01turnAngle1",
       "addressIndex":"120",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A01turnAngle2",
       "addressIndex":"122",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A01turnAngle3",
       "addressIndex":"124",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A01turnAngle4",
       "addressIndex":"126",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A02turnAngle1",
       "addressIndex":"128",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A02turnAngle2",
       "addressIndex":"130",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A02turnAngle3",
       "addressIndex":"132",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "A02turnAngle4",
       "addressIndex":"134",
       "addressLenght":"2",
       "ratio":"1",
       "unit":"°"
     },
     {
       "codeId": "Minimumglasslength",
       "addressIndex":"136",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Minimumglassheight",
       "addressIndex":"138",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Maximumglasslength",
       "addressIndex":"140",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Maximumglassheight",
       "addressIndex":"142",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "A01cellsGlassNum",
       "addressIndex":"144",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "A02cellsGlassNum",
       "addressIndex":"146",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "A01ID",
       "addressIndex":"148",
       "addressLenght":"14",
       "ratio":"1"
     },
     {
       "codeId": "A02ID",
       "addressIndex":"162",
       "addressLenght":"14",
       "ratio":"1"
     },
     {
       "codeId": "A02TRAVELPOSVelocitymanual",
       "addressIndex":"176",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "B02TRAVELPOSVelocitymanual",
       "addressIndex":"178",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Startingpositionofthefeedca",
       "addressIndex":"180",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Targetpositionofthefeedcar",
       "addressIndex":"182",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Lengthofincomingglass",
       "addressIndex":"184",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Widthofincomingglass",
       "addressIndex":"186",
       "addressLenght":"2",
       "ratio":"1"
     },
     {
       "codeId": "Startingpositionoftheexitcar",
       "addressIndex":"188",
       "addressLenght":"2",
       "ratio":"1"
     }, {
       "codeId": "Exitcartargetposition",
       "addressIndex":"190",
       "addressLenght":"2",
       "ratio":"1"
     }
     , {
       "codeId": "A02TURNPOSVelocitymanual",
       "addressIndex":"192",
       "addressLenght":"2",
       "ratio":"1"
     }
     , {
       "codeId": "A01delayTime",
       "addressIndex":"194",
       "addressLenght":"2",
       "ratio":"1"
     }
   ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcRead.json
New file
@@ -0,0 +1,195 @@
{
   "plcAddressBegin": "DB106.0",
   "plcAddressLenght": "66",
   "dataType": "word",
   "parameteInfor": [{
         "codeId": "A01Position",
         "addressIndex": "0",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A01FlipPosition",
         "addressIndex": "2",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A01QuestStartPosition",
         "addressIndex": "4",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A01EndPosition",
         "addressIndex": "6",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "FeedCarStatus",
         "addressIndex": "8",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02QuestOver",
         "addressIndex": "10",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02Position",
         "addressIndex": "12",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02FlipPosition",
         "addressIndex": "14",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02QuestStartPosition",
         "addressIndex": "16",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02EndPosition",
         "addressIndex": "18",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "ExitCarStatus",
         "addressIndex": "20",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "A02QuestOver",
         "addressIndex": "22",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "FeedRequest",
         "addressIndex": "24",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "FeedID",
         "addressIndex": "26",
         "addressLenght":"14",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01Position",
         "addressIndex": "40",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01QuestPosition",
         "addressIndex": "42",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01CurrentTaskMode",
         "addressIndex": "44",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01CarStatus",
         "addressIndex": "46",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01CarTaskStatus",
         "addressIndex": "48",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02Position",
         "addressIndex": "50",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02CarCurrentTask",
         "addressIndex": "52",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02CurrentTaskMode",
         "addressIndex": "54",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02CarStatus",
         "addressIndex": "56",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02CarSaskStatus",
         "addressIndex": "58",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B01CompleteTheReport",
         "addressIndex": "60",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "B02CompleteTheReport",
         "addressIndex": "62",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      },
      {
         "codeId": "OutRequest",
         "addressIndex": "64",
         "addressLenght":"2",
         "ratio":"1",
         "unit":"m/min"
      }
   ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcSign.json
New file
@@ -0,0 +1,460 @@
{
  "plcAddressBegin": "DB102.0.0",
  "plcAddressLenght": "112",
  "dataType": "bit",
  "parameteInfor": [
    {
      "codeId": "D01.SRdec",
      "addressIndex": 0
    },
    {
      "codeId": "D01.SRinpos",
      "addressIndex": 1
    },
    {
      "codeId": "D02.SRdec",
      "addressIndex": 2
    },
    {
      "codeId": "D02.SRinpos",
      "addressIndex": 3
    },
    {
      "codeId": "D03.SRinto",
      "addressIndex": 4
    },
    {
      "codeId": "D03.SRdec",
      "addressIndex": 5
    },
    {
      "codeId": "D03.SRinpos",
      "addressIndex": 6
    },
    {
      "codeId": "D04.SRdec",
      "addressIndex": 7
    },
    {
      "codeId": "D04.SRinpos",
      "addressIndex": 8
    },
    {
      "codeId": "D05.SRdec",
      "addressIndex": 9
    },
    {
      "codeId": "D05.SRinpos",
      "addressIndex": 10
    },
    {
      "codeId": "D06.SRdec",
      "addressIndex": 11
    },
    {
      "codeId": "D06.SRinpos",
      "addressIndex": 12
    },
    {
      "codeId": "B01.SRindec",
      "addressIndex": 13
    },
    {
      "codeId": "B01.SRininpos",
      "addressIndex": 14
    },
    {
      "codeId": "B01.SRoutdec",
      "addressIndex": 15
    },
    {
      "codeId": "B01.SRoutinpos",
      "addressIndex": 16
    },
    {
      "codeId": "B01.SRturnon",
      "addressIndex": 17
    },
    {
      "codeId": "B01.SRturnoff",
      "addressIndex": 18
    },
    {
      "codeId": "B01.SRup",
      "addressIndex": 19
    },
    {
      "codeId": "B01.SRdown",
      "addressIndex": 20
    },
    {
      "codeId": "B02.SRoutdec",
      "addressIndex": 21
    },
    {
      "codeId": "B02.SRoutinpos",
      "addressIndex": 22
    },
    {
      "codeId": "B02.SRindec",
      "addressIndex": 23
    },
    {
      "codeId": "B02.SRininpos",
      "addressIndex": 24
    },
    {
      "codeId": "B02.SRturnon",
      "addressIndex": 25
    },
    {
      "codeId": "B02.SRturnoff",
      "addressIndex": 26
    },
    {
      "codeId": "B02.SRup",
      "addressIndex": 27
    },
    {
      "codeId": "B02.SRdown",
      "addressIndex": 28
    },
    {
      "codeId": "B01.SRinsafety",
      "addressIndex": 29
    },
    {
      "codeId": "B01.SRoutsafety",
      "addressIndex": 30
    },
    {
      "codeId": "B02.SRinsafety",
      "addressIndex": 31
    },
    {
      "codeId": "SB.start(+)",
      "addressIndex": 32
    },
    {
      "codeId": "SB.stop(-)",
      "addressIndex": 33
    },
    {
      "codeId": "SB.reset",
      "addressIndex": 34
    },
    {
      "codeId": "SB.auto/manul",
      "addressIndex": 35
    },
    {
      "codeId": "D01.SB.confirm",
      "addressIndex": 36
    },
    {
      "codeId": "SB.emg",
      "addressIndex": 37
    },
    {
      "codeId": "D01.SB.start",
      "addressIndex": 38
    },
    {
      "codeId": "D06.SB.start",
      "addressIndex": 39
    },
    {
      "codeId": "B02.SRoutsafety",
      "addressIndex": 40
    },
    {
      "codeId": "SafetyDoor.requset",
      "addressIndex": 41
    },
    {
      "codeId": "SafetyDoor.confirm",
      "addressIndex": 42
    },
    {
      "codeId": "SafetyDoor.reset",
      "addressIndex": 43
    },
    {
      "codeId": "Sspce",
      "addressIndex": 44
    },
    {
      "codeId": "Sspce",
      "addressIndex": 45
    },
    {
      "codeId": "Sspce",
      "addressIndex": 46
    },
    {
      "codeId": "Sspce",
      "addressIndex": 47
    },
    {
      "codeId": "A01.SRleftdec",
      "addressIndex": 48
    },
    {
      "codeId": "A01.SRleftinpos",
      "addressIndex": 49
    },
    {
      "codeId": "A01.SRleftsafety",
      "addressIndex": 50
    },
    {
      "codeId": "A01.SRrightdec",
      "addressIndex": 51
    },
    {
      "codeId": "A01.SRrightinpos",
      "addressIndex": 52
    },
    {
      "codeId": "A01.SRrightsafety",
      "addressIndex": 53
    },
    {
      "codeId": "A01.SRturnhome",
      "addressIndex": 54
    },
    {
      "codeId": "A01.SRturnup",
      "addressIndex": 55
    },
    {
      "codeId": "A01.SRturndown",
      "addressIndex": 56
    },
    {
      "codeId": "A01.SRtravelhome",
      "addressIndex": 57
    },
    {
      "codeId": "A01.SRtravelleftdec",
      "addressIndex": 58
    },
    {
      "codeId": "A01.SRtravelleftlimit",
      "addressIndex": 59
    },
    {
      "codeId": "A01.SRtravelrightdec",
      "addressIndex": 60
    },
    {
      "codeId": "A01.SRtravelrightlimit",
      "addressIndex": 61
    },
    {
      "codeId": "space",
      "addressIndex": 62
    },
    {
      "codeId": "space",
      "addressIndex": 63
    },
    {
      "codeId": "A02.SRleftdec",
      "addressIndex": 64
    },
    {
      "codeId": "A02.SRleftinpos",
      "addressIndex": 65
    },
    {
      "codeId": "A02.SRleftsafety",
      "addressIndex": 66
    },
    {
      "codeId": "A02.SRrightdec",
      "addressIndex": 67
    },
    {
      "codeId": "A02.SRrightinpos",
      "addressIndex": 68
    },
    {
      "codeId": "A02.SRrightsafety",
      "addressIndex": 69
    },
    {
      "codeId": "A02.SRturnhome",
      "addressIndex": 70
    },
    {
      "codeId": "A02.SRturnup",
      "addressIndex": 71
    },
    {
      "codeId": "A02.SRturndown",
      "addressIndex": 72
    },
    {
      "codeId": "A02.SRtravelhome",
      "addressIndex": 73
    },
    {
      "codeId": "A02.SRtravelleftdec",
      "addressIndex": 74
    },
    {
      "codeId": "A02.SRtravelleftlimit",
      "addressIndex": 75
    },
    {
      "codeId": "A02.SRtravelrightdec",
      "addressIndex": 76
    },
    {
      "codeId": "A02.SRtravelrightlimit",
      "addressIndex": 77
    },
    {
      "codeId": "space",
      "addressIndex": 78
    },
    {
      "codeId": "space",
      "addressIndex": 79
    },
    {
      "codeId": "B01.SRorigin",
      "addressIndex": 80
    },
    {
      "codeId": "B01.SRleftlimit",
      "addressIndex": 81
    },
    {
      "codeId": "B01.SRrightlimit",
      "addressIndex": 82
    },
    {
      "codeId": "B02.SRorigin",
      "addressIndex": 83
    },
    {
      "codeId": "B02.SRleftlimit",
      "addressIndex": 84
    },
    {
      "codeId": "B02.SRrightlimit",
      "addressIndex": 85
    },
    {
      "codeId": "space",
      "addressIndex": 86
    },
    {
      "codeId": "space",
      "addressIndex": 87
    },
    {
      "codeId": "LED.red",
      "addressIndex": 88
    },
    {
      "codeId": "LED.green",
      "addressIndex": 89
    },
    {
      "codeId": "LED.yellow",
      "addressIndex": 90
    },
    {
      "codeId": "D01.LED.green",
      "addressIndex": 91
    },
    {
      "codeId": "D06.LED.green",
      "addressIndex": 92
    },
    {
      "codeId": "B01.YV.turn",
      "addressIndex": 93
    },
    {
      "codeId": "B01.YV.updown",
      "addressIndex": 94
    },
    {
      "codeId": "B01.YV.gassing",
      "addressIndex": 95
    },
    {
      "codeId": "B02.YV.turn",
      "addressIndex": 96
    },
    {
      "codeId": "B02.YV.updown",
      "addressIndex": 97
    },
    {
      "codeId": "B02.YV.gassing",
      "addressIndex": 98
    },
    {
      "codeId": "SafetyDoor.Led",
      "addressIndex": 99
    },
    {
      "codeId": "SafetyDoor.open",
      "addressIndex": 100
    },
    {
      "codeId": "D01SB.confirm",
      "addressIndex": 101
    },
    {
      "codeId": "space",
      "addressIndex": 102
    },
    {
      "codeId": "space",
      "addressIndex": 103
    },
    {
      "codeId": "A01oilPump",
      "addressIndex": 104
    },
    {
      "codeId": "A01motorCtr",
      "addressIndex": 105
    },
    {
      "codeId": "space",
      "addressIndex": 106
    },
    {
      "codeId": "space",
      "addressIndex": 107
    },
    {
      "codeId": "A02oilPump",
      "addressIndex": 108
    },
    {
      "codeId": "A02motorCtr",
      "addressIndex": 109
    },
    {
      "codeId": "space",
      "addressIndex": 110
    },
    {
      "codeId": "space",
      "addressIndex": 111
    }
    ,
    {
      "codeId": "space",
      "addressIndex": 111
    }
  ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcState.json
New file
@@ -0,0 +1,285 @@
{
  "plcAddressBegin": "DB103.0",
  "plcAddressLenght": "258",
  "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": ""
    }
    ,
    {
      "codeId": "Scanningguns",
      "addressIndex": "256",
      "addressLenght": "2",
      "unit": ""
    }
    ,
    {
      "codeId": "Frameid",
      "addressIndex": "270",
      "addressLenght": "2",
      "unit": ""
    }
  ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/PlcTest.json
New file
@@ -0,0 +1,378 @@
{
  "plcAddressBegin": "DB101.0.0",
  "plcAddressLenght": "93",
  "dataType": "bit",
  "parameteInfor": [
    {
      "codeId": "D01VFDconveyor",
      "addressIndex": 0
    },
    {
      "codeId": "D02VFDconveyor",
      "addressIndex": 1
    },
    {
      "codeId": "D03VFDconveyor",
      "addressIndex": 2
    },
    {
      "codeId": "D04VFDconveyor",
      "addressIndex": 3
    },
    {
      "codeId": "D05VFDconveyor",
      "addressIndex": 4
    },
    {
      "codeId": "D06VFDconveyor",
      "addressIndex": 5
    },
    {
      "codeId": "A01VFDconveyor",
      "addressIndex": 6
    },
    {
      "codeId": "A02VFDconveyor",
      "addressIndex": 7
    },
    {
      "codeId": "B01VFDconveyor",
      "addressIndex": 8
    },
    {
      "codeId": "B02VFDconveyor",
      "addressIndex": 9
    },
    {
      "codeId": "A01SERVETURN",
      "addressIndex": 10
    },
    {
      "codeId": "A02SERVETURN",
      "addressIndex": 11
    },
    {
      "codeId": "A01SERVETRAVEL",
      "addressIndex": 12
    },
    {
      "codeId": "A02SERVETRAVEL",
      "addressIndex": 13
    },
    {
      "codeId": "B01SERVETRAVEL",
      "addressIndex": 14
    },
    {
      "codeId": "B02SERVETRAVEL",
      "addressIndex": 15
    },
    {
      "codeId": "A01SERVETURNPOS",
      "addressIndex": 16
    },
    {
      "codeId": "A02SERVETURNPOS",
      "addressIndex": 17
    },
    {
      "codeId": "A01SERVETRAVELPOS",
      "addressIndex": 18
    },
    {
      "codeId": "A02SERVETRAVELPOS",
      "addressIndex": 19
    },
    {
      "codeId": "B01SERVETRAVELPOS",
      "addressIndex": 20
    },
    {
      "codeId": "B02SERVETRAVELPOS",
      "addressIndex": 21
    },
    {
      "codeId": "B01YVTURN",
      "addressIndex": 22
    },
    {
      "codeId": "B01YVUPDOWN",
      "addressIndex": 23
    },
    {
      "codeId": "B02YVTURN",
      "addressIndex": 24
    },
    {
      "codeId": "B02YVUPDOWN",
      "addressIndex": 25
    },
    {
      "codeId": "B01YVGassing",
      "addressIndex": 26
    },
    {
      "codeId": "B02YVGassing",
      "addressIndex": 27
    },
    {
      "codeId": "A01VFDconveyorreverse",
      "addressIndex": 28
    },
    {
      "codeId": "A02VFDconveyorreverse",
      "addressIndex": 29
    },
    {
      "codeId": "A01SERVETURNreset",
      "addressIndex": 30
    },
    {
      "codeId": "A01SERVETURNhome",
      "addressIndex": 31
    },
    {
      "codeId": "A01SERVETRAVELreset",
      "addressIndex": 32
    },
    {
      "codeId": "A02SERVETURNreset",
      "addressIndex": 33
    },
    {
      "codeId": "A02SERVETURNhome",
      "addressIndex": 34
    },
    {
      "codeId": "A02SERVETRAVELreset",
      "addressIndex": 35
    },
    {
      "codeId": "B01SERVETRAVELreset",
      "addressIndex": 36
    },
    {
      "codeId": "B01SERVETRAVELhome",
      "addressIndex": 37
    },
    {
      "codeId": "B02SERVETRAVELreset",
      "addressIndex": 38
    },
    {
      "codeId": "B02SERVETRAVELhome",
      "addressIndex": 39
    },
    {
      "codeId": "Manualstoragestartup",
      "addressIndex": 40
    },
    {
      "codeId": "Manualoutputstartup",
      "addressIndex": 41
    },
    {
      "codeId": "A01oilpump",
      "addressIndex": 42
    },
    {
      "codeId": "A02oilpump",
      "addressIndex": 43
    },
    {
      "codeId": "A01get1#gridaddress",
      "addressIndex": 44
    },
    {
      "codeId": "A01get22#gridaddress",
      "addressIndex": 45
    },
    {
      "codeId": "A01get43#gridaddress",
      "addressIndex": 46
    },
    {
      "codeId": "A01get64#gridaddress",
      "addressIndex": 47
    },
    {
      "codeId": "A01get85#gridaddress",
      "addressIndex": 48
    },
    {
      "codeId": "A01get106#gridaddress",
      "addressIndex": 49
    },
    {
      "codeId": "A01get127#gridaddress",
      "addressIndex": 50
    },
    {
      "codeId": "A01get148#gridaddress",
      "addressIndex": 51
    },
    {
      "codeId": "A01get169#gridaddress",
      "addressIndex": 52
    },
    {
      "codeId": "A02get190#gridaddress",
      "addressIndex": 53
    },
    {
      "codeId": "A02get1#gridaddress",
      "addressIndex": 54
    },
    {
      "codeId": "A02get22#gridaddress",
      "addressIndex": 55
    },
    {
      "codeId": "A02get43#gridaddress",
      "addressIndex": 56
    },
    {
      "codeId": "A02get64#gridaddress",
      "addressIndex": 57
    },
    {
      "codeId": "A02get85#gridaddress",
      "addressIndex": 58
    },
    {
      "codeId": "A02get106#gridaddress",
      "addressIndex": 59
    },
    {
      "codeId": "A02get127#gridaddress",
      "addressIndex": 60
    },
    {
      "codeId": "A02get148#gridaddress",
      "addressIndex": 61
    },
    {
      "codeId": "A02get169#gridaddress",
      "addressIndex": 62
    },
    {
      "codeId": "A02get190#gridaddress",
      "addressIndex": 63
    },
    {
      "codeId": "B01get1#gridaddress",
      "addressIndex": 64
    },
    {
      "codeId": "B01get22#gridaddress",
      "addressIndex": 65
    },
    {
      "codeId": "B01get43#gridaddress",
      "addressIndex": 66
    },
    {
      "codeId": "B01get64#gridaddress",
      "addressIndex": 67
    },
    {
      "codeId": "B01get85#gridaddress",
      "addressIndex": 68
    },
    {
      "codeId": "B02get106#gridaddress",
      "addressIndex": 69
    },
    {
      "codeId": "B02get127#gridaddress",
      "addressIndex": 70
    },
    {
      "codeId": "B02get148#gridaddress",
      "addressIndex": 71
    },
    {
      "codeId": "B02get169#gridaddress",
      "addressIndex": 72
    },
    {
      "codeId": "B02get190#gridaddress",
      "addressIndex": 73
    },
    {
      "codeId": "D01IDClean",
      "addressIndex": 74
    },
    {
      "codeId": "D02IDClean",
      "addressIndex": 75
    },
    {
      "codeId": "D03IDClean",
      "addressIndex": 76
    },
    {
      "codeId": "D04IDClean",
      "addressIndex": 77
    },
    {
      "codeId": "D05IDClean",
      "addressIndex": 78
    },
    {
      "codeId": "D06IDClean",
      "addressIndex": 79
    },
    {
      "codeId": "A01IDClean",
      "addressIndex": 80
    },
    {
      "codeId": "A02IDClean",
      "addressIndex": 81
    },
    {
      "codeId": "B01IDClean",
      "addressIndex": 82
    },
    {
      "codeId": "B02IDClean",
      "addressIndex": 83
    },
    {
      "codeId": "abort/resumeTasks",
      "addressIndex": 84
    },
    {
      "codeId": "A01SERVETRAVELhome",
      "addressIndex": 85
    },
    {
      "codeId": "A02SERVETRAVELhome",
      "addressIndex": 86
    },
    {
      "codeId": "A01A02travelHoming",
      "addressIndex": 87
    },
    {
      "codeId": "A01halfAutoSelect",
      "addressIndex": 88
    },
    {
      "codeId": "A02halfAutoSelect",
      "addressIndex": 89
    },
    {
      "codeId": "A02abortTasks",
      "addressIndex": 90
    },
    {
      "codeId": "emgHMI",
      "addressIndex": 91
    },
    {
      "codeId": "Scanningmethod",
      "addressIndex": 92
  ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/Plcframe.json
New file
@@ -0,0 +1,51 @@
{
   "plcAddressBegin":"DB17.0",
   "plcAddressLenght":"40",
   "dataType":"word",
   "parameteInfor":[
      {
         "codeId": "E01id",
         "addressIndex":"0",
         "addressLenght":"14",
         "ratio":"1",
         "unit":"m/min"
      },
      {
          "codeId": "E01Quest",
          "addressIndex":"16",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "E01Reply",
          "addressIndex":"18",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"m/min"
       },
       {
          "codeId": "J01Quest",
          "addressIndex":"20",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "J01id",
          "addressIndex":"22",
          "addressLenght":"14",
          "ratio":"1",
          "unit":"mm/S"
       },
       {
          "codeId": "J01TurnGo",
          "addressIndex":"38",
          "addressLenght":"2",
          "ratio":"1",
          "unit":"mm/S"
       }
   ]
}
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/alarm.xlsx
Binary files differ
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/sign.xlsx
Binary files differ
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/JsonFile/test.xlsx
Binary files differ
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/application.yml
@@ -3,10 +3,15 @@
spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8&characterEncoding=utf-8&useSSL=false
    username: root
    password: beibo.123/
    dynamic:
      primary: hangzhoumes #设置默认的数据源或者数据源组,默认值即为master
      strict: false #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候回抛出异常,不启动会使用默认数据源.
      datasource:
        hangzhoumes:
          url: jdbc:mysql://10.153.19.150:3306/hangzhoumes?serverTimezone=GMT%2b8
          username: root
          password: beibo.123/
          driver-class-name: com.mysql.cj.jdbc.Driver
  cloud:
    nacos:
      discovery:
@@ -20,5 +25,11 @@
    password: 123456
mybatis-plus:
  mapper-locations: classpath*:mapper/*.xml
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    # 设置 MyBatis 日志级别为 ERROR
logging:
  level:
    com:
      baomidou:
        mybatisplus=ERROR:
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/resources/mapper/DownGlassInfoMapper.xml
New file
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mes.downglassinfo.mapper.DownGlassInfoMapper">
    <select id="selectunloadingtaskstate" resultType="com.mes.downglassinfo.entity.DownGlassInfo">
        SELECT flow_card_id, filmsid, width, height, thickness FROM down_glass_task WHERE task_stauts = 1
    </select>
    <update id="updateTaskStateToZero">
        UPDATE down_glass_task SET task_stauts = 0 WHERE flow_card_id = #{flowCardId}
    </update>
    <select id="getMaxSequenceByFlowCardId" resultType="java.lang.Integer">
        SELECT MAX(sequence) FROM down_glass_info WHERE flow_card_id = #{flowCardId}
    </select>
    <delete id="deletetask">
        DELETE FROM down_glass_task WHERE flow_card_id = #{flowCardId}
    </delete>
</mapper>