严智鑫
2024-03-19 eb87cabfb1b88e0c1bd7ebf091eef5369c7729ad
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
@@ -21,6 +21,7 @@
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.entity.Queue;
import com.example.springboot.mapper.GlassInfoMapper;
import com.example.springboot.mapper.MeasureSettingMapper;
import com.example.springboot.mapper.QueueMapper;
@@ -62,7 +63,12 @@
    }
    // 匹配逻辑
    public boolean Normal(double width, double height, String line) {
    public GlassInfo Normal(double width, double height, String line) {
        List<Queue> ErrowQueues= QueueMapper.selectErrorQueues();
        if (ErrowQueues.size()>0) {
            //System.out.println("有匹配失败数据未去除");
            return new GlassInfo();
        }
        List<GlassInfo> Result = NormalGlassInfo(width, height, "1");
        if (Result.size() == 1) {
            // 匹配成功 就一种类型 添加数据
@@ -70,22 +76,19 @@
            QueueMapper.insert(GlassInfo.getGlassid(), width, height, 1);
            GlassInfoMapper.updatemeasurenumber(GlassInfo.getId());
            System.out.println("匹配成功");
            // S7control.getinstance().WriteWord(plcmes.getPlcParameter("GaToMES").getAddress(),
            // (short) 1);
            System.out.println(GlassInfo.getGlassid());
            return true;
            return GlassInfo;
        } else if (Result.size() > 1) {
            // 匹配失败 匹配到多条符合的数据 添加数据
            QueueMapper.insert(null, width, height, 2);
            QueueMapper.insertMatchFailure(width, height, 0);
            System.out.println("匹配失败");
            return false;
        } else {
            // 匹配失败 未找到符合的数据 添加数据
            QueueMapper.insert(null, width, height, 3);
            QueueMapper.insertMatchFailure(width, height, -1);
            System.out.println("未找到符合的数据");
            return false;
        }
        return new GlassInfo();
    }
    // Execl表格 传入文件路径
@@ -93,6 +96,10 @@
        try {
            // 创建文件对象
            File file = new File(filename);
            if (!file.exists()) {
                System.out.println("文件不存在! "+filename);
                return new ArrayList<>();
            }
            // 创建文件输入流对象
            FileInputStream inputStream = new FileInputStream(file);
            // 创建工作簿对象