Lius
2024-03-01 bd6d24362376534e83ea768c7c4f6b968cc3f7aa
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentWorkLineServiceImpl.java
@@ -15,6 +15,7 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -111,6 +112,20 @@
            }
        }
        resultList = resultList.stream().sorted(Comparator.comparing(EquipmentMachingDto::getCollectTime)).collect(Collectors.toList());
        for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamConfigs) {
            if ("spindleCurrent".equals(mdcDriveTypeParamConfig.getEnglishName())) {
                for (EquipmentMachingDto equipmentMachingDto : resultList) {
                    String devicePower = mdcEquipment.getDevicePower();
                    if (StringUtils.isNotBlank(devicePower)) {
                        devicePower = "2500";
                    }
                    String spindleload = equipmentMachingDto.getSpindleload();
                    if (StringUtils.isNotBlank(spindleload)) {
                        equipmentMachingDto.setSpindleCurrent(new BigDecimal(devicePower).divide(new BigDecimal("380"), 2, BigDecimal.ROUND_HALF_UP).add(new BigDecimal(spindleload)));
                    }
                }
            }
        }
        return resultList;
    }
@@ -157,35 +172,56 @@
            }
            for (int i = 1; i <= collentParams.size(); i++) {
                try {
                    switch (i) {
                        case 1:
                            ei.setDataLine1(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                    switch (collentParams.get(i - 1).getEnglishName()) {
                        case "spindlespeed":
                            ei.setSpindlespeed(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 2:
                            ei.setDataLine2(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "spindleload":
                            ei.setSpindleload(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 3:
                            ei.setDataLine3(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "spindlebeilv":
                            ei.setSpindlebeilv(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 4:
                            ei.setDataLine4(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "feedrate":
                            ei.setFeedrate(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 5:
                            ei.setDataLine5(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 6:
                            ei.setDataLine6(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 7:
                            ei.setDataLine7(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                        case 8:
                            ei.setDataLine8(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                        case "feedbeilv":
                            ei.setFeedbeilv(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
                            break;
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
//                try {
//                    switch (i) {
//                        case 1:
//                            ei.setDataLine1(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 2:
//                            ei.setDataLine2(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 3:
//                            ei.setDataLine3(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 4:
//                            ei.setDataLine4(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 5:
//                            ei.setDataLine5(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 6:
//                            ei.setDataLine6(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 7:
//                            ei.setDataLine7(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                        case 8:
//                            ei.setDataLine8(map.get(collentParams.get(i - 1).getEnglishName()) == null ? null : map.get(collentParams.get(i - 1).getEnglishName()).toString());
//                            break;
//                    }
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
            }
            dto.add(ei);
        }