| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.common.model.enums.NavigationMapType; |
| | | import com.zy.common.utils.NavigatePositionConvert; |
| | |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.thread.ShuttleThread; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * Created by vincent on 2020/8/27 |
| | | */ |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | public class Utils { |
| | | |
| | | private static final DecimalFormat fmt = new DecimalFormat("##0.00"); |
| | | |
| | | public static float scale(Float f){ |
| | | public static float scale(Float f) { |
| | | if (f == null || f == 0f || Float.isNaN(f)) { |
| | | return 0f; |
| | | } |
| | | return (float) Arith.multiplys(2, f, 1); |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count){ |
| | | if (msg.length() == count){ |
| | | public static String zerofill(String msg, Integer count) { |
| | | if (msg.length() == count) { |
| | | return msg; |
| | | } else if (msg.length() > count){ |
| | | } else if (msg.length() > count) { |
| | | return msg.substring(0, 16); |
| | | } else { |
| | | StringBuilder msgBuilder = new StringBuilder(msg); |
| | | for (int i = 0; i<count-msg.length(); i++){ |
| | | msgBuilder.insert(0,"0"); |
| | | for (int i = 0; i < count - msg.length(); i++) { |
| | | msgBuilder.insert(0, "0"); |
| | | } |
| | | return msgBuilder.toString(); |
| | | } |
| | |
| | | return list; |
| | | } |
| | | |
| | | //检测楼层是否有穿梭车 |
| | | //检测楼层是否有可用穿梭车 |
| | | public static boolean checkLevHasShuttle(Integer lev) { |
| | | SlaveProperties slaveProperties = SpringUtils.getBean(SlaveProperties.class); |
| | | WrkMastService wrkMastService = SpringUtils.getBean(WrkMastService.class); |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车线程 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | |
| | | continue; |
| | | } |
| | | |
| | | //小车正在充电 |
| | | if (shuttleThread.isCharging()) { |
| | | continue; |
| | | } |
| | | |
| | | //小车有充电任务 |
| | | WrkMast chargeWorking = wrkMastService.selectChargeWorking(shuttleProtocol.getShuttleNo()); |
| | | if (chargeWorking != null) {//已有充电任务 |
| | | continue; |
| | | } |
| | | |
| | | //小车处于故障状态 |
| | | if (shuttleThread.isFault()) { |
| | | continue; |
| | | } |
| | | |
| | | if (lev == Utils.getLev(currentLocNo)) { |
| | | return true;//指定楼层有穿梭车 |
| | | } |