自动化立体仓库 - WCS系统
Junjie
2023-03-29 15f9bf6147e3a925094055ae2b56cfdf768338a8
读取四向穿梭车数据后保存至数据表中
7个文件已修改
324 ■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/ShuttleController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/domain/vo/ShuttleDataVo.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/BasShuttle.java 222 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/CodeBuilder.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/core/thread/ShuttleThread.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BasShuttleMapper.xml 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -164,9 +164,6 @@
                vo.setShuttleNo(shuttleSlave.getId());
                BasShuttle basShuttle = basShuttleService.selectById(shuttleSlave.getId());
                if (!Cools.isEmpty(basShuttle)) {
                    vo.setRow(basShuttle.getRow());
                    vo.setBay(basShuttle.getBay());
                    vo.setLev(basShuttle.getLev());
                    vo.setWorkNo(basShuttle.getWrkNo());
                    vo.setPakMk(basShuttle.getPakMk());
                }
@@ -228,9 +225,6 @@
        } else {
            throw new CoolException("命令下发失败");
        }
        basShuttle.setRow(vo.getRow());
        basShuttle.setBay(vo.getBay());
        basShuttle.setLev(vo.getLev());
        basShuttle.setPakMk(vo.getPakMk());
        basShuttle.setWrkNo(vo.getWorkNo());
src/main/java/com/zy/asrs/domain/vo/ShuttleDataVo.java
@@ -17,6 +17,6 @@
    private Integer lev;
    private String pakMk;
    private Boolean pakMk;
}
src/main/java/com/zy/asrs/entity/BasShuttle.java
@@ -41,9 +41,9 @@
    private Integer status;
    /**
     * 作业态
     * 当前小车状态(内部自我维护)
     */
    @ApiModelProperty(value= "作业态")
    @ApiModelProperty(value= "当前小车状态(内部自我维护)")
    @TableField("shuttle_status")
    private Integer shuttleStatus;
@@ -53,45 +53,6 @@
    @ApiModelProperty(value= "任务号")
    @TableField("wrk_no")
    private Integer wrkNo;
    /**
     * 排
     */
    @ApiModelProperty(value= "排")
    private Integer row;
    /**
     * 列
     */
    @ApiModelProperty(value= "列")
    private Integer bay;
    /**
     * 层
     */
    @ApiModelProperty(value= "层")
    private Integer lev;
    /**
     * 历史排
     */
    @ApiModelProperty(value= "历史排")
    @TableField("his_row")
    private Integer hisRow;
    /**
     * 历史列
     */
    @ApiModelProperty(value= "历史列")
    @TableField("his_bay")
    private Integer hisBay;
    /**
     * 历史层
     */
    @ApiModelProperty(value= "历史层")
    @TableField("his_lev")
    private Integer hisLev;
    /**
     * 暂存库位
@@ -158,25 +119,138 @@
    private Integer liftNo;
    /**
     * 标记
     * 作业标记
     */
    @ApiModelProperty(value= "标记")
    @ApiModelProperty(value= "作业标记")
    @TableField("pak_mk")
    private String pakMk;
    private Boolean pakMk;
    /**
     * 小车忙状态位
     */
    @ApiModelProperty(value= "小车忙状态位")
    @TableField("busy_status")
    private Integer busyStatus;
    /**
     * 当前二维码
     */
    @ApiModelProperty(value= "当前二维码")
    @TableField("current_code")
    private Integer currentCode;
    /**
     * 电池电量百分比
     */
    @ApiModelProperty(value= "电池电量百分比")
    @TableField("battery_power")
    private Integer batteryPower;
    /**
     * 电池温度
     */
    @ApiModelProperty(value= "电池温度")
    @TableField("battery_temp")
    private Integer batteryTemp;
    /**
     * 错误编号
     */
    @ApiModelProperty(value= "错误编号")
    @TableField("error_code")
    private Integer errorCode;
    /**
     * Plc输出状态IO
     */
    @ApiModelProperty(value= "Plc输出状态IO")
    @TableField("plc_output_status_io")
    private Integer plcOutputStatusIo;
    /**
     * 错误信息码
     */
    @ApiModelProperty(value= "错误信息码")
    @TableField("status_error_code")
    private Integer statusErrorCode;
    /**
     * PLC输入状态
     */
    @ApiModelProperty(value= "PLC输入状态")
    @TableField("plc_input_status")
    private Integer plcInputStatus;
    /**
     * 当前或者之前读到的二维码值
     */
    @ApiModelProperty(value= "当前或者之前读到的二维码值")
    @TableField("current_or_before_code")
    private Integer currentOrBeforeCode;
    /**
     * 读到的二维码X方向偏移量
     */
    @ApiModelProperty(value= "读到的二维码X方向偏移量")
    @TableField("code_offset_x")
    private Integer codeOffsetX;
    /**
     * 读到的二维码Y方向偏移量
     */
    @ApiModelProperty(value= "读到的二维码Y方向偏移量")
    @TableField("code_offset_y")
    private Integer codeOffsetY;
    /**
     * 当前的电压值
     */
    @ApiModelProperty(value= "当前的电压值")
    @TableField("current_voltage")
    private Integer currentVoltage;
    /**
     * 当前的模拟量值
     */
    @ApiModelProperty(value= "当前的模拟量值")
    @TableField("current_analog_value")
    private Integer currentAnalogValue;
    /**
     * 当前的升降伺服速度
     */
    @ApiModelProperty(value= "当前的升降伺服速度")
    @TableField("current_lift_servo_speed")
    private Integer currentLiftServoSpeed;
    /**
     * 当前的行走伺服速度
     */
    @ApiModelProperty(value= "当前的行走伺服速度")
    @TableField("current_move_servo_speed")
    private Integer currentMoveServoSpeed;
    /**
     * 当前的升降伺服负载率
     */
    @ApiModelProperty(value= "当前的升降伺服负载率")
    @TableField("current_lift_servo_load")
    private Integer currentLiftServoLoad;
    /**
     * 当前的行走伺服负载率
     */
    @ApiModelProperty(value= "当前的行走伺服负载率")
    @TableField("current_move_servo_load")
    private Integer currentMoveServoLoad;
    public BasShuttle() {}
    public BasShuttle(Integer shuttleNo,Integer status,Integer shuttleStatus,Integer wrkNo,Integer row,Integer bay,Integer lev,Integer hisRow,Integer hisBay,Integer hisLev,String idleLoc,Integer autoCharge,Integer chargeLine,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer liftNo) {
    public BasShuttle(Integer shuttleNo,Integer status,Integer shuttleStatus,Integer wrkNo,String idleLoc,Integer autoCharge,Integer chargeLine,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,Integer liftNo,Boolean pakMk,Integer busyStatus,Integer currentCode,Integer batteryPower,Integer batteryTemp,Integer errorCode,Integer plcOutputStatusIo,Integer statusErrorCode,Integer plcInputStatus,Integer currentOrBeforeCode,Integer codeOffsetX,Integer codeOffsetY,Integer currentVoltage,Integer currentAnalogValue,Integer currentLiftServoSpeed,Integer currentMoveServoSpeed,Integer currentLiftServoLoad,Integer currentMoveServoLoad) {
        this.shuttleNo = shuttleNo;
        this.status = status;
        this.shuttleStatus = shuttleStatus;
        this.wrkNo = wrkNo;
        this.row = row;
        this.bay = bay;
        this.lev = lev;
        this.hisRow = hisRow;
        this.hisBay = hisBay;
        this.hisLev = hisLev;
        this.idleLoc = idleLoc;
        this.autoCharge = autoCharge;
        this.chargeLine = chargeLine;
@@ -186,19 +260,31 @@
        this.updateTime = updateTime;
        this.memo = memo;
        this.liftNo = liftNo;
        this.pakMk = pakMk;
        this.busyStatus = busyStatus;
        this.currentCode = currentCode;
        this.batteryPower = batteryPower;
        this.batteryTemp = batteryTemp;
        this.errorCode = errorCode;
        this.plcOutputStatusIo = plcOutputStatusIo;
        this.statusErrorCode = statusErrorCode;
        this.plcInputStatus = plcInputStatus;
        this.currentOrBeforeCode = currentOrBeforeCode;
        this.codeOffsetX = codeOffsetX;
        this.codeOffsetY = codeOffsetY;
        this.currentVoltage = currentVoltage;
        this.currentAnalogValue = currentAnalogValue;
        this.currentLiftServoSpeed = currentLiftServoSpeed;
        this.currentMoveServoSpeed = currentMoveServoSpeed;
        this.currentLiftServoLoad = currentLiftServoLoad;
        this.currentMoveServoLoad = currentMoveServoLoad;
    }
//    BasShuttle basShuttle = new BasShuttle(
//            null,    // 四向穿梭车号[非空]
//            null,    // 状态
//            null,    // 作业态
//            null,    // 当前小车状态(内部自我维护)
//            null,    // 任务号
//            null,    // 排
//            null,    // 列
//            null,    // 层
//            null,    // 历史排
//            null,    // 历史列
//            null,    // 历史层
//            null,    // 暂存库位
//            null,    // 自动充电
//            null,    // 电量线
@@ -207,7 +293,25 @@
//            null,    // 修改人员
//            null,    // 修改时间
//            null,    // 备注
//            null    // 提升机号
//            null,    // 提升机号
//            null,    // 作业标记
//            null,    // 小车忙状态位
//            null,    // 当前二维码
//            null,    // 电池电量百分比
//            null,    // 电池温度
//            null,    // 错误编号
//            null,    // Plc输出状态IO
//            null,    // 错误信息码
//            null,    // PLC输入状态
//            null,    // 当前或者之前读到的二维码值
//            null,    // 读到的二维码X方向偏移量
//            null,    // 读到的二维码Y方向偏移量
//            null,    // 当前的电压值
//            null,    // 当前的模拟量值
//            null,    // 当前的升降伺服速度
//            null,    // 当前的行走伺服速度
//            null,    // 当前的升降伺服负载率
//            null    // 当前的行走伺服负载率
//    );
    public String getStatus$(){
src/main/java/com/zy/common/CodeBuilder.java
@@ -1,6 +1,7 @@
package com.zy.common;
import com.core.generators.CoolGenerator;
import com.core.generators.constant.SqlOsType;
/**
 * Created by vincent on 2019-06-04
@@ -15,10 +16,11 @@
//        generator.password="xltys1995";
//        generator.table="sys_host";
        // sqlserver
        generator.url="localhost:1433;databasename=bfasrs";
        generator.sqlOsType = SqlOsType.SQL_SERVER;
        generator.url="192.168.4.15:1433;databasename=xzjlasrs";
        generator.username="sa";
        generator.password="sa@123";
        generator.table="asr_bas_ste_err";
        generator.table="asr_bas_shuttle";
        generator.packagePath="com.zy.asrs";
        generator.controller = false;
src/main/java/com/zy/core/model/protocol/ShuttleProtocol.java
@@ -2,12 +2,10 @@
import com.core.common.SpringUtils;
import com.zy.asrs.service.BasShuttleService;
import com.zy.asrs.service.BasSteService;
import com.zy.core.News;
import com.zy.core.enums.ShuttleErrorCodeType;
import com.zy.core.enums.ShuttleProtocolStatusType;
import com.zy.core.enums.ShuttleStatusType;
import com.zy.core.enums.SteStatusType;
import com.zy.core.model.command.ShuttleAssignCommand;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
src/main/java/com/zy/core/thread/ShuttleThread.java
@@ -8,8 +8,11 @@
import com.core.common.DateUtils;
import com.core.common.SpringUtils;
import com.core.exception.CoolException;
import com.zy.asrs.entity.BasShuttle;
import com.zy.asrs.entity.BasShuttleOpt;
import com.zy.asrs.mapper.BasShuttleMapper;
import com.zy.asrs.service.BasShuttleOptService;
import com.zy.asrs.service.BasShuttleService;
import com.zy.common.model.NavigateNode;
import com.zy.common.utils.CommonUtils;
import com.zy.common.utils.NavigatePositionConvert;
@@ -160,9 +163,6 @@
                ///读取四向穿梭车状态-end
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                log.info(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                //小车处于忙碌状态,将标记置为true
                if (shuttleProtocol.getBusyStatusType() == ShuttleStatusType.BUSY) {
                    shuttleProtocol.setPakMk(true);
@@ -174,6 +174,62 @@
                    executeWork(shuttleProtocol.getAssignCommand());
                }
                //将四向穿梭车状态保存至数据库
                BasShuttleService shuttleService = SpringUtils.getBean(BasShuttleService.class);
                BasShuttle basShuttle = shuttleService.selectById(shuttleProtocol.getShuttleNo());
                if (basShuttle == null) {
                    basShuttle = new BasShuttle();
                    //四向穿梭车号
                    basShuttle.setShuttleNo(slave.getId());
                    shuttleService.insert(basShuttle);
                }
                //小车忙状态位
                basShuttle.setBusyStatus(shuttleProtocol.getBusyStatus().intValue());
                //当前二维码
                basShuttle.setCurrentCode(shuttleProtocol.getCurrentCode().intValue());
                //电池电量百分比
                basShuttle.setBatteryPower(shuttleProtocol.getBatteryPower().intValue());
                //电池温度
                basShuttle.setBatteryTemp(shuttleProtocol.getBatteryTemp().intValue());
                //错误编号
                basShuttle.setErrorCode(shuttleProtocol.getErrorCode().intValue());
                //Plc输出状态IO
                basShuttle.setPlcOutputStatusIo(shuttleProtocol.getPlcOutputStatusIO().intValue());
                //错误信息码
                basShuttle.setStatusErrorCode(shuttleProtocol.getStatusErrorCode().intValue());
                //PLC输入状态
                basShuttle.setPlcInputStatus(shuttleProtocol.getPlcInputStatus().intValue());
                //当前或者之前读到的二维码值
                basShuttle.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode().intValue());
                //读到的二维码X方向偏移量
                basShuttle.setCodeOffsetX(shuttleProtocol.getCodeOffsetX().intValue());
                //读到的二维码Y方向偏移量
                basShuttle.setCodeOffsetY(shuttleProtocol.getCodeOffsetY().intValue());
                //当前的电压值
                basShuttle.setCurrentVoltage(shuttleProtocol.getCurrentVoltage().intValue());
                //当前的模拟量值
                basShuttle.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue().intValue());
                //当前的升降伺服速度
                basShuttle.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed().intValue());
                //当前的行走伺服速度
                basShuttle.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed().intValue());
                //当前的升降伺服负载率
                basShuttle.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad().intValue());
                //当前的行走伺服负载率
                basShuttle.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad().intValue());
                //当前小车状态(内部自我维护)
                basShuttle.setShuttleStatus(shuttleProtocol.getProtocolStatus());
                //任务号
                basShuttle.setWrkNo(shuttleProtocol.getTaskNo().intValue());
                //修改时间
                basShuttle.setUpdateTime(new Date());
                //作业标记
                basShuttle.setPakMk(shuttleProtocol.getPakMk());
                if (shuttleService.updateById(basShuttle)) {
                    OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                    log.info(MessageFormat.format("【{0}】[id:{1}] <<<<< 实时数据更新成功",DateUtils.convert(new Date()), slave.getId()));
                }
            }else {
                OutputQueue.SHUTTLE.offer(MessageFormat.format("【{0}】{1}四向穿梭车plc状态信息失败", DateUtils.convert(new Date()), slave.getId()));
                throw new CoolException(MessageFormat.format( "四向穿梭车plc状态信息失败 ===>> [id:{0}] [ip:{1}] [port:{2}]", slave.getId(), slave.getIp(), slave.getPort()));
src/main/resources/mapper/BasShuttleMapper.xml
@@ -8,12 +8,6 @@
        <result column="status" property="status" />
        <result column="shuttle_status" property="shuttleStatus" />
        <result column="wrk_no" property="wrkNo" />
        <result column="row" property="row" />
        <result column="bay" property="bay" />
        <result column="lev" property="lev" />
        <result column="his_row" property="hisRow" />
        <result column="his_bay" property="hisBay" />
        <result column="his_lev" property="hisLev" />
        <result column="idle_loc" property="idleLoc" />
        <result column="auto_charge" property="autoCharge" />
        <result column="charge_line" property="chargeLine" />
@@ -23,6 +17,24 @@
        <result column="update_time" property="updateTime" />
        <result column="memo" property="memo" />
        <result column="lift_no" property="liftNo" />
        <result column="pak_mk" property="pakMk" />
        <result column="busy_status" property="busyStatus" />
        <result column="current_code" property="currentCode" />
        <result column="battery_power" property="batteryPower" />
        <result column="battery_temp" property="batteryTemp" />
        <result column="error_code" property="errorCode" />
        <result column="plc_output_status_io" property="plcOutputStatusIo" />
        <result column="status_error_code" property="statusErrorCode" />
        <result column="plc_input_status" property="plcInputStatus" />
        <result column="current_or_before_code" property="currentOrBeforeCode" />
        <result column="code_offset_x" property="codeOffsetX" />
        <result column="code_offset_y" property="codeOffsetY" />
        <result column="current_voltage" property="currentVoltage" />
        <result column="current_analog_value" property="currentAnalogValue" />
        <result column="current_lift_servo_speed" property="currentLiftServoSpeed" />
        <result column="current_move_servo_speed" property="currentMoveServoSpeed" />
        <result column="current_lift_servo_load" property="currentLiftServoLoad" />
        <result column="current_move_servo_load" property="currentMoveServoLoad" />
    </resultMap>