|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.core.common.SpringUtils; | 
|---|
|  |  |  | import com.zy.asrs.entity.BasShuttle; | 
|---|
|  |  |  | import com.zy.asrs.service.BasShuttleService; | 
|---|
|  |  |  | import com.zy.common.utils.NavigatePositionConvert; | 
|---|
|  |  |  | import com.zy.core.News; | 
|---|
|  |  |  | 
|---|
|  |  |  | * 目标库位 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String locNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 小车当前库位号 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private String currentLocNo; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 作业标记 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (this.getPoint() == null) { | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return NavigatePositionConvert.xyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ()); | 
|---|
|  |  |  | return NavigatePositionConvert.nyXyzToLocNo(this.getPoint().getX(), this.getPoint().getY(), this.getPoint().getZ()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String getCoord$() { | 
|---|
|  |  |  | 
|---|
|  |  |  | return JSON.toJSONString(this.getCoord()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setPoint(NyShuttlePointClass point) { | 
|---|
|  |  |  | String locNo = NavigatePositionConvert.nyXyzToLocNo(point.getX(), point.getY(), point.getZ()); | 
|---|
|  |  |  | this.point = point; | 
|---|
|  |  |  | this.currentLocNo = locNo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 是否处于空闲待命状态 | 
|---|
|  |  |  | public Boolean isIdle() { | 
|---|
|  |  |  | boolean res = this.free == ShuttleStatusType.IDLE.id | 
|---|
|  |  |  | && this.pakMk.equals(true) | 
|---|
|  |  |  | && !this.pakMk | 
|---|
|  |  |  | && this.errState == 0 | 
|---|
|  |  |  | && this.taskNo == 0 | 
|---|
|  |  |  | && this.protocolStatus == ShuttleProtocolStatusType.IDLE.id | 
|---|
|  |  |  | 
|---|
|  |  |  | // 是否处于空闲待命状态,传入的taskNo和当前taskNo相同时允许放行 | 
|---|
|  |  |  | public Boolean isIdle(int taskNo) { | 
|---|
|  |  |  | boolean res = this.free == ShuttleStatusType.IDLE.id | 
|---|
|  |  |  | && this.pakMk.equals(true) | 
|---|
|  |  |  | && !this.pakMk | 
|---|
|  |  |  | && this.errState == 0 | 
|---|
|  |  |  | && (this.taskNo == 0 || this.taskNo == taskNo) | 
|---|
|  |  |  | && this.protocolStatus.intValue() == ShuttleProtocolStatusType.IDLE.id | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 是否处于空闲待命状态 | 
|---|
|  |  |  | public Boolean isIdleNoCharge() { | 
|---|
|  |  |  | boolean res = this.free == ShuttleStatusType.IDLE.id | 
|---|
|  |  |  | && !this.pakMk | 
|---|
|  |  |  | && this.errState == 0 | 
|---|
|  |  |  | && this.taskNo == 0 | 
|---|
|  |  |  | && this.protocolStatus == ShuttleProtocolStatusType.IDLE.id | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 是否满足充电状态 | 
|---|
|  |  |  | public Boolean isRequireCharge() { | 
|---|
|  |  |  | if (this.free == null || this.pakMk == null || this.errState == null || this.taskNo == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean res = this.free == ShuttleStatusType.IDLE.id | 
|---|
|  |  |  | && !this.pakMk | 
|---|
|  |  |  | && this.errState == 0 | 
|---|
|  |  |  | && this.taskNo == 0 | 
|---|
|  |  |  | && this.protocolStatusType.id == ShuttleProtocolStatusType.IDLE.id | 
|---|
|  |  |  | ; | 
|---|
|  |  |  | if (!res) { | 
|---|
|  |  |  | return res; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | // 电量小于阈值或最低电芯电压小于2900mv,需要进行充电 | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class); | 
|---|
|  |  |  | if (shuttleService == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BasShuttle basShuttle = shuttleService.selectById(this.shuttleNo); | 
|---|
|  |  |  | if (basShuttle == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer chargeLine = basShuttle.getChargeLine(); | 
|---|
|  |  |  | if (chargeLine == null) { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return this.getPowerPercent() < chargeLine || this.minCellVoltage < 2900; | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | News.error("fail", e); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|