| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.acs.common.enums.AgvStatusType; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.common.utils.CommonUtil; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.FuncStaType; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | |
| | | @Override |
| | | public int compare(FuncSta o1, FuncSta o2) { |
| | | Code o1Code = codeService.getById(o1.getCode()); |
| | | int o1Distance = calcPositionDistance(startPos, new Double[]{o1Code.getX(), o1Code.getY()}); |
| | | int o1Distance = CommonUtil.calcDistance(startPos, new Double[]{o1Code.getX(), o1Code.getY()}); |
| | | |
| | | Code o2Code = codeService.getById(o2.getCode()); |
| | | int o2Distance = calcPositionDistance(startPos, new Double[]{o2Code.getX(), o2Code.getY()}); |
| | | int o2Distance = CommonUtil.calcDistance(startPos, new Double[]{o2Code.getX(), o2Code.getY()}); |
| | | |
| | | return o1Distance - o2Distance; |
| | | } |
| | |
| | | } |
| | | |
| | | return funcStaList.stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | private int calcPositionDistance(Double[] from, Double[] to) { |
| | | return (int) (Math.abs(to[0] - from[0]) + Math.abs(to[1] - from[1])); |
| | | } |
| | | |
| | | } |