ZengTao
2024-03-18 812de271142a39b7c5ead401e1a3ea150d7c31d7
springboot-vue3/src/main/java/com/example/springboot/service/HomeService.java
@@ -8,43 +8,43 @@
import com.example.springboot.entity.GlassInfo;
import com.example.springboot.entity.MeasureSetting;
import com.example.springboot.mapper.GlassInfoMapper;
import com.example.springboot.mapper.MeasureSettingMapper;
import com.example.springboot.mapper.QueueMapper;
// import com.example.springboot.mapper.GlassInfoMapper;
// import com.example.springboot.mapper.MeasureSettingMapper;
// import com.example.springboot.mapper.QueueMapper;
@Service
public class HomeService {
    @Autowired
    MeasureSettingMapper MeasureSettingMapper;
    @Autowired
    GlassInfoMapper GlassInfoMapper;
    @Autowired
    QueueMapper QueueMapper;
    // @Autowired
    // MeasureSettingMapper MeasureSettingMapper;
    // @Autowired
    // GlassInfoMapper GlassInfoMapper;
    // @Autowired
    // QueueMapper QueueMapper;
    // 匹配玻璃 宽,高,线路
    public List<GlassInfo> NormalGlassInfo(double width, double height, String line) {
        //
        List<GlassInfo> Results=new ArrayList<GlassInfo>();
        // 获取匹配设置
        MeasureSetting MeasureSetting = MeasureSettingMapper.SelectMeasureSetting(line);
        if (height > 0 && width > 0 && MeasureSetting != null) {
            // 有效参数 请求=1 长/宽>0
            double maxheight = height + MeasureSetting.getErrorHeight();
            double minheight = height - MeasureSetting.getErrorHeight();
            double maxwidth = width + MeasureSetting.getErrorWidth();
            double minwidth = width - MeasureSetting.getErrorWidth();
            // 查询当前测量数据
            List<GlassInfo> GlassInfos = GlassInfoMapper.selectGlassInfos(maxwidth, minwidth, maxheight, minheight);
            List types = new ArrayList<>();
            for (int i = 0; i < GlassInfos.size(); i++) {
                Integer glasstype = GlassInfos.get(i).getGlasstype();
                if (!types.contains(glasstype)) {
                    types.add(glasstype);
                    Results.add(GlassInfos.get(i));
                }
            }
        }
        return Results;
    }
    // // 匹配玻璃 宽,高,线路
    // public List<GlassInfo> NormalGlassInfo(double width, double height, String line) {
    //     //
    //     List<GlassInfo> Results=new ArrayList<GlassInfo>();
    //     // 获取匹配设置
    //     MeasureSetting MeasureSetting = MeasureSettingMapper.SelectMeasureSetting(line);
    //     if (height > 0 && width > 0 && MeasureSetting != null) {
    //         // 有效参数 请求=1 长/宽>0
    //         double maxheight = height + MeasureSetting.getErrorHeight();
    //         double minheight = height - MeasureSetting.getErrorHeight();
    //         double maxwidth = width + MeasureSetting.getErrorWidth();
    //         double minwidth = width - MeasureSetting.getErrorWidth();
    //         // 查询当前测量数据
    //         List<GlassInfo> GlassInfos = GlassInfoMapper.selectGlassInfos(maxwidth, minwidth, maxheight, minheight);
    //         List types = new ArrayList<>();
    //         for (int i = 0; i < GlassInfos.size(); i++) {
    //             Integer glasstype = GlassInfos.get(i).getGlasstype();
    //             if (!types.contains(glasstype)) {
    //                 types.add(glasstype);
    //                 Results.add(GlassInfos.get(i));
    //             }
    //         }
    //     }
    //     return Results;
    // }
}