瀏覽代碼

fix:机外对刀仪数据采集,推送给机床

wang.sq@aliyun.com 6 月之前
父節點
當前提交
ef184ab355

+ 32 - 0
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java

@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.zuihou.base.request.PageParams;
+import com.github.zuihou.business.cutterdata.service.CutterTestDataService;
 import com.github.zuihou.business.edgeLibrary.service.StockInfoService;
 import com.github.zuihou.business.edgeLibrary.service.impl.StockInfoServiceImpl;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
@@ -41,6 +42,7 @@ import com.google.common.collect.Maps;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.ExpiredJwtException;
 import io.jsonwebtoken.Jwts;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,6 +63,7 @@ import java.util.stream.Collectors;
 
 
 @Component
+@Slf4j
 public class DashboardJob {
 
     @Autowired
@@ -99,8 +102,37 @@ public class DashboardJob {
     @Value("${zuihou.database.tenantDatabasePrefix}")
     private String database;
 
+    @Autowired
+    private CutterTestDataService cutterTestDataService;
+
     private static Logger logger = LoggerFactory.getLogger(DashboardJob.class);
 
+    /**
+     * 获取机外对刀仪数据信息
+     * @throws Exception
+     */
+    @Scheduled(cron="0/30 * * * * ? ")
+    public void setCutterTestData() throws Exception {
+        BaseContextHandler.setTenant("0000");
+        String cutterTestData = cutterTestDataService.findCutterTestData();
+        log.info("获取机外对刀仪数据:"+cutterTestData);
+
+    }
+
+    /**
+     *
+     * @throws Exception
+     */
+    @Scheduled(cron="0/3 * * * * ? ")
+    public void pushPushToMachine() throws Exception {
+        BaseContextHandler.setTenant("0000");
+        String cutterTestData = cutterTestDataService.pushPushToMachine();
+        log.info("推送数据给机床:"+cutterTestData);
+
+    }
+
+
+
     @Scheduled(cron="0 0/1 * * * ?")
     public void updateDashboardJob(){
         //taskService.pushTask();

+ 5 - 1
imcs-admin-boot/imcs-authority-server/src/main/resources/application-test.yml

@@ -59,4 +59,8 @@ zuihou:
         base-path: /api/file
 mybatis-plus:
   configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+cutter-shared: # 机外对刀仪数据采集
+  #file-path: Z:\Program Files (x86)\Parlec\P7
+  file-path: C:\Users\Lenovo\Desktop\temp
+  file-ip: 192.168.0.116

+ 6 - 0
imcs-admin-boot/imcs-business-biz/pom.xml

@@ -145,6 +145,12 @@
             <version>b.2.5-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
+        <!-- XML处理库 -->
+        <dependency>
+            <groupId>org.dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>2.1.3</version>
+        </dependency>
     </dependencies>
 
 

+ 27 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/cutterdata/dao/CutterTestDataMapper.java

@@ -0,0 +1,27 @@
+package com.github.zuihou.business.cutterdata.dao;
+
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Constants;
+import com.github.zuihou.base.mapper.SuperMapper;
+import com.github.zuihou.business.classSchedule.entity.AuthUser;
+import com.github.zuihou.business.cutterdata.dto.CutterTestDataDto;
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
+import com.github.zuihou.business.productionReadyCenter.entity.BBom;
+import com.github.zuihou.database.mybatis.auth.DataScope;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.tenant.entity.Brand;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+@Repository
+public interface CutterTestDataMapper extends SuperMapper<CutterTestDataEntity> {
+
+    boolean deleteCutterTestByT(List<String> cutterTs);
+
+
+    IPage<CutterTestDataEntity> pageList(IPage page, @Param(Constants.WRAPPER) Wrapper<CutterTestDataEntity> queryWrapper);
+
+}

+ 35 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/cutterdata/service/CutterTestDataService.java

@@ -0,0 +1,35 @@
+package com.github.zuihou.business.cutterdata.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.service.SuperService;
+import com.github.zuihou.business.cutterdata.dto.CutterTestDataDto;
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
+import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.net.UnknownHostException;
+import java.util.List;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.cutterdata
+ * @Author: Lenovo
+ * @Time: 2024 - 11 - 21 15 : 06
+ * @Description:
+ */
+
+
+
+public interface CutterTestDataService extends SuperService<CutterTestDataEntity> {
+
+    String findCutterTestData() throws Exception;
+    String pushPushToMachine() throws Exception;
+
+    IPage<CutterTestDataEntity> pageList(IPage page, LbqWrapper<CutterTestDataEntity> wrapper);
+
+
+
+
+}

+ 231 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/cutterdata/service/impl/CutterTestDataServiceImpl.java

@@ -0,0 +1,231 @@
+package com.github.zuihou.business.cutterdata.service.impl;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.service.SuperServiceImpl;
+import com.github.zuihou.business.classSchedule.entity.AuthUser;
+import com.github.zuihou.business.cutterdata.dao.CutterTestDataMapper;
+import com.github.zuihou.business.cutterdata.dto.CutterTestDataDto;
+import com.github.zuihou.business.cutterdata.dto.CutterTypeContrastEnum;
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
+import com.github.zuihou.business.cutterdata.service.CutterTestDataService;
+import com.github.zuihou.business.cutterdata.utils.CutterFile;
+import com.github.zuihou.context.BaseContextHandler;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.injection.annonation.InjectionResult;
+import lombok.extern.slf4j.Slf4j;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import java.io.File;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.cutterdata.service
+ * @Author: Lenovo
+ * @Time: 2024 - 11 - 21 15 : 12
+ * @Description: impl
+ */
+
+@Slf4j
+@Service
+public class CutterTestDataServiceImpl extends SuperServiceImpl<CutterTestDataMapper, CutterTestDataEntity> implements CutterTestDataService {
+    //  机外对刀仪共享文件路径
+    @Value("${cutter-shared.file-path}")
+    private String CutterSharedPath;
+
+    @Value("${cutter-shared.file-ip:192.168.0.116}")
+    private String CutterSharedIp;
+
+    @Override
+    public String findCutterTestData() throws Exception {
+        log.info("===================定时获取机外对刀仪数据start===================");
+
+        List<File> needFile = new ArrayList<>();
+
+        // 判断网络通讯是否正常
+//        if (!InetAddress.getByName(CutterSharedIp).isReachable(300)) {
+//            System.out.println("网络不通");
+//        }
+
+        // 获取需要解析的文件
+        CutterFile.findFileS(needFile, new ArrayList<>(), new ArrayList<>(), CutterSharedPath, "test.xml");
+
+        if (needFile.isEmpty()) {
+            return "需要解析的文件为空";
+        }
+
+        List<CutterTestDataEntity> cutterTestDataEntities = new ArrayList<>();
+        List<String> cutterTs = new ArrayList<>();
+
+        for (File file : needFile) {
+            CutterTestDataEntity build = CutterTestDataEntity.builder().filePath(file.getPath()).build();
+            try {
+                SAXReader saxReader = new SAXReader();
+                org.dom4j.Document document = saxReader.read(file);
+                org.dom4j.Element root = document.getRootElement();
+                JSONObject json = CutterFile.findXmlData(root);
+
+                try {
+                    build.setStatus(2);
+                    build.setFilePath(file.getPath());
+                    ZonedDateTime zonedDateTime = ZonedDateTime.parse(json.getJSONObject("ToolList").getString("DateTime"));
+                    build.setFileTime(zonedDateTime.toLocalDateTime().toLocalDate().toString() + " " + zonedDateTime.toLocalDateTime().toLocalTime().toString());
+                    build.setCutterName(json.getJSONObject("ToolList").getJSONObject("Tools").getString("Name"));
+                    build.setCutterT(json.getJSONObject("ToolList").getJSONObject("Tools").getString("PTN"));
+                    build.setCutterTyp(json.getJSONObject("ToolList").getJSONObject("Tools").getString("ToolType"));
+
+                    String substring = json.getJSONObject("ToolList").getJSONObject("Tools").getString("ToolType");
+                    if (CutterTypeContrastEnum.getDncType(substring.substring(0, 1)) == null) { //说明此类型就是主类不是子类
+                        build.setCutterTypDnc(CutterTypeContrastEnum.getDncType(substring) == null ? "99" : CutterTypeContrastEnum.getDncType(substring));
+                        build.setCutterTypSubDnc("99");
+                    } else {
+                        build.setCutterTypDnc(CutterTypeContrastEnum.getDncType(substring.substring(0, 1)));
+                        build.setCutterTypSubDnc(CutterTypeContrastEnum.getDncType(substring));
+                    }
+
+                    Double aDouble = json.getJSONObject("ToolList").getJSONObject("Tools").getJSONObject("Sets").getDouble("Length1");
+                    build.setCutterZl(String.format("%.3f", aDouble));
+
+                    Double aDouble1 = json.getJSONObject("ToolList").getJSONObject("Tools").getJSONObject("Sets").getDouble("Diameter1");
+                    build.setCutterXl(String.format("%.3f", aDouble1));
+                    build.setCutterRs(json.getJSONObject("ToolList").getJSONObject("Tools").getJSONObject("Sets").getString("Radius"));
+
+                    JSONArray jsonArray = json.getJSONObject("ToolList").getJSONObject("Tools").getJSONObject("CustomFields").getJSONArray("Field");
+                    if (!jsonArray.isEmpty()) {
+                        for (int i = 0; i < jsonArray.size(); i++) {
+                            JSONObject jsonObject = jsonArray.getJSONObject(i);
+
+                            if ("TO".equals(jsonObject.getString("Name"))) {
+
+                                build.setCutterTo(jsonObject.getString("Value"));
+
+                            } else if ("ORI".equals(jsonObject.getString("Name"))) {
+
+                                build.setCutterOri(jsonObject.getString("Value"));
+
+                            } else if ("TIME".equals(jsonObject.getString("Name"))) {
+
+                                build.setCutterTime2(jsonObject.getString("Value"));
+
+                            } else if ("OVERTIME".equals(jsonObject.getString("Name"))) {
+
+                                build.setCutterOverTime(jsonObject.getString("Value"));
+
+                            } else if ("PLC".equals(jsonObject.getString("Name"))) {
+
+                                build.setCutterPlcBit(jsonObject.getString("Value"));
+                            }
+
+                        }
+                    }
+
+                } catch (Exception e) {
+                    log.info("机外对刀仪字段解析失败");
+                    build.setStatus(0);
+                }
+
+                cutterTs.add(build.getCutterT());
+                cutterTestDataEntities.add(build);
+            } catch (DocumentException e) {
+                log.info("机外对刀仪获取数据失败");
+                e.printStackTrace();
+            }
+        }
+
+        for (CutterTestDataEntity cutterTestDataEntity : cutterTestDataEntities) {
+            QueryWrapper queryWrapper = new QueryWrapper<>();
+            queryWrapper.eq("cutter_name", cutterTestDataEntity.getCutterName());
+            queryWrapper.eq("cutter_t", cutterTestDataEntity.getCutterT());
+            //新增或修改刀具数据
+            this.saveOrUpdate(cutterTestDataEntity, queryWrapper);
+        }
+
+        log.info("===================定时获取机外对刀仪数据end===================");
+        return null;
+    }
+
+    @Autowired
+    private RestTemplate restTemplate;
+
+    @Override
+    public String pushPushToMachine() throws Exception {
+        QueryWrapper queryWrapper = new QueryWrapper();
+        queryWrapper.in("status", 2, 4);
+        List<CutterTestDataEntity> list = this.list(queryWrapper);
+
+        if (list.isEmpty()) {
+            return "没有需要上传给机床的对刀数据";
+        }
+
+
+        for (CutterTestDataEntity cutterTestDataEntity : list) {
+            cutterTestDataEntity.setCutterP("1.40");
+            cutterTestDataEntity.setCutterPIp("192.168.0.101");
+
+            String url = "http://127.0.0.1:8089/api/PushPushToMachine";
+            JSONObject rfidObj = new JSONObject();
+            rfidObj.put("url", "192.168.0.101");
+            rfidObj.put("port", "1900");
+            rfidObj.put("taskId", "12313");
+            rfidObj.put("taskNodeId", "12313123");
+            rfidObj.put("data", JSONObject.toJSON(cutterTestDataEntity));
+
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
+            HttpEntity<String> formEntity = new HttpEntity<String>(rfidObj.toJSONString(), headers);
+
+            String s = restTemplate.postForObject(url, formEntity, String.class);
+            log.info("============接收到对刀仪数据下发机床的结果数据========={}", s);
+            if (s == null) {
+                cutterTestDataEntity.setStatus(4);
+                continue;
+            }
+
+            JSONObject retJson = JSONObject.parseObject(s);
+
+            String code = retJson.getString("result").trim();
+            cutterTestDataEntity.setStatus(4);
+            if (code.equals("true")) {
+                cutterTestDataEntity.setStatus(3);
+            }
+        }
+
+        for (CutterTestDataEntity cutterTestDataEntity : list) {
+            QueryWrapper queryWrapper2 = new QueryWrapper<>();
+            queryWrapper2.eq("cutter_name", cutterTestDataEntity.getCutterName());
+            queryWrapper2.eq("cutter_t", cutterTestDataEntity.getCutterT());
+            //新增或修改刀具数据
+            this.saveOrUpdate(cutterTestDataEntity, queryWrapper2);
+        }
+
+        return null;
+    }
+
+    @Override
+    // 启用属性自动注入
+    @InjectionResult
+    public IPage<CutterTestDataEntity> pageList(IPage page, LbqWrapper<CutterTestDataEntity> wrapper) {
+
+        BaseContextHandler.setTenant("0000");
+        IPage<CutterTestDataEntity> cutterTestDataDtoIPage = baseMapper.pageList(page, wrapper);
+
+
+        return cutterTestDataDtoIPage;
+    }
+
+
+}

+ 139 - 0
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/cutterdata/utils/CutterFile.java

@@ -0,0 +1,139 @@
+package com.github.zuihou.business.cutterdata.utils;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONException;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.cutterdata
+ * @Author: Lenovo 对刀仪数据文件路径获取
+ * @Time: 2024 - 11 - 21 14 : 47
+ * @Description:
+ */
+
+@Slf4j
+@Component
+public class CutterFile {
+
+    /**
+     * 获取某个文件夹下的文件
+     * @param needFile 需要的文件集合
+     * @param directoryFile 不是文件集合
+     * @param filePath 文件路径
+     */
+    public static void findFileS(List<File> needFile, List<File> directoryFile,String filePath){
+        findFileS(needFile,directoryFile,null,filePath,null);
+    }
+
+
+    /**
+     * 获取某个文件夹下的文件
+     * @param needFile 需要的文件集合
+     * @param directoryFile 不是文件集合
+     * @param dissatisfyFile 不满足要求的文件集合
+     * @param filePath 文件路径
+     * @param needSuffix 必须包含的文件后缀信息
+     */
+    public static void findFileS(List<File> needFile, List<File> directoryFile, List<File>  dissatisfyFile,String filePath,String needSuffix){
+
+        File sharedFolder = new File(filePath);
+
+        if (sharedFolder.exists() && sharedFolder.isDirectory()) {
+            File[] files = sharedFolder.listFiles(); // 获取所有文件和文件夹
+
+            if (files != null) {
+                for (File file : files) {
+                    // 判断文件是否存在
+                    if(file.exists()){
+                        // 判断是否为文件
+                        if(file.isFile()){
+                            //判断是否为所需要的文件
+                            if(needSuffix==null || needSuffix.isEmpty()){
+                                needFile.add(file);
+                            }else if(!needSuffix.isEmpty() && file.getName().contains(needSuffix)) {
+                                needFile.add(file);
+                            }else {
+                                dissatisfyFile.add(file);
+                            }
+
+                        }else if(file.isDirectory()){
+                            // 判断是否为目录
+                            directoryFile.add(file);
+                        }
+                    }else {
+                        System.out.println("非文件或目录:"+ file.getPath());
+                    }
+                }
+            } else {
+                System.out.println("此文件目录下没有文件.");
+            }
+        } else {
+            System.out.println("文件目录不存在.");
+        }
+    }
+
+
+    /**
+     * 获取xml中的数据
+     * @throws Exception
+     */
+
+    public static JSONObject findXmlData(org.dom4j.Element element) throws JSONException {
+        JSONObject json = new JSONObject();
+
+        // 将子元素添加到JSON对象
+        Iterator<org.dom4j.Element> it = element.elementIterator();
+        while (it.hasNext()) {
+            org.dom4j.Element e = it.next();
+            String key = e.getName();
+            if (e.elementIterator().hasNext()) {
+                if(json.containsKey(key) && json.get(key)!=null){
+                    JSONArray jsonArray = null;
+                    try {
+                        jsonArray= json.getJSONArray(key);
+                    }catch (Exception ex){
+                        /*格式不对,需要转为JSONARRAY*/
+                        jsonArray = new JSONArray();
+                        jsonArray.add(json.getJSONObject(key));
+                    }
+                    jsonArray.add(findXmlData(e));
+                    json.put(key,jsonArray);
+                }else {
+                    json.put(key, findXmlData(e));
+                }
+            } else {
+                String value = e.getTextTrim();
+                json.put(key, value);
+            }
+        }
+
+        // 如果是文本节点,直接返回文本
+        if (!element.elementIterator().hasNext()) {
+            System.out.println("========"+element.getTextTrim());
+            JSONObject jsonObject = new  JSONObject();
+            jsonObject.put(element.getTextTrim(),element.getTextTrim());
+            return jsonObject;
+        }
+
+        return json;
+    }
+
+
+
+}

+ 54 - 0
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/cutterdata/CutterDataMapper.xml

@@ -0,0 +1,54 @@
+<?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.github.zuihou.business.cutterdata.dao.CutterTestDataMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity">
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="create_user" jdbcType="BIGINT" property="createUser"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="update_user" jdbcType="BIGINT" property="updateUser"/>
+        <result column="status" jdbcType="VARCHAR" property="status"/>
+        <result column="file_path" jdbcType="VARCHAR" property="filePath"/>
+        <result column="file_time" jdbcType="VARCHAR" property="fileTime"/>
+        <result column="cutter_name" jdbcType="VARCHAR" property="cutterName"/>
+        <result column="cutter_t" jdbcType="VARCHAR" property="cutterT"/>
+        <result column="cutter_typ" jdbcType="VARCHAR" property="cutterTyp"/>
+        <result column="cutter_typ_dnc" jdbcType="VARCHAR" property="cutterTypDnc"/>
+        <result column="cutter_typ_sub_dnc" jdbcType="VARCHAR" property="cutterTypSubDnc"/>
+        <result column="cutter_zl" jdbcType="BIGINT" property="cutterZl"/>
+        <result column="cutter_xl" jdbcType="VARCHAR" property="cutterXl"/>
+        <result column="cutter_rs" jdbcType="VARCHAR" property="cutterRs"/>
+        <result column="cutter_to" jdbcType="VARCHAR" property="cutterTo"/>
+        <result column="cutter_ori" jdbcType="VARCHAR" property="cutterOri"/>
+        <result column="cutter_time2" jdbcType="VARCHAR" property="cutterTime2"/>
+        <result column="cutter_over_time" jdbcType="VARCHAR" property="cutterOverTime"/>
+        <result column="cutter_plc_bit" jdbcType="VARCHAR" property="cutterPlcBit"/>
+        <result column="cutter_p" jdbcType="VARCHAR" property="cutterP"/>
+        <result column="cutter_P_Ip" jdbcType="VARCHAR" property="cutterPIp"/>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id,create_time,create_user,update_time,update_user,status,file_path,file_time,cutter_name,cutter_t,cutter_typ,cutter_typ_dnc,
+        cutter_typ_sub_dnc,cutter_zl,cutter_xl,cutter_rs,cutter_to,cutter_ori,cutter_time2,cutter_over_time,cutter_plc_bit,cutter_p,cutter_P_Ip
+    </sql>
+
+    <delete id="deleteCutterTestByT" >
+        DELETE FROM imcs_cutter_test_data WHERE cutter_t IN
+            <foreach item="cutterTs" collection="list" open="(" separator="," close=")">
+                #{cutterTs}
+            </foreach>
+    </delete>
+
+    <!-- 分页 -->
+    <select id="pageList" parameterType="String" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List"/>
+        from (
+            SELECT a.* from imcs_cutter_test_data a
+        ) s ${ew.customSqlSegment}
+
+    </select>
+</mapper>

+ 71 - 0
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/cutterdata/CutterTestDataController.java

@@ -0,0 +1,71 @@
+package com.github.zuihou.business.controller.cutterdata;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.zuihou.base.R;
+import com.github.zuihou.base.controller.SuperController;
+import com.github.zuihou.base.request.PageParams;
+import com.github.zuihou.business.classSchedule.entity.AuthUser;
+import com.github.zuihou.business.cutterdata.dto.CutterTestDataDto;
+import com.github.zuihou.business.cutterdata.entity.CutterTestDataEntity;
+import com.github.zuihou.business.cutterdata.service.CutterTestDataService;
+import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
+import com.github.zuihou.common.util.DateUtil;
+import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
+import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
+import com.github.zuihou.log.annotation.SysLog;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.checkerframework.checker.units.qual.A;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.controller.cutterdata
+ * @Author: Lenovo
+ * @Time: 2024 - 11 - 21 15 : 08
+ * @Description:
+ */
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/cutterTestData")
+@Api(value = "cutterTestData", tags = "对刀仪数据")
+@SysLog(enabled = true)
+public class CutterTestDataController  extends SuperController<CutterTestDataService,Long, CutterTestDataEntity,CutterTestDataEntity,CutterTestDataEntity,CutterTestDataEntity> {
+
+    @Autowired
+    private CutterTestDataService cutterTestDataService;
+
+    @ApiOperation(value = "获取机外对刀仪数据", notes = "获取机外对刀仪数据")
+    @PostMapping("/getCutterPage")
+    public R<IPage<CutterTestDataEntity>> getCutterPage(@RequestBody @Validated PageParams<CutterTestDataEntity> params) {
+
+        IPage<CutterTestDataEntity> page = params.buildPage();
+
+        QueryWrap<CutterTestDataEntity> wrap = handlerWrapper(null, params);
+
+        LbqWrapper<CutterTestDataEntity> wrapper = wrap.lambda();
+
+        wrapper.like(CutterTestDataEntity::getCutterT, params.getModel().getCutterT())
+                .like(CutterTestDataEntity::getCutterTyp, params.getModel().getCutterTyp())
+                .like(CutterTestDataEntity::getStatus,  params.getModel().getStatus())
+                .like(CutterTestDataEntity::getCutterP,  params.getModel().getCutterP())
+                .like(CutterTestDataEntity::getCutterPIp,  params.getModel().getCutterPIp())
+                .orderByDesc(CutterTestDataEntity::getUpdateTime);
+        //查询弹框异常
+        IPage<CutterTestDataEntity> cutterTestDataDtoIPage = cutterTestDataService.pageList(page, wrapper);
+
+        return R.success(cutterTestDataDtoIPage);
+    }
+
+
+}

+ 86 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/cutterdata/dto/CutterTestDataDto.java

@@ -0,0 +1,86 @@
+package com.github.zuihou.business.cutterdata.dto;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.hibernate.validator.constraints.Length;
+
+import java.io.Serializable;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.cutterdata.dto
+ * @Author: Lenovo
+ * @Time: 2024 - 11 - 21 15 : 27
+ * @Description:
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+public class CutterTestDataDto implements Serializable {
+
+    private Long id;
+
+    @ApiModelProperty(value = "数据来源路径")
+    private  String filePath;
+
+    @ApiModelProperty(value = "文件时间")
+    private  String fileTime;
+
+    @ApiModelProperty(value = "刀具名")
+    private  String cutterName;
+
+    @ApiModelProperty(value = "刀号")
+    private  String cutterT;
+
+    @ApiModelProperty(value = "刀具类型(对刀仪)")
+    private  String cutterTyp;
+
+    @ApiModelProperty(value = "刀具类型(机床)")
+    private  String cutterTypDnc;
+
+    @ApiModelProperty(value = "刀具子类型(机床)")
+    private  String cutterTypSubDnc;
+
+    @ApiModelProperty(value = "刀具长度")
+    private  String cutterZl;
+
+    @ApiModelProperty(value = "刀具半径/直径,根据类型来")
+    private  String cutterXl;
+
+    @ApiModelProperty(value = "刀具R角")
+    private  String cutterRs;
+
+    @ApiModelProperty(value = "刀尖角")
+    private  String cutterTo;
+
+    @ApiModelProperty(value = "主轴定向角度")
+    private  String cutterOri;
+
+    @ApiModelProperty(value = "刀具使用寿命")
+    private  String cutterTime2;
+
+    @ApiModelProperty(value = "刀具使用寿命,不允许超过该值")
+    private  String cutterOverTime;
+
+    @ApiModelProperty(value = "内冷开")
+    private  String cutterPlcBit;
+
+    @ApiModelProperty(value = "数据状态,0机外对刀仪字段解析失败,1字段合格性检测不通过,2未推送机床,3已推送机床,4推送失败,")
+    private Integer status;
+
+    @ApiModelProperty(value = "到位点,刀具存放在那个机床的那个点位")
+    private String cutterP;
+
+    @ApiModelProperty(value = "到位点ip,存放在那个机床")
+    private String cutterPIp;
+
+}

+ 113 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/cutterdata/dto/CutterTypeContrastEnum.java

@@ -0,0 +1,113 @@
+package com.github.zuihou.business.cutterdata.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @Project: imcs-admin-boot
+ * @Package: com.github.zuihou.business.cutterdata.dto
+ * @Author: Lenovo
+ * @Time: 2024 - 11 - 27 18 : 23
+ * @Description:
+ */
+
+public enum CutterTypeContrastEnum {
+
+    PTXD("A0","0","普通铣刀"),
+    CXD("B0","9","粗铣刀"),
+    JXD("C0","10", "精铣刀"),
+    QTXD("D0","22", "球头铣刀"),
+    PXD("E0","23", "盘铣刀"),
+    ZK("F0","1", "钻孔"),
+    GS("G0","2", "攻丝"),
+    ZXZ("H0","4", "中心钻"),
+    CD("I","29", "车刀"),
+    CJGCD("I0","11", "粗加工车刀"),
+    JJGCD("I1","12", "精加工车刀"),
+    LWJGD("I2","14", "螺纹加工刀"),
+    CJGD("I3","15", "槽加工刀"),
+    YNCD("I4","21", "圆钮车刀"),
+    QCCD("I5","26", "切槽车刀"),
+    CT("J0","21", "测头"),
+    JT("K0","3", "铰孔"),
+    HK("L0","5", "锪孔"),
+    DXHK("M0","6", "定心锪孔"),
+    TD("N0","7", "镗刀"),
+    FXTD("O0","8", "反向镗刀"),
+    LWXD("P0","15", "螺纹铣削"),
+    LWXXDHK("Q0","16", "螺纹铣削带锪孔"),
+    LWXXDLW("R0","17", "螺纹铣削带单螺纹"),
+    LWXXDKZWDP("S0","18", "螺纹铣削带可转位刀片"),
+    LWXXZT("T0","19", "螺纹铣削钻头"),
+    YHLWXX("U0","20", "圆弧螺纹铣削"),
+    SL("V0","30", "砂轮"),
+    XMD("W0","31", "修磨刀");
+
+
+
+    /*机外对刀仪刀具类型*/
+    private String rfidType;
+    /*机床刀具类型*/
+    private String dncType;
+    /*描述*/
+    private String desc;
+
+    CutterTypeContrastEnum(String rfidType, String dncType,String desc) {
+        this.rfidType = rfidType;
+        this.dncType = dncType;
+        this.desc = desc;
+    }
+
+    public String getRfidType() {
+        return rfidType;
+    }
+
+    public String getDncType() {
+        return dncType;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public static String getRfidType(String dncType) {
+        for (CutterTypeContrastEnum value : values()) {
+            if (value.getDncType().equals(dncType)) {
+                return value.getRfidType();
+            }
+        }
+        return null;
+    }
+
+    public static String getDncType(String rfidType) {
+        for (CutterTypeContrastEnum value : values()) {
+            if (value.getRfidType().equals(rfidType)) {
+                return value.getDncType();
+            }
+        }
+        return null;
+    }
+    /**
+     * @return AreaEnum
+     */
+    public static CutterTypeContrastEnum findAlarmByRfidType(String rfidType) {
+        for (CutterTypeContrastEnum c : CutterTypeContrastEnum.values()) {
+            if (c.getRfidType().equals(rfidType)) {
+                return c;
+            }
+        }
+        return null;
+    }
+
+    public static CutterTypeContrastEnum findAlarmByDncType(String dncType) {
+        for (CutterTypeContrastEnum c : CutterTypeContrastEnum.values()) {
+            if (c.getDncType().equals(dncType)) {
+                return c;
+            }
+        }
+        return null;
+    }
+
+}

+ 137 - 0
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/cutterdata/entity/CutterTestDataEntity.java

@@ -0,0 +1,137 @@
+package com.github.zuihou.business.cutterdata.entity;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.github.zuihou.base.entity.Entity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import lombok.experimental.Accessors;
+import org.hibernate.validator.constraints.Length;
+
+import java.time.LocalDateTime;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+@Data
+@Builder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+@TableName("imcs_cutter_test_data")
+@ApiModel(value = "CutterTestDataEntity", description = "机外对刀仪")
+@AllArgsConstructor
+public class CutterTestDataEntity extends Entity<Long> {
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    @ApiModelProperty(value = "数据来源路径")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "file_path", condition = LIKE)
+    @Excel(name = "数据来源路径")
+    private  String filePath;
+
+    @ApiModelProperty(value = "文件时间")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "file_time", condition = LIKE)
+    @Excel(name = "文件时间")
+    private  String fileTime;
+
+    @ApiModelProperty(value = "刀具名")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_name", condition = LIKE)
+    @Excel(name = "刀具名")
+    private  String cutterName;
+
+    @ApiModelProperty(value = "刀号")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_t", condition = LIKE)
+    @Excel(name = "刀号")
+    private  String cutterT;
+
+    @ApiModelProperty(value = "刀具类型(对刀仪)")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_typ", condition = LIKE)
+    @Excel(name = "刀具类型")
+    private  String cutterTyp;
+
+    @ApiModelProperty(value = "刀具类型(机床)")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_typ_dnc", condition = LIKE)
+    @Excel(name = "刀具类型(机床)")
+    private  String cutterTypDnc;
+
+    @ApiModelProperty(value = "刀具子类型(机床)")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_typ_sub_dnc", condition = LIKE)
+    @Excel(name = "刀具子类型(机床)")
+    private  String cutterTypSubDnc;
+
+    @ApiModelProperty(value = "刀具长度")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_zl", condition = LIKE)
+    @Excel(name = "刀具长度")
+    private  String cutterZl;
+
+    @ApiModelProperty(value = "刀具半径/直径,根据类型来")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_xl", condition = LIKE)
+    @Excel(name = "刀具半径/直径,根据类型来")
+    private  String cutterXl;
+
+    @ApiModelProperty(value = "刀具R角")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_rs", condition = LIKE)
+    @Excel(name = "刀具R角")
+    private  String cutterRs;
+
+    @ApiModelProperty(value = "刀尖角")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_to", condition = LIKE)
+    @Excel(name = "刀尖角")
+    private  String cutterTo;
+
+    @ApiModelProperty(value = "主轴定向角度")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_ori", condition = LIKE)
+    @Excel(name = "主轴定向角度")
+    private  String cutterOri;
+
+    @ApiModelProperty(value = "刀具使用寿命")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_time2", condition = LIKE)
+    @Excel(name = "刀具使用寿命")
+    private  String cutterTime2;
+
+    @ApiModelProperty(value = "刀具使用寿命,不允许超过该值")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_over_time", condition = LIKE)
+    @Excel(name = "刀具使用寿命,不允许超过该值")
+    private  String cutterOverTime;
+
+    @ApiModelProperty(value = "内冷开")
+    @Length(max = 128, message = "名称长度不能超过128")
+    @TableField(value = "cutter_plc_bit", condition = LIKE)
+    @Excel(name = "内冷开")
+    private  String cutterPlcBit;
+
+    @ApiModelProperty(value = "数据状态,0机外对刀仪字段解析失败,1字段合格性检测不通过,2未推送机床,3已推送机床,4推送失败,")
+    @TableField(value = "status", condition = LIKE)
+    @Excel(name = "数据状态")
+    private Integer status;
+
+    @ApiModelProperty(value = "到位点,刀具存放在那个机床的那个点位")
+    @TableField(value = "cutter_p", condition = LIKE)
+    @Excel(name = "到位点")
+    private String cutterP;
+
+    @ApiModelProperty(value = "到位点ip,存放在那个机床")
+    @TableField(value = "cutter_P_Ip", condition = LIKE)
+    @Excel(name = "到位点ip")
+    private String cutterPIp;
+
+
+}