#
Junjie
2024-04-07 12d887af5b4ecb77e46be58735fa702385d2970d
#
2个文件已修改
48 ■■■■ 已修改文件
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasShuttle.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/entity/BasShuttle.java
@@ -35,7 +35,7 @@
     * 四向穿梭车号
     */
    @ApiModelProperty(value= "四向穿梭车号")
    @TableId(value = "shuttle_no", type = IdType.AUTO)
    @TableId(value = "shuttle_no", type = IdType.INPUT)
    private Integer shuttleNo;
    /**
@@ -54,7 +54,7 @@
     * 任务号
     */
    @ApiModelProperty(value= "任务号")
    private Integer wrkNo;
    private Integer taskNo;
    /**
     * 暂存库位
@@ -125,12 +125,19 @@
    @ApiModelProperty(value= "所属机构")
    private Long hostId;
    /**
     * 设备状态
     */
    @ApiModelProperty(value= "设备状态")
    private String protocol;
    public BasShuttle() {}
    public BasShuttle(Integer status,Integer shuttleStatus,Integer wrkNo,String idleLoc,Integer autoCharge,Integer chargeLine,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer runSpeed,Integer deleted,Long hostId) {
    public BasShuttle(Integer shuttleNo, Integer status, Integer shuttleStatus, Integer taskNo, String idleLoc, Integer autoCharge, Integer chargeLine, Long createBy, Date createTime, Long updateBy, Date updateTime, String memo, Integer runSpeed, Integer deleted, Long hostId, String protocol) {
        this.shuttleNo = shuttleNo;
        this.status = status;
        this.shuttleStatus = shuttleStatus;
        this.wrkNo = wrkNo;
        this.taskNo = taskNo;
        this.idleLoc = idleLoc;
        this.autoCharge = autoCharge;
        this.chargeLine = chargeLine;
@@ -142,9 +149,10 @@
        this.runSpeed = runSpeed;
        this.deleted = deleted;
        this.hostId = hostId;
        this.protocol = protocol;
    }
//    BasShuttle basShuttle = new BasShuttle(
    //    BasShuttle basShuttle = new BasShuttle(
//            null,    // 状态
//            null,    // 当前小车状态
//            null,    // 任务号
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/thread/impl/SurayShuttleThread.java
@@ -134,10 +134,10 @@
                    shuttleProtocol.setPakMk(true);
                }
//                if (shuttleProtocol.getProtocolStatusType() == null && shuttleProtocol.getDeviceStatus().intValue() == ShuttleDeviceStatusType.IDLE.id) {
//                    //小车空闲状态、小车任务状态为未知,认定曾离线过,需要复位成空闲
//                    shuttleProtocol.setProtocolStatusType(ShuttleProtocolStatusType.IDLE);
//                }
                if (shuttleProtocol.getProtocolStatusType() == null && shuttleProtocol.getDeviceStatus().intValue() == 3) {
                    //小车空闲状态、小车任务状态为未知,认定曾离线过,需要复位成空闲
                    shuttleProtocol.setProtocolStatusType(ShuttleProtocolStatusType.IDLE);
                }
                if (System.currentTimeMillis() - shuttleProtocol.getDeviceDataLog() > 1000 * 5) {
                    //采集时间超过5s,保存一次数据记录
@@ -155,6 +155,28 @@
                    //更新采集时间
                    shuttleProtocol.setDeviceDataLog(System.currentTimeMillis());
                }
                //将四向穿梭车状态保存至数据库
                BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
                BasShuttle basShuttle = shuttleService.getOne(new LambdaQueryWrapper<BasShuttle>()
                        .eq(BasShuttle::getShuttleNo, device.getDeviceNo())
                        .eq(BasShuttle::getHostId, device.getHostId()));
                if (basShuttle == null) {
                    basShuttle = new BasShuttle();
                    //四向穿梭车号
                    basShuttle.setShuttleNo(Integer.valueOf(device.getDeviceNo()));
                    basShuttle.setHostId(device.getHostId());
                    shuttleService.save(basShuttle);
                }
                //任务号
                basShuttle.setTaskNo(shuttleProtocol.getTaskNo().intValue());
                //修改时间
                basShuttle.setUpdateTime(new Date());
                //设备状态
                basShuttle.setProtocol(JSON.toJSONString(shuttleProtocol));
                if (shuttleService.updateById(basShuttle)) {
                    OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), device.getDeviceNo()));
                }
            } else {
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】{1}读取四向穿梭车状态信息失败", DateUtils.convert(new Date()), device.getDeviceNo()));
                throw new CoolException(MessageFormat.format("读取四向穿梭车状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", device.getDeviceNo(), device.getIp(), device.getPort()));