From b3814333d786324bb81cca7d1bcf5ac8f2f1a7cf Mon Sep 17 00:00:00 2001 From: zhang <zc857179121@qq.com> Date: 星期三, 23 七月 2025 08:35:33 +0800 Subject: [PATCH] 保存一个版本 --- zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/VehFaultRecServiceImpl.java | 9 ++ zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/VehFaultRecMapper.java | 3 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/FaultProcessor.java | 40 ++++++--- zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataNoCodeService.java | 1 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataService.java | 1 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 80 +++++++++++++++----- zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java | 21 +++- zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/VehFaultRec.java | 6 + zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/VehFaultRecService.java | 3 zy-acs-manager/src/main/resources/application.yml | 4 zy-acs-manager/src/main/resources/mapper/manager/VehFaultRecMapper.xml | 17 ++++ zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Task.java | 2 zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataErrorService.java | 11 +- 13 files changed, 150 insertions(+), 48 deletions(-) diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataErrorService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataErrorService.java index c7f16ed..ee61949 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataErrorService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataErrorService.java @@ -6,9 +6,6 @@ import com.zy.acs.common.domain.protocol.IMessageBody; import com.zy.acs.common.enums.error.AgvErrorType; import com.zy.acs.common.utils.RedisSupport; -import com.zy.acs.framework.common.Cools; -import com.zy.acs.framework.common.DateUtils; -import com.zy.acs.manager.core.constant.MapDataConstant; import com.zy.acs.manager.core.domain.VehicleFaultDto; import com.zy.acs.manager.manager.entity.AgvDetail; import com.zy.acs.manager.manager.service.*; @@ -80,8 +77,12 @@ AgvErrorType errorType = AgvErrorType.query(agv_04_up.getHexFaultId()); log.info("Agv [{}] 鏁呴殰鏁版嵁鍖� ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_04_up)); - // save - faultProcessor.execute(new VehicleFaultDto<>(protocol.getAgvNo(), protocol.getTimestamp(), agv_04_up)); + if (agv_04_up.getFaultId() == 12304 && agv_04_up.getData2() == 4 && agv_04_up.getFlag() == 4) { + faultProcessor.reset(agvId); + } else { + // save + faultProcessor.execute(new VehicleFaultDto<>(protocol.getAgvNo(), protocol.getTimestamp(), agv_04_up)); + } // detail String errorMSg = errorType != null ? errorType.getMsg() : agv_04_up.getHexFaultId(); diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataNoCodeService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataNoCodeService.java index 41372de..2c1b00f 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataNoCodeService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataNoCodeService.java @@ -95,6 +95,7 @@ assert detail.getErrorTime() != null; if (DateUtils.diffToSeconds(detail.getErrorTime(), new Date()) > 20) { detail.setError(MapDataConstant.EMPTY_OF_ERROR); + faultProcessor.reset(agvId); } } if (!agvDetailService.updateById(detail)) { diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataService.java index c9d1c32..f1f8d0f 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/AgvDataService.java @@ -101,6 +101,7 @@ assert detail.getErrorTime() != null; if (DateUtils.diffToSeconds(detail.getErrorTime(), new Date()) > 20) { detail.setError(MapDataConstant.EMPTY_OF_ERROR); + faultProcessor.reset(agvId); } } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/FaultProcessor.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/FaultProcessor.java index 00eed5b..8f4bd5e 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/FaultProcessor.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/FaultProcessor.java @@ -44,25 +44,37 @@ AgvErrorType errorType = AgvErrorType.query(agv_04_up.getHexFaultId()); Long agvId = agvService.getAgvId(vehicle); + VehFaultRec vehFaultRec = vehFaultRecService.getTopVehFaultRec(agvId, String.valueOf(agv_04_up.getFaultId())); + if (null == vehFaultRec) { + vehFaultRec = new VehFaultRec(); + vehFaultRec.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); + vehFaultRec.setAgvId(agvId); + vehFaultRec.setFaultNo(String.valueOf(agv_04_up.getFaultId())); + vehFaultRec.setFaultHex(agv_04_up.getHexFaultId()); + vehFaultRec.setFaultName(null != errorType ? errorType.desc : "undefined"); + vehFaultRec.setFaultLev(agv_04_up.getFaultLevel()); + vehFaultRec.setFaultData(GsonUtils.toJson(Cools.add("data1", agv_04_up.getData1()).add("data2", agv_04_up.getData2()))); + vehFaultRec.setHappenTime(new Date()); + vehFaultRec.setProtocol(RadixTools.bytesToHexStr(agv_04_up.writeToBytes())); - VehFaultRec vehFaultRec = new VehFaultRec(); - vehFaultRec.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); - vehFaultRec.setAgvId(agvId); - vehFaultRec.setFaultNo(String.valueOf(agv_04_up.getFaultId())); - vehFaultRec.setFaultHex(agv_04_up.getHexFaultId()); - vehFaultRec.setFaultName(null != errorType ? errorType.desc : "undefined"); - vehFaultRec.setFaultLev(agv_04_up.getFaultLevel()); - vehFaultRec.setFaultData(GsonUtils.toJson(Cools.add("data1", agv_04_up.getData1()).add("data2", agv_04_up.getData2()))); - vehFaultRec.setHappenTime(new Date()); - vehFaultRec.setProtocol(RadixTools.bytesToHexStr(agv_04_up.writeToBytes())); - - if (!vehFaultRecService.save(vehFaultRec)) { - log.error("{}鍙疯溅杈嗘晠闅滐紒璁板綍鏁呴殰淇℃伅澶辫触......", dto.getVehicle()); + if (!vehFaultRecService.save(vehFaultRec)) { + log.error("{}鍙疯溅杈嗘晠闅滐紒璁板綍鏁呴殰淇℃伅澶辫触......", dto.getVehicle()); + } + } else { + vehFaultRec.setUpdateTime(new Date()); + if (!vehFaultRecService.updateById(vehFaultRec)) { + log.error("{}鍙疯溅杈嗘晠闅滐紒鏇存柊鏁呴殰淇℃伅澶辫触......", dto.getVehicle()); + } } - } catch (Exception e) { log.error("FaultProcessor", e); } } + @Async + public void reset(Long agvId) { + vehFaultRecService.resetError(agvId); + } + + } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java index 1516ccf..2092f91 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java @@ -96,6 +96,10 @@ private LaneService laneService; @Autowired private ActionSorter actionSorter; + @Autowired + private TaskReportService taskReportService; + @Autowired + private AgvDurationService agvDurationService; @SuppressWarnings("all") @Transactional @@ -286,7 +290,9 @@ */ @Transactional(propagation = Propagation.REQUIRES_NEW) public void buildMajorTask(Long agvId, List<Task> taskList) { - if (Cools.isEmpty(agvId, taskList)) { return; } + if (Cools.isEmpty(agvId, taskList)) { + return; + } try { // valid ----------------------------------------------- Agv agv = agvService.getById(agvId); @@ -326,16 +332,18 @@ * val: new TaskPosDto(taskId, new Double[]{code.getX(), code.getY()}, posType) */ Map<String, List<TaskPosDto>> groups = new HashMap<>(); - final String sameGroupXy = configService.getVal( "sameGroupXy", String.class); + final String sameGroupXy = configService.getVal("sameGroupXy", String.class); int backpackLev = 0; for (Task task : taskList) { - backpackLev ++; + backpackLev++; Code startCode = null; Code endCode = null; - Loc oriLoc = null; Loc destLoc = null; - Sta oriSta = null; Sta destSta = null; + Loc oriLoc = null; + Loc destLoc = null; + Sta oriSta = null; + Sta destSta = null; switch (Objects.requireNonNull(TaskTypeType.get(task.getTaskTypeEl()))) { case LOC_TO_LOC: oriLoc = locService.getById(task.getOriLoc()); @@ -438,7 +446,7 @@ // re-order by agv current position Code currCode = codeService.getCacheById(agvDetail.getRecentCode()); - Double[] currPosition = new Double[] {currCode.getX(), currCode.getY()}; + Double[] currPosition = new Double[]{currCode.getX(), currCode.getY()}; List<List<TaskPosDto>> pickGroups = new ArrayList<>(); List<List<TaskPosDto>> dropGroups = new ArrayList<>(); @@ -484,7 +492,7 @@ List<Segment> segmentList = new ArrayList<>(); for (List<TaskPosDto> dtoList : list) { for (TaskPosDto taskPosDto : dtoList) { - segSerial ++; + segSerial++; AgvBackpackType backpackType = AgvBackpackDto.find(backpackDtoList, taskPosDto.getTaskId()); assert null != backpackType; @@ -532,9 +540,12 @@ /** * 鍏呯數 鍥炲緟鏈轰綅浠诲姟 */ - @Transactional(propagation = Propagation.REQUIRES_NEW) // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional + @Transactional(propagation = Propagation.REQUIRES_NEW) + // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional public boolean buildMinorTask(Long agvId, TaskTypeType taskType, String destination, Jam jam) { - if (Cools.isEmpty(agvId, taskType)) { return false; } + if (Cools.isEmpty(agvId, taskType)) { + return false; + } try { String agvNo = agvService.getAgvNo(agvId); if (!agvService.judgeEnable(agvId)) { @@ -581,7 +592,7 @@ task.setAgvId(agvId); task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId)); - task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); + task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks) ? null : lastTasks.get(0).getSeqNum())); task.setOriCode(agvDetail.getCode()); task.setDestCode(endCode.getId()); // lane @@ -589,7 +600,7 @@ if (null != destLane) { task.setDestLaneHash(destLane.getHashCode()); } - task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE)?2:1); + task.setPriority(taskType.equals(TaskTypeType.TO_CHARGE) ? 2 : 1); task.setTaskSts(TaskStsType.ASSIGN.val()); task.setTaskType(taskType.val()); task.setIoTime(now); @@ -597,6 +608,7 @@ if (!taskService.save(task)) { throw new BusinessException(task.getSeqNum() + " failed to save"); } + // generate travel Travel travel = new Travel(); @@ -611,13 +623,20 @@ } // generate segment - int segSerial = 0; segSerial ++; + int segSerial = 0; + segSerial++; List<Segment> segmentList = new ArrayList<>(); String posType = ""; - switch (taskType){ + switch (taskType) { case TO_CHARGE: posType = TaskPosDto.PosType.TO_CHARGE.toString(); + //鎻掑叆鍏呯數浠诲姟 + AgvDuration agvDuration = new AgvDuration(); + agvDuration.setHappenTime(now); + agvDuration.setAgvId(agvId); + agvDuration.setTaskNo(task.getId()); + agvDurationService.save(agvDuration); break; case TO_STANDBY: posType = TaskPosDto.PosType.TO_STANDBY.toString(); @@ -687,7 +706,9 @@ @Transactional public synchronized void generateAction(Long agvId, List<Segment> segmentList, List<String> pathList, Date algoStartTime) { try { - if (Cools.isEmpty(agvId, segmentList)) { return; } + if (Cools.isEmpty(agvId, segmentList)) { + return; + } Date now = new Date(); long actionPrepareSts = ActionStsType.PREPARE.val(); // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); @@ -729,7 +750,9 @@ List<String> pathListPart = pathList.subList(pathList.indexOf(lastCode.getData()), pathList.indexOf(code.getData()) + 1); for (int i = 0; i < pathListPart.size(); i++) { - if (i == 0) { continue; } + if (i == 0) { + continue; + } String next = pathListPart.get(i); @@ -938,7 +961,7 @@ task.getBusId(), // 鎬荤嚎 task.getId(), // 浠诲姟 null, // 鍔ㄤ綔鍙� - null, // 浼樺厛绾� + null, // 浼樺厛绾� ActionTypeType.ReadyReleaseToShelvesLoc.desc, // 鍚嶇О (double) agvDirectionType.val, // 灞炴�у�� lastCode.getData(), // 鍦伴潰鐮� @@ -1439,9 +1462,9 @@ // segment list List<Segment> segmentList = segmentService.list(new LambdaQueryWrapper<Segment>() - .eq(Segment::getGroupId, serialNo) + .eq(Segment::getGroupId, serialNo) // .eq(Segment::getState, SegmentStateType.RUNNING.toString()) - .orderByAsc(Segment::getSerial) + .orderByAsc(Segment::getSerial) ); // settlement @@ -1471,8 +1494,10 @@ for (Segment segment : segmentList) { boolean taskComplete = false; - Task task = taskService.getById(segment.getTaskId()); assert null != task; - TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl()); assert null != typeType; + Task task = taskService.getById(segment.getTaskId()); + assert null != task; + TaskTypeType typeType = TaskTypeType.get(task.getTaskTypeEl()); + assert null != typeType; TaskPosDto.PosType posType = TaskPosDto.queryPosType(segment.getPosType()); switch (Objects.requireNonNull(posType)) { @@ -1508,6 +1533,21 @@ log.error("Task [{}] 鏇存柊澶辫触 锛侊紒锛�", task.getSeqNum()); } else { log.info("Task [{}] 浣滀笟瀹屾瘯 ==========>> ", task.getSeqNum()); + // TODO 鎻掑叆涓�鏉′笂鎶ヨ褰� + TaskReport taskReport = new TaskReport(); + taskReport.setAgvId(task.getAgvId()); + taskReport.setBusNo(task.getBusId$()); + taskReport.setCreateTime(new Date()); + taskReport.setDestLoc(task.getDestLoc()); + taskReport.setDestSta(task.getDestSta()); + taskReport.setSeqNum(task.getSeqNum()); + taskReport.setTaskSts(task.getTaskSts()); + taskReport.setOriLoc(task.getOriLoc()); + taskReport.setOriSta(task.getOriSta()); + taskReport.setZpallet(task.getZpallet()); + if (!taskReportService.save(taskReport)) { + log.info("TaskReport [{}] 鎻掑叆澶辫触 ==========>> ", JSON.toJSONString(taskReport)); + } } } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java index ea7ac84..b1323c5 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/astart/MapDataDispatcher.java @@ -16,8 +16,6 @@ import com.zy.acs.manager.manager.service.RouteService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.event.EventListener; -import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; @@ -309,11 +307,20 @@ turnMatrix[i][j] = TurnNodeType.STRAIGHT.val; break; case 2: - String firstCode = neighborCodeList.get(0); assert !Cools.isEmpty(firstCode); - String secondCode = neighborCodeList.get(1); assert !Cools.isEmpty(secondCode); + String firstCode = neighborCodeList.get(0); + assert !Cools.isEmpty(firstCode); + String secondCode = neighborCodeList.get(1); + assert !Cools.isEmpty(secondCode); int[] firstIdx = this.getCodeMatrixIdx(lev, firstCode); int[] secondIdx = this.getCodeMatrixIdx(lev, secondCode); + + if (firstIdx == null) { + throw new CoolException("涓嶅瓨鍦ㄧ偣浣�:" + firstCode); + } + if (secondIdx == null) { + throw new CoolException("涓嶅瓨鍦ㄧ偣浣�:" + secondCode); + } if (firstIdx[0] != secondIdx[0] && firstIdx[1] != secondIdx[1]) { turnMatrix[i][j] = TurnNodeType.TURN.val; @@ -335,7 +342,7 @@ return turnMatrix; } - + public synchronized int[][] initMapMatrix(Integer lev) { log.info("There is initializing Map Matrix......"); @@ -418,7 +425,9 @@ for (Code code : codeList) { Double x = code.getX(); Double y = code.getY(); - if (null == x || null == y) { continue; } + if (null == x || null == y) { + continue; + } if (!xIdxList.contains(x)) { xIdxList.add(x); } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Task.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Task.java index af1c34c..5c057d9 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Task.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/Task.java @@ -74,7 +74,7 @@ private Long agvId; /** - * 宸ヤ綔鏃堕棿 + * 宸ヤ綔鏃堕棿銆佷换鍔″垎閰嶆椂闂� */ @ApiModelProperty(value= "宸ヤ綔鏃堕棿") private Date ioTime; diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/VehFaultRec.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/VehFaultRec.java index 0cca695..fe01b35 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/VehFaultRec.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/entity/VehFaultRec.java @@ -98,6 +98,12 @@ private Date resetTime; /** + * 鎸佺画鏃堕棿 + */ + @ApiModelProperty(value= "鎸佺画鏃堕棿") + private Long duration; + + /** * 杩涘害 */ @ApiModelProperty(value= "杩涘害") diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/VehFaultRecMapper.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/VehFaultRecMapper.java index 896eecc..be37e83 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/VehFaultRecMapper.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/mapper/VehFaultRecMapper.java @@ -5,4 +5,7 @@ public interface VehFaultRecMapper extends BaseMapper<VehFaultRec> { + VehFaultRec getTopVehFaultRec(Long agvId, String faultNo); + + int resetError(Long agvId); } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/VehFaultRecService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/VehFaultRecService.java index dff1d2d..3266d8b 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/VehFaultRecService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/VehFaultRecService.java @@ -5,4 +5,7 @@ public interface VehFaultRecService extends IService<VehFaultRec> { + VehFaultRec getTopVehFaultRec(Long agvId, String faultNo); + + int resetError(Long agvId); } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/VehFaultRecServiceImpl.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/VehFaultRecServiceImpl.java index 0fff936..704c4bd 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/VehFaultRecServiceImpl.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/service/impl/VehFaultRecServiceImpl.java @@ -9,4 +9,13 @@ @Service("vehFaultRecService") public class VehFaultRecServiceImpl extends ServiceImpl<VehFaultRecMapper, VehFaultRec> implements VehFaultRecService { + @Override + public VehFaultRec getTopVehFaultRec(Long agvId, String faultNo) { + return baseMapper.getTopVehFaultRec(agvId, faultNo); + } + + @Override + public int resetError(Long agvId) { + return baseMapper.resetError(agvId); + } } diff --git a/zy-acs-manager/src/main/resources/application.yml b/zy-acs-manager/src/main/resources/application.yml index 994414c..cbd4597 100644 --- a/zy-acs-manager/src/main/resources/application.yml +++ b/zy-acs-manager/src/main/resources/application.yml @@ -7,7 +7,7 @@ static-path-pattern: /** datasource: driver-class-name: com.mysql.jdbc.Driver - url: jdbc:mysql://localhost:3306/jbly?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai + url: jdbc:mysql://10.10.10.200:3306/jbly?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai username: root password: xltys1995 type: com.alibaba.druid.pool.DruidDataSource @@ -42,7 +42,7 @@ enabled: false redis: - host: localhost + host: 10.10.10.200 password: xltys1995 port: 6379 max: 30 diff --git a/zy-acs-manager/src/main/resources/mapper/manager/VehFaultRecMapper.xml b/zy-acs-manager/src/main/resources/mapper/manager/VehFaultRecMapper.xml index 4f1113c..9a7c1aa 100644 --- a/zy-acs-manager/src/main/resources/mapper/manager/VehFaultRecMapper.xml +++ b/zy-acs-manager/src/main/resources/mapper/manager/VehFaultRecMapper.xml @@ -23,4 +23,21 @@ </where> </sql> + <update id="resetError"> + UPDATE man_veh_fault_rec + SET reset_time = now(), + duration = (UNIX_TIMESTAMP(reset_time) - UNIX_TIMESTAMP(happen_time)) + WHERE agv_id = #{agvId} + and reset_time is null + </update> + + <select id="getTopVehFaultRec" resultType="com.zy.acs.manager.manager.entity.VehFaultRec"> + SELECT * + FROM man_veh_fault_rec + WHERE agv_id = #{agvId} + and fault_no = #{faultNo} + and reset_time is null + ORDER BY happen_time DESC LIMIT 1 + </select> + </mapper> -- Gitblit v1.9.1