| | |
| | | vo.setSystemWarning(stationProtocol.getSystemWarning()); // 系统告警/业务提示 |
| | | vo.setWeight(stationProtocol.getWeight());//重量 |
| | | vo.setTaskWriteIdx(stationProtocol.getTaskWriteIdx());//任务可写区 |
| | | vo.setTaskBufferItems(stationProtocol.getTaskBufferItems());//任务缓存区数据 |
| | | String stationStatus = StationStatusType.process(stationProtocol).toString().toLowerCase().replaceAll("_", "-"); |
| | | if (stationProtocol.isAutoing() && stationProtocol.isLoading() && stationProtocol.getTaskNo() > 0 && !stationProtocol.isRunBlock()) { |
| | | String taskClass = getStationTaskClass(stationProtocol.getTaskNo(), inTaskRange, outTaskRange); |
| | |
| | | package com.zy.asrs.domain.vo; |
| | | |
| | | import com.zy.core.model.protocol.StationTaskBufferItem; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class StationLatestDataVo { |
| | |
| | | //任务可写区 |
| | | private Integer taskWriteIdx; |
| | | |
| | | //任务缓存区槽位详情 |
| | | private List<StationTaskBufferItem> taskBufferItems; |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Data |
| | |
| | | //任务可写区 |
| | | private Integer taskWriteIdx; |
| | | |
| | | //任务缓存区槽位详情 |
| | | private List<StationTaskBufferItem> taskBufferItems; |
| | | |
| | | /** |
| | | * 扩展数据 |
| | | */ |
| New file |
| | |
| | | package com.zy.core.model.protocol; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class StationTaskBufferItem { |
| | | |
| | | // 任务缓存区槽位,从 1 开始 |
| | | private Integer slotIdx; |
| | | |
| | | // 缓存区任务号 |
| | | private Integer taskNo; |
| | | |
| | | // 缓存区目标站 |
| | | private Integer targetStaNo; |
| | | } |
| | |
| | | package com.zy.core.network.entity; |
| | | |
| | | import com.zy.core.model.protocol.StationTaskBufferItem; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class ZyStationStatusEntity { |
| | |
| | | //任务可写区 |
| | | private Integer taskWriteIdx; |
| | | |
| | | //任务缓存区槽位详情 |
| | | private List<StationTaskBufferItem> taskBufferItems; |
| | | |
| | | //运行堵塞 |
| | | private boolean runBlock = false; |
| | | |
| | |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.StationObjModel; |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.model.protocol.StationTaskBufferItem; |
| | | import com.zy.core.network.api.ZyStationConnectApi; |
| | | import com.zy.core.network.entity.ZyStationStatusEntity; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.text.MessageFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | |
| | | statusEntity.setError(0);//默认无报警 |
| | | |
| | | statusEntity.setTaskWriteIdx((int) siemensNet.getByteTransform().TransInt16(result.Content, i * 10 + 8));//任务可写区 |
| | | fillTaskBufferStatus(i, statusEntity); |
| | | } |
| | | } |
| | | |
| | |
| | | return null; |
| | | } |
| | | |
| | | private void fillTaskBufferStatus(int stationIdx, ZyStationStatusEntity statusEntity) { |
| | | if (statusEntity == null || stationIdx < 0) { |
| | | return; |
| | | } |
| | | List<StationTaskBufferItem> itemList = new ArrayList<>(); |
| | | OperateResultExOne<byte[]> resultTask = siemensNet.Read("DB13." + (stationIdx * TASK_AREA_LENGTH), (short) TASK_AREA_LENGTH); |
| | | if (resultTask.IsSuccess && resultTask.Content != null) { |
| | | for (int slotIdx = 1; slotIdx <= TASK_AREA_SLOT_COUNT; slotIdx++) { |
| | | int offset = slotIdx * TASK_AREA_SLOT_SIZE; |
| | | int taskNo = siemensNet.getByteTransform().TransInt32(resultTask.Content, offset); |
| | | int targetPoint = siemensNet.getByteTransform().TransInt16(resultTask.Content, offset + 6); |
| | | StationTaskBufferItem item = new StationTaskBufferItem(); |
| | | item.setSlotIdx(slotIdx); |
| | | item.setTaskNo(taskNo); |
| | | item.setTargetStaNo(targetPoint); |
| | | itemList.add(item); |
| | | } |
| | | } |
| | | statusEntity.setTaskBufferItems(itemList); |
| | | } |
| | | |
| | | private int findIndex(Integer stationId) { |
| | | for (int i = 0; i < statusList.size(); i++) { |
| | | ZyStationStatusEntity statusEntity = statusList.get(i); |
| | |
| | | stationProtocol.setEnableIn(statusEntity.isEnableIn()); |
| | | stationProtocol.setWeight(statusEntity.getWeight()); |
| | | stationProtocol.setTaskWriteIdx(statusEntity.getTaskWriteIdx()); |
| | | stationProtocol.setTaskBufferItems(statusEntity.getTaskBufferItems()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(stationProtocol.getSystemWarning())) { |
| | |
| | | stationProtocol.setEnableIn(statusEntity.isEnableIn()); |
| | | stationProtocol.setWeight(statusEntity.getWeight()); |
| | | stationProtocol.setTaskWriteIdx(statusEntity.getTaskWriteIdx()); |
| | | stationProtocol.setTaskBufferItems(statusEntity.getTaskBufferItems()); |
| | | } |
| | | |
| | | if (!Cools.isEmpty(stationProtocol.getSystemWarning())) { |
| | |
| | | import com.zy.core.model.Task; |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.model.protocol.StationProtocol; |
| | | import com.zy.core.model.protocol.StationTaskBufferItem; |
| | | import com.zy.core.service.StationTaskLoopService; |
| | | import com.zy.core.thread.StationThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | if (lock != null) { |
| | | return; |
| | | } |
| | | int taskBufferCommandCount = countTaskBufferCommands(stationProtocol.getTaskBufferItems()); |
| | | if (taskBufferCommandCount > 0) { |
| | | News.info("输送站点任务停留超时,但缓存区仍有命令,已跳过重算。站点号={},工作号={},缓存命令数={}", |
| | | stationProtocol.getStationId(), |
| | | stationProtocol.getTaskNo(), |
| | | taskBufferCommandCount); |
| | | return; |
| | | } |
| | | |
| | | Double pathLenFactor = resolveOutboundPathLenFactor(wrkMast); |
| | | OutOrderDispatchDecision dispatchDecision = null; |
| | |
| | | redisUtil.del(key); |
| | | } |
| | | |
| | | private int countTaskBufferCommands(List<StationTaskBufferItem> taskBufferItems) { |
| | | if (taskBufferItems == null || taskBufferItems.isEmpty()) { |
| | | return 0; |
| | | } |
| | | int count = 0; |
| | | for (StationTaskBufferItem item : taskBufferItems) { |
| | | if (item == null) { |
| | | continue; |
| | | } |
| | | Integer taskNo = item.getTaskNo(); |
| | | Integer targetStaNo = item.getTargetStaNo(); |
| | | if ((taskNo != null && taskNo != 0) || (targetStaNo != null && targetStaNo != 0)) { |
| | | count++; |
| | | } |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | private int clearIssuedMoveCommandsDuringIdleStay(StationTaskIdleTrack idleTrack, |
| | | Integer taskNo, |
| | | Integer stationId) { |
| | |
| | | { label: "条码", value: this.orDash(item.barcode), code: true, type: "barcode" }, |
| | | { label: "重量", value: this.orDash(item.weight) }, |
| | | { label: "任务可写区", value: this.orDash(item.taskWriteIdx) }, |
| | | { label: "缓存区数据", value: this.formatTaskBufferItems(item.taskBufferItems), code: true }, |
| | | { label: "故障代码", value: this.orDash(item.error) }, |
| | | { label: "故障信息", value: this.orDash(item.errorMsg) }, |
| | | { label: "系统告警", value: this.orDash(item.systemWarning) }, |
| | | { label: "扩展数据", value: this.orDash(item.extend) } |
| | | ]; |
| | | }, |
| | | formatTaskBufferItems: function (items) { |
| | | if (!Array.isArray(items) || items.length === 0) { |
| | | return "--"; |
| | | } |
| | | return items.map(function (item) { |
| | | var slotIdx = item && item.slotIdx != null ? item.slotIdx : "?"; |
| | | var taskNo = item && item.taskNo != null ? item.taskNo : 0; |
| | | var targetStaNo = item && item.targetStaNo != null ? item.targetStaNo : 0; |
| | | if (!taskNo && !targetStaNo) { |
| | | return slotIdx + ": 空"; |
| | | } |
| | | return slotIdx + ": " + taskNo + " -> " + targetStaNo; |
| | | }).join(" | "); |
| | | }, |
| | | postControl: function (url, payload) { |
| | | $.ajax({ |
| | | url: baseUrl + url, |