|  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.zy.acs.common.domain.AgvProtocol; | 
 |  |  | import com.zy.acs.common.domain.protocol.*; | 
 |  |  | import com.zy.acs.common.enums.AgvStatusType; | 
 |  |  | import com.zy.acs.common.utils.GsonUtils; | 
 |  |  | 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.BackpackDto; | 
 |  |  | import com.zy.acs.manager.core.domain.VehicleFaultDto; | 
 |  |  | import com.zy.acs.manager.manager.entity.Agv; | 
 |  |  | import com.zy.acs.manager.manager.entity.AgvDetail; | 
 |  |  | import com.zy.acs.manager.manager.entity.Code; | 
 |  |  | 
 |  |  |         if (msgBody instanceof AGV_04_UP) { | 
 |  |  |             AGV_04_UP agv_04_up = (AGV_04_UP) msgBody; | 
 |  |  |             log.info("Agv [{}] 故障数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_04_up)); | 
 |  |  | //            faultProcessor.execute(new VehicleFaultDto()); | 
 |  |  |             faultProcessor.execute(new VehicleFaultDto<>(protocol.getAgvNo(), protocol.getTimestamp(), agv_04_up)); | 
 |  |  |             detail.setError(agv_04_up.getHexFaultId()); | 
 |  |  |             detail.setErrorTime(new Date()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         // 故障复位 | 
 |  |  |         if (!Cools.isEmpty(detail.realError())) { | 
 |  |  |             assert detail.getErrorTime() != null; | 
 |  |  |             if (DateUtils.diffToSeconds(detail.getErrorTime(), new Date()) > 20) { | 
 |  |  |                 detail.setError(MapDataConstant.EMPTY_OF_ERROR); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         if (!agvDetailService.updateById(detail)) { | 
 |  |  |             log.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); | 
 |  |  |         } | 
 |  |  | 
 |  |  |  | 
 |  |  |     // 有码实时数据包 | 
 |  |  |     private void sync(AGV_12_UP mesBody, AgvDetail detail) { | 
 |  |  |         detail.setStatus(mesBody.getStatus()); | 
 |  |  |  | 
 |  |  |         Code code = codeService.selectByData(mesBody.getQrCode()); | 
 |  |  |         if (null != code) { | 
 |  |  |             detail.setCode(code.getId()); | 
 |  |  | 
 |  |  |         } else { | 
 |  |  |             log.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         detail.setStatus(mesBody.getStatus()); | 
 |  |  |  | 
 |  |  |         // 地面码偏移 | 
 |  |  |         detail.setCodeOffsert(JSON.toJSONString(Cools | 
 |  |  | 
 |  |  |  | 
 |  |  |     // 无码实时数据包 | 
 |  |  |     private void sync(AGV_13_UP mesBody, AgvDetail detail) { | 
 |  |  |         detail.setStatus(mesBody.getStatus()); | 
 |  |  |  | 
 |  |  |         Code code = codeService.selectByData(mesBody.getQrCode()); | 
 |  |  |         if (null != code) { | 
 |  |  |             detail.setCode(null); | 
 |  |  |             detail.setLastCode(code.getId()); | 
 |  |  |             detail.setPos(0); | 
 |  |  | //            if (!agvDetailService.updateUnPosCode(detail.getId(), code.getId())) { | 
 |  |  | //                log.error("Agv [{}] 更新定位数据失败 !!!", agvService.getById(detail.getAgvId()).getUuid()); | 
 |  |  | //            } | 
 |  |  |  | 
 |  |  |             if (!detail.getAgvStatus().equals(AgvStatusType.CHARGE)) { | 
 |  |  |                 detail.setCode(null); | 
 |  |  |                 detail.setLastCode(code.getId()); | 
 |  |  |                 detail.setPos(0); | 
 |  |  |             } else { | 
 |  |  |                 detail.setCode(code.getId()); | 
 |  |  |                 detail.setLastCode(null); | 
 |  |  |                 detail.setPos(1); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         } else { | 
 |  |  |             log.error("Agv [{}] 更新定位数据失败 !!!上传条码:{}", agvService.getById(detail.getAgvId()).getUuid(), mesBody.getQrCode()); | 
 |  |  |         } |